-
Notifications
You must be signed in to change notification settings - Fork 981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CAN communication support #259
Comments
Currently, there is no CAN support |
Ok. will it be available in future? |
Yes but I can't tell when... |
Ok... Please try to make support ASAP.. |
@fpistm, by no support you mean there is no library right? So people could program directly against HAL CAN modules? |
@BennehBoy |
Bump. Would love to see some CAN bus support. Seems silly to buy a standalone SPI chip when all you need is a transceiver. |
Hi @jacky4566 |
Unfortunately the UAVCAN example only works with the STM32Duino version 1.4. ` Is there maybe an easy way to get it running with the current version? |
@seeers From version V1.1.3 / 09-October-2018:
It seems there is an |
If you look at the code in this project the Canbus registers are really not all that hard to use. Maybe 3 or 4 key regs. https://github.com/UBC-Solar/Firmware-v2/tree/master/Peripherals/CAN |
I have the Libcanard UAVCAN example mentioned above now up and running / verified on V1.8. As this library (https://github.com/UAVCAN/libuavcan) uses it's own low level access and does not use HAL/LL I only needed to fix the rename deltas so not too bad. UAVCAN based CAN is gaining some traction in both Ardupilot (https://github.com/ArduPilot/ardupilot) and PX4 (https://github.com/PX4/Firmware) so I'm planning to stay on that path. I will update my example project over the weekend and document on https://www.stm32duino.com/ |
Thanks @geosmall for the feedback. You can also document on the wiki if you want. |
Will it work for STM32F4 Series too? @geosmall |
I got it running with parts of your code on an stm32f103c8t6. Thank you very much |
I have examples for F103C8 (Bluepill) AND F303RE-NUCLEO I am updating. The CAN periperals are all pretty close but the devil is in the datasheets :). It would of course need an F4 variant with CAN peripheral (e.g. F405/7, F446, etc and not F401, F411...). |
Ok I'll capture on the forum and then figure out how to contribute to wiki (another first for me so please forgive stumbles :) |
UAVCAN libcanard based CAN example updated for v1.8 here https://github.com/geosmall/UAVCAN-for-STM32-Arduino. F1 preliminary coms testing completed so far. |
I have F446 Board. Please tell me about the required changes. Let me try. |
F103 Bluepill end-to-end CAN testing has now been completed. ESC values input with UAVCAN GUI are sent over CAN bus to Bluepill node, which receives and re-transmits those same ESC values out over Serial. I will test the NUCLEO-F303RE next in a similar fashion. @Vicky-S F446 should work fine, it has 2 CAN peripherals. I believe changes should be confined to can.c. Getting started with CAN bus development can be tedious, if anything in the chain is off you get nothing out, so I would suggest starting with a confirmed working target first to wring out the hardware setup as a start. But if you have known good hardware then go for it. I had a bunch of early problems with counterfeit china sourced FTDI and CAN hardware I had to sort through before my setup worked. I suggest further discussion move to the forum here.: https://www.stm32duino.com/viewtopic.php?f=10&t=99 |
F103C8 and F303CC UAVCAN functional testing now completed for both examples. |
Is there any progress on CAN support for STM32? It would be really useful for many projects. The example code from @seeers for example would be enough for me currently, but I can seem to figure out how to use the PA11 and PA12 in stm32f103c8t6 instead of the PB8 and PB9 that the code does remapping of the pins. https://github.com/seeers/CAN-Bus-Arduino_Core_STM32 |
@pazi88 |
@pazi88 how did you edit the code in order to use PA11 and PA12? |
@orhaneee See the code in here: https://github.com/pazi88/8Ch-EGT I have included CAN code to mine, but you should be able to make that out. The register settings are slightly different depending what pins you want to use. That all is verified to work. |
@orhaneee |
@nopnop2002 Thanks for that! I have tried to figure out how to make CAN work on F4 too, but that will save lot of time. |
@pazi88 |
Any progress on implementing Hardware CAN library? |
I have made a working CAN library based on libraries I have found. It should work both with can0 and can1 on devices with two CAN devices, but I have only tested it with CAN0. USB serial cannot be used together with the CAN library on stm32f103 bluepill devices. Link: https://github.com/J-f-Jensen/libraries |
Thanks for sharing @J-f-Jensen |
any CAN FD support for NUCLEO-G474RE? |
Nice library, but what I can see it only works on F1. It fails to build on F4. |
What error do you get? I can be a issue with the hal config fileBr Jens
-------- Oprindelig besked --------Fra: Pasi Kemppainen <[email protected]> Dato: 26.11.2020 14.13 (GMT+01:00) Til: stm32duino/Arduino_Core_STM32 <[email protected]> Cc: J-f-Jensen <[email protected]>, Mention <[email protected]> Emne: Re: [stm32duino/Arduino_Core_STM32] CAN communication support (#259)
I have made a working CAN library based on libraries I have found. It should work both with can0 and can1 on devices with two CAN devices, but I have only tested it with CAN0. USB serial cannot be used together with the CAN library on stm32f103 bluepill devices. Link: https://github.com/J-f-Jensen/libraries
Nice library, but what I can see it only works on F1. It fails to build on F4.
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.
|
For example there is no AFIO registers in F4. And there was some other errors too. |
Hi @pazi88 https://github.com/stm32duino/wiki/wiki/HAL-configuration#hal-modules-configuration |
Does anybody know of a library that will work with the HAL_FDCAN_MODULE_ENABLED? |
@shaneyake The library only works for F1 series as far as I know, because that's the only one using AFIO for pin mapping. F4 andvothets have different way to map pins, so that's why it wont compile (as I mentioned above). |
any progress on this? would be very useful to have can support... |
You can use this library I created. Uses HAL drivers, hadware interrupts and it's easy to use. Should work with every stm32 chip that is supported by stm32duino: https://github.com/pazi88/STM32_CAN |
I have been meaning to do some last modifications to that and maybe make a PR for that to be added in stm32core. I have been personally used that with many projects communicating busy vehicle CAN busses and it works great (other ones I have found, have many problems). |
Wow thanks @pazi88 will test tomorrow! Was previously using MBed but it is failing with high bus loads.... |
Hi @pazi88, do not hesitate to male a PR or you can also share it as an Arduino library. |
Yes with other libraries available I also had problems with high bus loads, but with this one all seems fine, because both TX and RX side are interrupt based and the packets are gathered to buffers that have configurable size. |
It works already as Arduino library. But I'll do those additions I have been meaning to do and do a PR then. |
There is a working Can instance here, but this is not a library, I have tested it to work on stm32f103c8t6 and use it in production. |
https://github.com/nopnop2002/Arduino-STM32-CAN |
I could not find any example for CAN communication in STM32 official core. Is there any?
The text was updated successfully, but these errors were encountered: