CANopenNode application interaction

2013-02-06
2014-12-18
  • Niklas Norin
    Niklas Norin
    2013-02-06

    Hi,

    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.

     
  • Janez
    Janez
    2013-02-06

    Hi,

    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.

     
  • devkikko77
    devkikko77
    2013-02-16

    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

     
    Last edit: devkikko77 2013-02-16
  • saressler
    saressler
    2013-02-21

    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!

    Thanks.

     
  • Janez
    Janez
    2013-02-22

    Hi,

    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:
    https://sourceforge.net/p/canopennode/code/27/tree/CANopen_stack/stm32f103x/
    https://sourceforge.net/p/canopennode/code/27/tree/Example_IO/STM32f103x/

    p.s. Which compiler(s) and IDE(s) are most used for STM32F4?

     
    • devkikko77
      devkikko77
      2013-02-23

      Hi,

      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

       
      Last edit: devkikko77 2013-02-23
  • Niklas Norin
    Niklas Norin
    2013-02-28

    Hello everyone,

    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.

     
    • Clint
      Clint
      2013-05-21

      Niklas,

      I tried downloading your attachment, but I cannot open it. My PC says the file is corruptted. I the file available somewhere else?

       
  • saressler
    saressler
    2013-03-04

    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.

     
  • Janez
    Janez
    2013-03-05

    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:
    http://sourceforge.net/p/canopennode/code/29/tree/CANopen_stack/genericDriver/

    Any comments or suggestions?

    I will update the remaining files in next days.

     
  • Janez
    Janez
    2013-03-11

    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:
    https://sourceforge.net/p/canopennode/code/32/tree/

     
    • Clint
      Clint
      2013-05-21

      Janez,

      Would it be possible for you to make an up to date zip file of the code available?

       
  • Janez
    Janez
    2013-05-23

    I'm trying to keep SVN most up to date.
    You can get the most up to date zip here:
    https://sourceforge.net/p/canopennode/code/HEAD/tree/

    click "Download Snapshot"

    I don't have any better port for STM.

     
  • baoyoubing
    baoyoubing
    2014-12-18

    very good!thank you!Janez,i got it.