Known Neo Arduino problems overview

Discussion in 'UDOO NEO' started by waltervl, Jul 2, 2016.

  1. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    This topic is a summary of the known issues with the Arduino part of the Neo on a Udoo released OS. The Neo Arduino processor is different than the Arduino Uno were it should be compatible with. In practice when you want to use some higher level usage of the Arduino features you run into issues. This topic is to summerise these to help each other with testing and solving these.

    Please do not ask questions here about problems! React in the linked topic or start a new topic and I will add it to this list that will be shortened as they are being solved! If I missed an issue or an issue is solved please react here.

    For already known and acknowledged issues see also the documentation pages Differences , String Issue and Porting Libraries

    1. [SOLVED] Serial Connection /dev/ttyMCC unreliable (and other threads)
    2. Interrupts unreliable.
    3. Analog pins cannot be used as digital pins
    4. ADC readings from A9 and M4 giving "wrong" values
    5. Serial.write((int)0) not working
    6. SPI arduino not working
    7. [DOCUMENTED]Neo not reading Serial /dev/ttyMCC slows down Arduino M4
    8. SOLVED - Servo.h has an error (temporary fix in topic)

    Libraries
    Next to issues is the unknown list of compatible libraries (see also doc Porting Libraries and topic Library Compatibility)
    Working Libraries are (if I forgot one please react here):
    • Servo (with a problem, see #8)
    • LiquidCrystal
    • Wire
    • Stepper (compile test only)

    Important libraries known not to work, as a reference the list of official Arduino libraries:
    • SoftwareSerial
    • Firmata
    • Neopixels
    • SPI (Current one based in V1.0, see #6)
    • Onewire
    Other Related Issues
    CAN on A9 not working when a Arduino sketch is running on M4

    Updated 12-01-2017: added Onewire as unsupported library.
     
    Last edited: Apr 26, 2017
  2. I Hate Google!

    I Hate Google! New Member

    Joined:
    Jun 20, 2016
    Messages:
    28
    Likes Received:
    17
    Excellent summary.
     
  3. modjo

    modjo Active Member

    Joined:
    Sep 29, 2014
    Messages:
    417
    Likes Received:
    127
  4. I Hate Google!

    I Hate Google! New Member

    Joined:
    Jun 20, 2016
    Messages:
    28
    Likes Received:
    17
    Add a possible one - the decode on the barometer brick looks suspect (that, or mine is faulty!)

    The pressure reads consistently below the actual published (about 5-8hpa) and if that weren't bad enough (it's correctable) the temperature sensor is (right now) reading 24C compared to 19C from the LM75 - my calibration instrument is showing 18.1 which is nearer the mark, but 19C is quite within parameters!

    If anyone can point me at the driver I'd like to have a poke around.
     
  5. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    I don't want to be rude but is this an issue with the Arduino compatibility or a brick issue in general? Do you have an running thread about this issue? ( I believe so but I am mobile right now)
     
  6. I Hate Google!

    I Hate Google! New Member

    Joined:
    Jun 20, 2016
    Messages:
    28
    Likes Received:
    17
    Brick I think. I'm going to chuck the towel in with temp sensing for now. I can't get a reliable reading (such is the nature of these beasts).
     
  7. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Looks like udoo team already changed some docs. Updated start topic.
     
  8. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Hi guys,
    first of all many thanks to @waltervl for this thread. It's soooooo useful!
    Concerning interrupts we've added a new section in the docs about it, here: http://www.udoo.org/docs-neo/Debugging_&_Troubleshooting/Arduino_Interrupt_Issue.html Hope it helps overcoming the problem, and if not, please tell us and we'll figure it out.
    Regarding the first point we're going to publish (hopefully next week) a new version of UDOObuntu that should solve most of these problems, like uploading sketches, serial stability (speaking of the unreliability of MCC) and the hang of the sketches.
    Regarding the third point we want to solve this problem but actually we haven't got the hang of it yet. If you got any clue it would be extremely helpful.
    We still have to look into problem #4 #5 and #6.
     
    waltervl likes this.
  9. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Thanks for the feedback Andrea! I have updated the threads where appropriate.
     
    Andrea Rovai likes this.
  10. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Topic has some updates 3. Analog pins cannot be used as digital pins
     
  11. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  12. tcmichals

    tcmichals Member

    Joined:
    Feb 25, 2015
    Messages:
    54
    Likes Received:
    27
    What changes were required to make MCC more stable?
    • Kernel changes?
    • MQX?
    What changes were required to make Uploading sketches more reliable?
    • fixes to Upload tool? (URL to tool source?)
    • Kernel clock issues?
     
  13. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
  14. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  15. matib12

    matib12 New Member

    Joined:
    Feb 9, 2016
    Messages:
    17
    Likes Received:
    7
    My solution for MCC is shared memory between cores. I recompile each time new kernel without MCC (it would be nice to have it built as a module). I use the unused memory space for my data structures. It requires some attention during software writing but in my case it is still more stable than MCC.
    Code for Arduino side:
    Code:
    #define MCC_BASE_ADDRESS (0xBFF00000) //End of System RAM 0xbfefffff
    
    typedef struct telemetry {
       float roll; //from Arduino to Linux
       float pitch; //from Linux to Arduino
    };
    
    struct telemetry *tele_str = (struct telemetry*)MCC_BASE_ADDRESS;
    
    loop(){
      tele_str->roll = 12;
      float temp = str->pitch;
    }
    Code for Linux side requires some libraries
    Code:
    #include <stdio.h>
    #include <unistd.h>
    #include <fcntl.h>
    #include <sys/mman.h>
    
    #define MCC_BASE_ADDRESS (0xBFF00000) //End of System RAM 0xbfefffff
    
    typedef struct telemetry {
       float roll; //from Arduino to Linux
       float pitch; //from Linux to Arduino
    }; // this structure must be identical with the one on Arduino side.
    
    struct telemetry *tstr;
    
    int main(){
      tstr=(struct telemetry*)malloc(sizeof(struct telemetry));
    
      off_t offset = MCC_BASE_ADDRESS;
      size_t len = 0xfff;
    
      // Truncate offset to a multiple of the page size, or mmap will fail.
      size_t pagesize = sysconf(_SC_PAGE_SIZE);
      off_t page_base = (offset / pagesize) * pagesize;
      off_t page_offset = offset - page_base;
    
      int fd = open("/dev/mem", O_RDWR|O_SYNC);
      mem = (unsigned char *)mmap(NULL, page_offset + len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, page_base);
      if (mem == MAP_FAILED) {
        perror("Can't map memory");
        return -1;
      }
    
      memcpy(tstr, mem,sizeof(struct telemetry));
      float temp = str->roll;
    
      tstr->pitch = 13;
      memcpy(mem, tstr,sizeof(struct telemetry));
    
      free(tstr);
      close(fd);
    
      return 0;
    }
    
    Treat this code as a curiosity. It is difficult to maintain and develop. I hope we will find a better solution.
     
    waltervl likes this.
  16. icce

    icce New Member

    Joined:
    Mar 13, 2016
    Messages:
    16
    Likes Received:
    3
  17. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    I don't understand what do you mean. @ektor5 is a colleague of mine at the UDOO Team. That is a commit of ours in our repository. The fix is inside and shipped with the latest release of the board manager.
     
  18. icce

    icce New Member

    Joined:
    Mar 13, 2016
    Messages:
    16
    Likes Received:
    3
    @Andrea Rovai Actually I tested with the latest image I got from the website. But when I checked the LiquidCrystal_Neo library, it stayed the same, so that I had to go back to @ektor5 post to make the change. And it worked.
     
    waltervl likes this.
  19. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    You are definitely using an old version of the UDOObuntu. In the latest version there is no more LiquidCrystal_Neo but the name has been standardized in LiquidCrystal so download the latest version (http://www.udoo.org/downloads/) and check this file
    Code:
    /usr/share/arduino/hardware/UDOO/solox/libraries/LiquidCrystal/LiquidCrystal.cpp
    With this command
    Code:
    dpkg -l | grep arduino
    you can check which version you're using
    This
    Code:
    arduino-core-udooneo_1.6.6+00013+gd8afd41
    is the latest version. In this version the changes you are proposing are already integrated.
     
  20. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Well the first update did not solve the /dev/ttyMCC reliability but last week some changes were made by the Udoo team that seems to improve things a lot. See and react in that topic please: Serial Connection /dev/ttyMCC unreliable
     

Share This Page