I'm currently in the process of writing an application using CANopenNode. I've successfully ported the library to the STM32F4 and is running it on two STM32F4-discovery boards. I'm still in the process of learning the ins and outs of CANopen but I have tested the IO example and the TPDO-RPDO interaction is working correctly as far as I can tell.
At the moment I am polling the mapped Object Dictionary variables for changes with a software timer. Is it possible to watch a variable for change and get a notification of any sort?
Another question is if CanOpenNode can in any way be run in two instances on the same processor? It would be run on two different CAN interfaces of course.
You are probably asking, how application can detect a write to variable by RPDO? It's not implemented, but it is a plan for that. If you get the code from SVN, there are rewritten CO_SDO files, which have prepared flags for that purpose.
For the second question the answer is yes. You can do any combination with multiple CAN interfaces: multiple separate stacks, common object dictionary, some PDOs on second channel, etc. You have to edit CANopen.c file for that.
Hi Niklas, i'm working with port this project to stm32f4-discovery if you have already port can make your code public?
thanks a lot
Hi, I am also working on a STM32F4 project. If you have this port complete already it would save me a bunch of time. Please let me know!
I will help if someone will decide to share his driver for STM32. I don't work with this microcontroller, but I can stil give some comments and suggestions. I can add someone as a developer, so he can work on the project more actively or someone can send me the files and I will put them to SVN.
Is anyone using port to stm32f103x? Can be the same for STM32F4? Source is on SVN:
p.s. Which compiler(s) and IDE(s) are most used for STM32F4?
I work at this port but i don't have a lot of time tu spend on it...The work on stm32f103x is similar but not the same.
I use coide (coocox.org is free for home and commercial use, but not opensource) for write code to ARM M4
after some consideration we have decided not to use CANOpen at all.
As I said in my original post I did however port and run CANOpenNode successfully and you will find the driver and config file attached. The driver is based on the existing driver for stm32f103x.
I do not have a running example but at least you will know that the hardware initialization is correct. Use the main file from the stm32f103x port and you will be up and running in no time.
I ran this port on the STM32F4-Discovery with an attached Atmel ATA6660 CAN Transceiver.
Hopefully some developer can take these files, make a running example and push it to the SVN.
I tried downloading your attachment, but I cannot open it. My PC says the file is corruptted. I the file available somewhere else?
Thanks for posting this. I'll be building my hardware in the next week or so (STM32F405), and then will be happy to provide a sample project based on this driver.
I'm now reorganizing the code. First styling (doxygen usage, replace UNSIGNED8 to uint8_t, etc.) Then some details (get rid of double pointers and mallocs inside files, try to follow Misra-C). Structure will remain the same.
I added generic driver files, which will compile on each system, but with missing interface to the hardware. (Could be used as a template.) There is some better explanation (I hope). You can preview the files here:
Any comments or suggestions?
I will update the remaining files in next days.
CANopenNode is now updated to new style and has new documentation. Memory allocation is now removed from files.
Added is driver for STM32F4xx. It is the same as last posted in this topic, with my changes included. So please use this code. If someone will send me the working driver I will include it with the stack and will try to keep it up to date with other files.
From now on the interface to the functions won't drastically change.
Please get the code from SVN:
Would it be possible for you to make an up to date zip file of the code available?
I'm trying to keep SVN most up to date.
You can get the most up to date zip here:
click "Download Snapshot"
I don't have any better port for STM.
very good!thank you!Janez,i got it.