CAN Bus Library for STM32F103
watswat5 Mon May 04, 2015 9:19 pm
I’m looking for a working CAN library for the stm32f103. I know it has the hardware for it, but looking at some example code (found here:
https://www.olimex.com/Products/Duino/S … e-hardware), I’m totally lost.
Can someone create a CAN library similar to the MCP2515 library for Arduino? That library is intuitive and easy to use, even for users who know almost nothing about CAN.
The MCP2515 Library can be found here: https://github.com/coryjfowler/MCP_CAN_lib
Replies
RogerClark Thu Oct 20, 2016 8:30 pm
For big changes ( which I suspect this is), I create a new branch, pull to that branch then push the new branch back to github for others to test.
I am not sure if I could personally test this, as I am not sure I have any CANBus hardware.
I may have a digital compass somewhere which is CANBus but it was scavenged from an old quadcopter and I have no idea what type it is.
DrBanana Fri Oct 21, 2016 1:46 pm
RogerClark wrote:I am not sure if I could personally test this, as I am not sure I have any CANBus hardware.
RogerClark Fri Oct 21, 2016 7:51 pm
Thats not really a valid test.
You would need to test with hardware from other vendors.
Phono Fri Oct 28, 2016 9:51 am
I have installed Git and prepared the files for the pull request. I have written a text file explaining where changes are done in the system (these changes are required because the CAN interrupt vector is shared with the USB interrupt vector, so I have added code to route the interrupt to the CAN interrupt handler when required).
My question is: where in the directory tree must I put this explanation file? At the root of the HardwareCAN library, perhaps?
RogerClark Fri Oct 28, 2016 10:01 am
Perhaps add an example with a description in it
Phono Mon Oct 31, 2016 10:12 pm
I have done as you said. In the example directory I have added an example, with an include file that is actually only a comment on the history and the changes to be performed to the core to allow proper operation of the CAN interface.
However, I do not yet master Git, so I may have done it the wrong way. Could you please check that the library is complete, and that 3 files are submitted to replace 3 files in 3 different directories of the core?
Thanks.
RogerClark Mon Oct 31, 2016 10:40 pm
Can you post the link to your repo
Phono Mon Oct 31, 2016 11:26 pm
RogerClark Tue Nov 01, 2016 12:27 am
Thanks
PR’s are in a state of flux at the moment, so I think I need to clear the backlog before I process yours.
There are some others relating to USB Serial, which may impact on yours as well, due to the shared interrupt, but I won’t know for sure until I merge the existing PRs
protwitness Tue Nov 01, 2016 8:15 pm
Looks like your commit only has one modified file (usb.c) and not the rest of your additions. Make sure you’ve added all the files you want to commit using git add
Phono Fri Nov 04, 2016 5:09 pm
I must admit that I am a little bit lost using Git. I am using the web interface (
https://github.com/Phonog/Arduino_STM32 … og-patch-1). However, when I browse the directories, I find the files in there place. These must be :
– STM32F1/libraries/HardwareCAN for the library;
– STM32F1\cores\maple\libmaple\rcc_f1.c
– STM32F1\system\libmaple\stm32f1\include\series\rcc.h
– STM32F1\cores\maple\libmaple\usb\stm32f1\usb.c
Can you check?
If there is something wrong, please help me fixing it.
petit_miner Mon Nov 07, 2016 6:57 pm
Any further progress so far?
I can’t find the CAN Bus library in your github repo.
https://github.com/Phonog/Arduino_STM32/Phono Mon Nov 07, 2016 9:55 pm
Surely I am no Git expert.The changes are not in the master branch, but in the branch Phonog-patch-1. Can you access it?
ddrown Tue Nov 08, 2016 3:34 am
Phono wrote:Surely I am no Git expert.The changes are not in the master branch, but in the branch Phonog-patch-1. Can you access it?
Phono Tue Nov 08, 2016 7:52 am
More or less… When I look at the contents of my branch (Phonog-patch-1), I find all files in their right place :
– usb.c in STM32F1/cores/maple/libmaple/usb/stm32f1/
– rcc.h in STM32F1/system/libmaple/stm32f1/include/series/
– rccf1.c in /STM32F1/cores/maple/libmaple/
and the library in STM32F1/libraries/
However, when I look at the comparison result (the link you mention), I find rcc.h, rccf1.c and usb.c in the library directory.
So I do not understand. However, all the files are there. If you can fix the location error, it is ok.
I apologize for a few comments in french I overlooked to translate in english.
And_Ru Fri Nov 11, 2016 11:21 am
[quote=”Phono”][/quote]
Could you please make a simple example that listen everything and print it to the “serial.print”?
I want to test it connecting to MCP2515 board (wich I also need to explore).
Phono Mon Nov 14, 2016 9:01 pm
to And_Ru : I am sorry, but the library is dedicated to the integral CAN interface of the STM32F103. Maybe one day it will be expanded to other interfaces.
RogerClark Mon Nov 14, 2016 9:31 pm
Any chance you could investigate porting the library to the official STM F1 core
https://github.com/stm32duino/Arduino_Core_STM32F1Phono Tue Nov 15, 2016 8:02 am
Is this core to be used in other programming environments than Arduino IDE? It will not be a quick job. Maybe when I have spare time…
RogerClark Tue Nov 15, 2016 8:35 am
@phono
Actually, in hindsight, you are better off staying with LibMaple as the core for at least the next 6 months as to use CAN on the new core would require a lot of rewriting as the STM core uses STM’s own HAL (not libmaple) so there would need to be a lot of changes to port to that core.
Sign in to reply