Announcement

Collapse
No announcement yet.

avenue33's Serial_LCD library: OLED display, Arduino & uSD

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

  • avenue33's Serial_LCD library: OLED display, Arduino & uSD

    Hi,
    I'm using 4d systems' µOLED-128-G1 (SGC) display with avenue33's Serial_LCD library and uSD: http://embeddedcomputing.weebly.com/serial-lcd.html.

    I have stumbled upon a problem with the uSD card. The size of the uSD card I am using is of 2 GB and I have partitioned it 50/50 into FAT and RAW components using 4d systems' RMPET Software Tool.

    One of the attachments show what i get when verifying with the serial monitor. It detects the uSD card, however it does not detect the RAW components of the uSD card. I am aware that Goldelox-based screens only read/write RAW partition.


    The following is the code that I have used:
    Code:
    ///
    /// @file  colour_main.pde
    /// @brief Example
    /// @details  
    /// @n @a  Example for Serial_LCD Library Suite
    /// @n @a for 4D Systems uLCD-uLED-uVGA Serial_LCD Library Suite
    /// @n  on Arduino 0023 and 1.0, chipKIT MPIDE 0023, Wiring 1.0
    ///
    /// @a  Developed with [embedXcode](http://embedXcode.weebly.com)
    /// 
    /// @author  Rei VILO
    /// @author  http://embeddedcomputing.weebly.com
    /// @date Jul 12, 2012
    /// @version release 132
    /// @n
    /// @copyright  © Rei VILO, 2010-2012
    /// @copyright  CC = BY NC SA
    /// @n http://embeddedcomputing.weebly.com/serial-lcd.html
    /// @n http://github.com/rei-vilo/Serial_LCD
    ///
    /// @see  4D Systems Goldelox and Picaso SGC Command Set
    /// @n http://www.4dsystems.com.au/
    ///
    
    // Core library - MCU-based
    #if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) // Arduino specific
      #if defined(ARDUINO) && (ARDUINO >= 100)
      #include "Arduino.h" // for Arduino 1.0
      #else
      #include "WProgram.h" // for Arduino 23
      #endif
    #elif defined(__32MX320F128H__) || defined(__32MX795F512L__) // chipKIT specific 
    #include "WProgram.h"
    #elif defined(__AVR_ATmega644P__) // Wiring specific
    #include "Wiring.h"
    #else // error
    #error Platform not supported
    #endif
    
    #include "Serial_LCD.h"
    #include "proxySerial.h"
    
    // test release
    #if SERIAL_LCD_RELEASE < 333
    #error required SERIAL_LCD_RELEASE 333
    #endif
    
    // uncomment for I2C serial interface
    //#define __I2C_Serial__
    
    // === Serial port choice ===
    #if defined(__I2C_Serial__) // I2C serial
      #include "Wire.h"
      #include "I2C_Serial.h"
      I2C_Serial mySerial(0);
    
    #elif defined(__AVR_ATmega328P__) // software serial
      #if defined(ARDUINO) &amp;&amp; (ARDUINO>=100) // for Arduino 1.0
        #include "SoftwareSerial.h"
        SoftwareSerial mySerial(10, 9);
      #else
        #include "NewSoftSerial.h" // for Arduino 23
        NewSoftSerial mySerial(10, 9);
      #endif
    
    #elif defined(__32MX320F128H__) || defined(__32MX795F512L__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega644P__) // hardware serial Serial1
      #define mySerial Serial1
    
    #else // error
      #error Platform not defined
    #endif
    // === End of Serial port choice ===
    
    ProxySerial myPort(&amp;mySerial); // hardware abstraction layer
    Serial_LCD myOLED(&amp;myPort); // LCD
    
    
    void setup() {
      Serial.begin(19200);
      Serial.print("\n\n\n***\n");
    
      // === Serial port initialisation ===
    #if defined(__I2C_Serial__)
      Serial.print("i2c\n");
      Wire.begin();
      mySerial.begin(9600);
    
    #elif defined(__AVR__)  || defined(__AVR_ATmega328P__) | defined(__AVR_ATmega328P__)
      Serial.print("avr\n");
      mySerial.begin(9600);
    
    #elif defined(__PIC32MX__) 
      Serial.print("chipKIT\n");
      Serial1.begin(9600);
    
    #endif 
      // === End of Serial port initialisation ===
     
      myOLED.begin(8);
      /*
        // === Serial port speed change ===
        myOLED.setSpeed(38400);
      #if defined(__I2C_Serial__)
        mySerial.begin(38400);
      
      #elif defined(__AVR__)  || defined(__AVR_ATmega328P__) | defined(__AVR_ATmega328P__)
        mySerial.begin(38400);
      
      #elif defined(__PIC32MX__) 
        Serial1.begin(38400);
      
      #endif 
      // === End of Serial port speed change ===
      */
    
    
    
      delay(500);
      myOLED.initSD();
      
      delay(100); 
      myOLED.gText(0, 50, "Checking the uSD");
      
      delay(1000);
      Serial.print("Check SD: ");
      Serial.println(myOLED.checkSD());
      
      delay(1000);
      Serial.print("Check FAT: ");
      Serial.println(myOLED.checkFAT());
      
      delay(1000);
      Serial.print("Check RAW: ");
      Serial.println(myOLED.checkRAW());
     
    }
    
    
    void loop() {
      
    }
    The rest of the attachments show the setup. I have connected the:
    • Screen +5V to Arduino +5V
    • Screen Ground to Arduino Ground
    • Screen TX to Arduino SoftwareSerial RX = pin 10Screen RX to Arduino SoftwareSerial TX = pin 9Screen RESET to Arduino pin 8

    Any help is much appreciated, thank you!

  • #2


    To Goldelox everything is RAW, there is no ability to 'detect' FAT (unless you write it yourself).
    Mark

    Comment


    • #3


      Ok, thank you for the quick response. But it doesn't detect the RAW partition.

      Comment


      • #4


        More clearly, everything is RAW, it can't even 'detect' a partition table
        Mark

        Comment


        • #5


          Oh i get it now! So how do I completely format the uSD into RAW? Bcos I couldn't do that with the RMPET tool.

          Comment


          • #6


            Don't need to do anything, just read/write wherever you want to
            Mark

            Comment


            • #7


              Thank you, it works now! But how do I view the files that are saved? For example, if I saved the OLED screen into the RAW partion, how do I view the image?

              Comment


              • #8


                You should be able to find that out from the Avenue33's documentation, I'd hope, although I'm not that familiar with it.

                Why don't you use SPE and the Arduino library for it? That way you could work your way thought the bigdemo and we might be able to help you better
                Mark

                Comment


                • #9


                  Is it using the 4D Workshop 4 IDE (http://www.4dsystems.com.au/downloads/Application-Notes/4D-AN-M5002-Serial-Running-BigDemo-Arduino-REV1.pdf)?

                  If so, do I need the following?
                  • 4D Arduino Adapter Shield and 5 wire F-F Cable. Instead of this, can I directly connect the display to the Arduino Uno? Like the following (according to the helloworld example):
                    • Screen +5V to Arduino +5V
                    • Screen Ground to Arduino Ground
                    • Screen TX to Arduino SoftwareSerial RX = pin 0Screen RX to Arduino SoftwareSerial TX = pin 1Screen RESET to Arduino pin 2
                    4D Programming CableUSB cable for Arduino

                  Also, according to http://www.4dsystems.com.au/downloads/Software/4D-Workshop4-IDE/Docs/Serial/GOLDELOX-SPE-COMMAND-SET-REV1.1.pdf, there is no save screen command. Is that right?

                  Thank you!

                  Comment


                  • #10


                    Yes it is using the 4D workshop 4 IDE.

                    You can dispense with the Adapter Shield if you want to hardwire it , you will need the other bits.

                    Sorry, the only way to save the screen at the moment is to read it pixel by pixel adn write it to uSD, this will be quite slow.

                    Is there a particular reason you need to do this?
                    Mark

                    Comment


                    • #11


                      Oh sorry, I didn't mean to include "USB cable for Arduino" in the list. I obviously need that. -_-

                      I need the save screen command for this project that I am doing. I am suppose to save an image of the waveform being displayed (plotted) on the OLED display.

                      Comment

                      Working...
                      X