Announcement

Collapse
No announcement yet.

uOLED96 and SAMD21 board

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • uOLED96 and SAMD21 board

    I built a custom SAMD board awhile back for a NERF gun project I'm working on. I'm using a uOLED-96 display to show images, numbers, etc. I wrote my Arduino code about 6 months ago and it was working perfectly until I went to go update it the other day and it caused the chip to hang on defining the serial board to be used. The code uploads fine however it's clear that chip does not execute any of the code and will not connect to the computer as a new port. Every time this happens, I have to re-flash the chip using my Atmel ICE and Atmel Studio 7. If I remove this line, the (non-4D system) code runs fine.

    I've tried the code on several different, known-working, SAMD boards and they all have the same issue. I even tried it on a different computer and the same.

    Code:
    #include <Servo.h>
    
    #define DisplaySerial Serial1 
    
    #include <Goldelox_Const4D.h>
    #include <Goldelox_Const4DSerial.h>
    #include <Goldelox_Serial_4DLib.h>
    #include <Goldelox_Types4D.h>
    
    Goldelox_Serial_4DLib Display(&DisplaySerial); //<---- HANGS HERE

    What's changed since the code last worked? New computer, updated Arduino IDE version and updates to the arduino Goldelox library (although it didn't look like much changed).

    Any thoughts on what it could be?

  • #2
    Hello there,

    I just need to know a few things so we can find out what's going on.

    Can I confirm you are saying the code worked up until a few days ago? What update exactly did you think caused this, because like you said, the Goldelox library has not had any major changes in quite a while. Another source could be the Arduino IDE updating your board collection, which would mean we can downgrade it with the boards manager.

    Would you be able to try using a non-SAMD board and see if you get the same issue?

    Also, not sure how that line of code could be the source of error, can you tell us why you think that may be the problem?

    Let me know so we can find a solution,
    Adem

    Comment


    • #3
      Hi Adem,

      Thanks for your response!

      Can I confirm you are saying the code worked up until a few days ago?
      - Sorry I wasn't very clear. I uploaded the original code 6 months ago and it worked fine, then I didn't work on the project for 6 months until a couple days ago when I tweaked a constant value and then it didn't work. I've been working on other projects since in Arduino and with custom SAMD boards and haven't had issues, but none with a 4D display.

      Another source could be the Arduino IDE updating your board collection, which would mean we can downgrade it with the boards manager.
      - This was one of my first checks. I'm using the Sparkfun SAMD21 Dev board bootloader and board type (github) for my board. I did notice that it requires the Arduino SAMD boards package 1.8.1 which I made sure of after I ran into issues. It didn't fix anything though.

      Would you be able to try using a non-SAMD board and see if you get the same issue?
      - Yes I tried this.

      This did not work on the SAMD21 board:
      Code:
      #include <Goldelox_Const4D.h>
      #include <Goldelox_Const4DSerial.h>
      #include <Goldelox_Serial_4DLib.h>
      #include <Goldelox_Types4D.h>
      
      //#define DisplaySerial Serial //ATMEGA328
      #define DisplaySerial Serial1 //SAMD21
      Goldelox_Serial_4DLib Display(&DisplaySerial);
      
      //#define led 5 //ATMEGA328 pro
      #define led 13 //SAMD21
      
      void setup() {
      pinMode(led,OUTPUT);
      //SerialUSB.begin(9600);
      DisplaySerial.begin(9600);
      
      }
      
      void loop() {
      //SerialUSB.println("Hello!");
      DisplaySerial.println("Hello!");
      digitalWrite(led, LOW);
      delay(500);
      digitalWrite(led, HIGH);
      delay(500);
      }

      This did work on the ATMEGA328 board:
      Code:
      #include <Goldelox_Const4D.h>
      #include <Goldelox_Const4DSerial.h>
      #include <Goldelox_Serial_4DLib.h>
      #include <Goldelox_Types4D.h>
      
      #define DisplaySerial Serial //ATMEGA328
      //#define DisplaySerial Serial1 //SAMD21
      Goldelox_Serial_4DLib Display(&DisplaySerial);
      
      #define led 5 //ATMEGA328 pro
      //#define led 13 //SAMD21
      
      void setup() {
      pinMode(led,OUTPUT);
      //SerialUSB.begin(9600);
      DisplaySerial.begin(9600);
      
      }
      
      void loop() {
      //SerialUSB.println("Hello!");
      DisplaySerial.println("Hello!");
      digitalWrite(led, LOW);
      delay(500);
      digitalWrite(led, HIGH);
      delay(500);
      }
      Also, not sure how that line of code could be the source of error, can you tell us why you think that may be the problem?
      - If I remove the that definition, it works fine. If I move this line into the Setup function, but call
      Code:
      DisplaySerial.begin(9600)
      first, it actually works fine. But this causes issues with 4D code later on.

      Thoughts?

      Comment


      • #4
        UPDATE: I switched the board type to Arduino Zero and flashed it with the Zero bootloader and it has the same result as above.

        Comment


        • #5
          Ok I figured it out.

          I was looking through the library and stumbled upon the lines:
          Code:
          #ifndef _SAM3XA_
          // Only done on non Arduino Due Boards
          _virtualPort->flush();
          #endif
          in the Goldelox_Serial_4DLib.cpp file and instantly had a flashback of having this issue before and having to comment out the line that flushes the virtual port. Once I did that, it worked perfectly.

          Seems like this needs to be updated to include SAMD-based boards.

          Comment


          • #6
            Hello again,

            I am glad you were able to solve your issue.

            If you would like, I would suggest that you report this on the Github repository, along with your solution.

            Thanks and let me know if you have any other queries,
            Adem

            Comment


            • #7
              Thanks. Submitted on Github here:

              https://github.com/4dsystems/Goldelo...brary/issues/7

              Comment

              Working...
              X