Anyone using an STM32F4xx with CAN interface. I need to use this in a Receive interrupt mode. I see data on the RX input, but no interrupts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 9:52 AM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 10:59 AM
Yes. I am doing this with dual CAN interfaces using the STM32F417, on the STM324xG Eval board, RX interrupts working perfectly. CubeMX project file attached. Also, checkout the example project at STM32Cube\Repository\STM32Cube_FW_F4_V1.25.0\Projects\STM324xG_EVAL\Examples\CAN\CAN_Networking. And make sure your clock is good -- CAN is picky about a good clock.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 10:59 AM
Yes. I am doing this with dual CAN interfaces using the STM32F417, on the STM324xG Eval board, RX interrupts working perfectly. CubeMX project file attached. Also, checkout the example project at STM32Cube\Repository\STM32Cube_FW_F4_V1.25.0\Projects\STM324xG_EVAL\Examples\CAN\CAN_Networking. And make sure your clock is good -- CAN is picky about a good clock.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 12:11 PM
Thanks for your response. My project is an upgrade from an STR911 to the STM32. The spec defines the clock as 250 KHz. How do set the clock to get that freq. The STR911 was straight forward.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 2:31 PM
Yeah, I found this a little confusing too, and this is an area where CubeMX could definitely be improved to help make this easier. The CubeMX project file attached configured both CAN1 and CAN2 for 1Mbps, based on 42MHz peripheral clock. The prescaler of 2 gives a 47.619ns time quantum. The bit period is then 47.619 * (bit segment 1 + bit segment 2 + 1) = 47.619ns * (12 + 8 + 1) = 1us, or 1Mbps. For a 250Kbps bus you can just change the prescaler to 8.
Life would certainly be easier if CubeMX would let you choose from a list of standard bus speeds like 250, 500, 1M, and then calculate the prescaler and bit segment lengths automatically based on the peripheral clock frequency.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-25 9:09 AM
Thanks for your help, it all works. The trick was getting the clock just right and it all started to work. It's different than the CAN in the old STR911.
