The short version: The CAN bus 2 channel on ARM microcontrollers only works if CAN 1 is also set up… That is, CAN 2 can not be set up independently; for it to work at all, the other CAN channel, CAN 1, must also be set up. This isn’t mentioned anywhere in the documentation, not even the slightest hint (not even when retrospectively searching for it).
This is demonstrated here for the 1Bitsy board (based on the STM32F415 microcontroller; STM32F415RGT6) and using Forth for exploration (Mecrisp Stellaris), but it is believed this problem applies to all ARM microcontrollers with more than one CAN channel.
Appendix B: Development board 1Bitsy
Schematics (in PDF format). Direct Git link.
Appendix C: Microcontroller STM32F415
The one on the 1Bitsy is:
- STM32F415RGT6
- STM32F415 32 bit 168 MHz
- ARM Cortex-M4F
- 192 KB RAM
- 1 MB Flash
- AES hardware acceleration
Appendix D: Forth system Mecrisp Stellaris
GitHub page. Direct Git link.