Add CAN support for nucleo-l476rg#13534
Conversation
|
@JannesVolkens might be interested. |
I’ve checked the reference manual for the mcp2551 transceiver and to me it seems like you do not actually need a driver to work with this transceiver. Pin 8 (RS) of the transceiver determines which mode the transceiver is operating in: But I may be mistaken. When running the test under tests/conn_can and typing in “test_can” the application should show you all the different commands you can use for this test. |
Are you sure you need a driver for that? As far as I understand it, the mcp2551 turns a digital can tx/rx into a can signal (canH/canL). It functions as an interface between the CAN-controller and the physical bus. Unless you meant the mcp2515 ofcourse, which is an SPI can controller that is compatible with the mcp2551. I have a PR ready for the mcp2515 drivermodule, but I'm still waiting for #13360 to be merged before I can open the mcp2515 PR. |
I'm using this transceiver. My setup: I tested the CMDs provided by test_can example, but when I try to send a message it returns to me Any idea to help me to debug it? 🤓 |
It's an mcp2551 (a transceiver only). Had you used an STM's mcu? |
|
I enabled the debug on STM32's can driver, I report here some test test_can list : works. test_can power_up 0 : It goes down after few seconds test_can get_* works test_can set_bitrate works test_can get_counter Send doesn't work, all command about send fails with the same error. |
No, I used an AVR. That's why I had to use the extra mcp2515. Because unlike the STM32 you are using, the AVR doesn't have an internal CAN periph. |
Is your bus terminated by 120 ohm resistors at both ends of the bus between CAN high and CAN low? See https://en.wikipedia.org/wiki/CAN_bus#/media/File:CAN_ISO11898-2_Network.png |
Maybe this is the problem, I don't terminate the bus. I'll do new attempt and I will update you |
|
I can confirm that not terminating the bus will in most cases cause problems with the MCP2551. It really is not an optional thing. |
|
@JannesVolkens @wosym thanks for the suggestions. it works now! On the first board. On the second board. I did two mistakes:
I fixed the commits to make Travis happy |
5d277b4 to
f2e74ae
Compare
|
ping: @PeterKietzmann @aabadie I need a review, |
fjmolinas
left a comment
There was a problem hiding this comment.
Looks good, please squash right away with the suggested change to keep line size. I'll trigger murdock afterwise
f2e74ae to
2bc0313
Compare
fjmolinas
left a comment
There was a problem hiding this comment.
Documentation doesn't build properly, please apply these changes.
498382a to
20dbcd9
Compare
STM32L4 CAN implementation: - STM32L47x/L48x has single CAN - STM32L49x/4Ax has dual CAN
20dbcd9 to
0626e7a
Compare
it's should be ok 🍺 |
fjmolinas
left a comment
There was a problem hiding this comment.
Documentation now builds correctly, changes make sense and test output has been posted in the PR. ACK
|
Thanks for the contribution @Ciusss89 |


fix #13258
CAN driver has been added to the STM32 target since commit ae95137. As reported by @vincent-d it should be work with other STM32' CPUs
I'm trying to extend the support of priph_can to Nucleo-l476rg:
STM32L476RG has only one CAN controller. It's mapped on
I chose to map the pins on the arduino header (CN5). The alternate function should be AF9 (take a look here to for its GPIO pin MUX)
I'm using mcp2551 transceiver module, unfortunately, riot-os doesn't have its driver but I did a look to cf34161 42c5c40 and I should be able to add the missing driver for mcp2551.
Goals:
can listshows the registered can periph, )thanks
This output is generated by these commits with example conn_can