cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 CanBus cannot get out of interrupt handler

mehmet.karakaya
Associate III
Posted on February 28, 2017 at 12:01

hello dear forum,  I try to make CANBUS of

http://www.mikrocontroller.net/part/STM32F103

RC 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 ( in std library I could

not find any information about this )

---------------------------------------------

void USB_LP_CAN1_RX0_IRQHandler(void) { CAN_ClearFlag(CAN1, ??????????);

CAN_ClearITPendingBit(CAN1,??????????);    CanRxMsg RxMessage;    CAN_Receive(CAN1, CAN_FIFO0, &RxMessage);

---------------------------------------------

thank you

#canbus #stm32f103
3 REPLIES 3
T J
Lead
Posted on February 28, 2017 at 14:35

Did you get it working ?

I purchased a CanDo unit from the UK, it is the best way to debug since you can see what is happening on the Canbus.

My Canbus solution works very well.

The reason is that the Canbus fifo's do all the work and my foreground only needs to check in every 1 frames...

which is dependent on the transmission baud rate.

I am running 250KHz on a 48MHz '091, it works flawlessly.

I use an 8byte frame, maybe that's why is seems easy..

100 bits each @ 250Khz, is 300uS per RxFifo full Flag,

So I had to use the interrupt to be sure we don't lose any frames.

Posted on February 28, 2017 at 15:50

hello Marsh

I would be thankfull if you can post your code

Posted on March 01, 2017 at 00:14

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6cl&d=%2Fa%2F0X0000000brz%2FHsbgjsXPEyALCzIKGX8A9BK5ueF_yHrEzN_mINIx9.Y&asPdf=false