cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN Receive data issue in STM32G0B1RE

Karthik Kumar
Associate III

Hello Every One!!

I am Using NUCLEO G0B1RE Board, facing Issue with CAN Receive Function I am using MICROCHIP CAN BUS ANALYSER and NUCLEO BOARD for CAN Communication

void CAN_Recieve(void){

while( (HAL_FDCAN_GetRxFifoFillLevel(&hfdcan1,FDCAN_RX_FIFO0)   < 1  )  )

{

}

if(HAL_FDCAN_GetRxMessage(&hfdcan1,FDCAN_RX_FIFO0, &RxHeader ,RxData) != HAL_OK)

{

  Error_Handler();

 }

}

and also in my main function after all the HAL inits for my project

while(1)

{

CAN_Recieve();

ADC_Calculation();

delay_ms(1000); //1sec

PWM_Control();

 }

let me explain what i have observed

for the first time when i send data from CANALYSER to Nucleo Board it receives Identifier and Data sucessfully, If i dont send the CAN message from CANALYSER for the send time the MCU is hang in the While Loop ,its not executing ADC calculation and PWM_Control functions in my main function

this is the API

while( (HAL_FDCAN_GetRxFifoFillLevel(&hfdcan1,FDCAN_RX_FIFO0)   < 1  )  )

{

}

unless until I send another CAN message from CANALYSER it reads sucessfully.

I want to resume my Main Function even if send the CAN message from CANALYSER or not it should execute my Main function while Loop

please suggest me

Regards,

Karthik

0 REPLIES 0