CANopen using Flexcan

Discussion in 'UDOO NEO' started by Holdor, Jan 9, 2017.

  1. Holdor

    Holdor New Member

    Joined:
    Dec 3, 2016
    Messages:
    4
    Likes Received:
    1
    Hi All,

    I've been working on developing CANopen communication using the inbuilt CANbus and additional transceiver units on an Udoo Neo Full.

    Got everything working fine, CANopen slave node is easy to read/write to, this is all being done using the A9 processor and the UDOObuntu OS system running the programs.

    The problem that I'm having is that when I come to start programming anything on the M4 processor (the M4 is enabled but in assuming just inactive at this point, and CAN open works flawlessly), even an empty sketch with nothing in it, as soon as I upload the sketch the CANopen stops dead and can be started again until the file /var/opt/m4/m4last.fw is deleted, and I reboot.

    If I enable loopback mode on the CAN and run the M4 process I can see that the program still runs in the background.

    Does anyone have any suggestions on how to keep the CANopen running whilst running a program on the M4? I'm assuming its got something to do with the standard pin assignments for the M4, but if anybody can point me directly at the root problem that would be awesome.

    Thanks.
     
  2. Holdor

    Holdor New Member

    Joined:
    Dec 3, 2016
    Messages:
    4
    Likes Received:
    1
    Update, I've just noticed that the ECSPI pins form the M4 are assigned to the same pins for CAN 1 and CAN 2 and are linked to the A9 core.

    "ECSPI 5

    ECSPI 5 has the same pin order, function, and position as Arduino UNO. By default it is assigned to the M4 core, but configured as digital input/output (GPIO)."

    Any Idea how to un-link or disable this function in the M4 core?

    Thanks.
     
  3. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Although reassigning the CAN pins in the dts files may resolve part of the problem, you need to remove the gpio pins on the ardunio side from wiring_digital.h see .
     
    Andrea Rovai likes this.
  4. Holdor

    Holdor New Member

    Joined:
    Dec 3, 2016
    Messages:
    4
    Likes Received:
    1
    Awesome, thanks for the response.

    OK so, I've reduced the ARD_NMAX_DIO to 10 but so far no joy (tried a few combinations all the way to 1, but to the same effect), and also commented out the ARD_DIO10_MUX_GPIO - ARD_DIO13_MUX_GPIO and ARD_DIO10 - ARD_DIO13 and in the DioPinMap (I know that shouldn't make a difference, but just in case).

    Any suggestions as to what I might have missed or anything else I can try? I'm still seeing exactly the same effect, as soon as the m4 has a sketch, the CAN communication dies.

    Thanks.
     
    Andrea Rovai likes this.
  5. modjo

    modjo Active Member

    Joined:
    Sep 29, 2014
    Messages:
    417
    Likes Received:
    127
    @Holdor , did you resolve this problem ? Because i'm face at the same problem and can't resolve it for the moment ... I suppose the problem is not with the declaration in wiring_digital.h, but perhaps an implicit configuration of ecspi5 in M4 BSP for udoo arduino but i didn't find how to resolve this ... I suppose that udooTeam need to modify the file init_gpio.c in bsp source and rebuild the files ... @Andrea Rovai , can you check this please ?
    Otherwise, i have open an issue on gitHub
     
    Last edited: Apr 24, 2017
  6. modjo

    modjo Active Member

    Joined:
    Sep 29, 2014
    Messages:
    417
    Likes Received:
    127
    Any update on this issue ?
     
  7. Holdor

    Holdor New Member

    Joined:
    Dec 3, 2016
    Messages:
    4
    Likes Received:
    1
    @modjo, apologies I've been offline for a while now. Never got to the root cause of the issue unfortunately, but given the symptoms of the issue, I believe that there is an issue with the processors sharing hardware services (particularly timing). This means that whilst the M4 is inactive the A9 can run the CANopen functions and the CANutils that are available, but as soon as the M4 sketch is enabled it requires the same services and effectively hangs up the A9 processes that require the same hardware timing services. CAN functions work a treat though, and whenever I get time I try and figure out the fix, but so far no joy.
     

Share This Page