STM32 CanBus cannot get out of interrupt handler

Gast #4918516
Lesenswert?

hello dear forum,

I try to make CANBUS of STM32F103RC work
I managed to make CANBUS send message in loopback mode
however when I turn on receive interrupt
the processor hangs at first message and watchdog resets the micro
---------------------------------------------
 CAN_ITConfig(CAN1, CAN_IT_FMP0, ENABLE);
---------------------------------------------
I suspect the code enters the interrupt handler and cannot leave it
I want to ask how do I fill following lines to reset interupt flag and 
pending bit
---------------------------------------------
void USB_LP_CAN1_RX0_IRQHandler(void)
{
CAN_ClearFlag(CAN1, ??????????);
CAN_ClearITPendingBit(CAN1,??????????);

  CanRxMsg RxMessage;

  CAN_Receive(CAN1, CAN_FIFO0, &RxMessage);
---------------------------------------------
thank you
#4919285
Lesenswert?

Hey mehmet,

You use neither CAN_ClearFlag nor CAN_ClearITPendingBit. According to 
the reference manual (p. 683) CAN_IT_FMP0 is set and reset by hardware. 
As soon as you call CAN_Receive one message from the RX FIFO is read. 
The interrupt won't be called again, as soon as the FIFO message count 
has reached 0.

Greetings

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren