No announcement yet.

Changing baud rate using an ATMega 328 connected to a 128-G2 with Arduino platform

  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing baud rate using an ATMega 328 connected to a 128-G2 with Arduino platform

    I am trying to change the comms speed between the micro and the display, but every variation on the syntax just produces a blank display when the code is run.

    I can't use the Workshop facility because the display is now fixed into the device for which it was intended so I can only access the graphics processor using serial commands through the ATMega 328.

    The "setbaudWait" command is the problem area (i think)..

    The code I am trying to get working is as below, and is part of the void setup functions. The default 9600 baud is working fine but the added lines to change the baud rate just don't work. Any help greatly appreciated.

    // Set the data rate to the OLED and initialise

  • #2
    Hi MartyBoy,

    This forum post might help:

    How to change Baudrate in Serial mode

    You could try the GoldeloxBigDemo Arduino example. It also illustrated the Display.setbaudWait() command.

    Under 'File' - 'Samples' - 'Goldelox Serial'. Then in the Arduino Example folder, you could find the GoldeloxBigDemo.ino File.

    Best Regards,


    • #3
      Hi Joseph

      Thanks for the reply.

      I have read and are familiar with the subject matter covered in your two suggestions, the app notes and the BigDemo example.

      As stated in my initial post I can't change the baud rate using the Workshop 4 utility, as the display is mounted in a device giving me the only connection through an ATMega 328 micro. I can no longer attach a USB cable and 4D Systems adapter to the display. The app notes don't cover this situation.

      The demo program will runs on the same device if the pins for SoftwareSerial are reassigned from the defaults. However, the part of the demo program that is supposed to demonstrate the baud rate changes does not work and the display is blank for that part of the demonstration. It then loops back to the rest of the demonstration showing graphics objects and text

      Any light you can shine on this appreciated. .


      • #4
        Hi MartyBoy,

        Have you tried this part in the BigDemo? With 19200 baud Rate?
          Display.gfx_Cls() ;
          setbaudWait(BAUD_19200) ;
          Display.putstr("Hi at 19200\n") ;
          setbaudWait(BAUD_9600) ;
          Display.putstr("Back to 9600\n") ;
        Did the display successfully printed something? you might want to delete some functions and testing in the BigDemo to thoroughly see just what you want. setbaudWait() should already be changing both the display and the Arduino in the correct order.

        Can you try adjusting your Microcontroller's Baud Rate to match the working Baud Rate? 9600 first then increase it a little it too see what is compatible. Setting it up on a very high baud rate all of the sudden may have problems such as buffers, line connection, etc..

        Best Regards,
        Last edited by Joseph Herrera; 28th December 2016, 03:28 PM. Reason: additional info


        • #5
          Hi Joseph

          Yes I have the code as above working in conjunction with the two void statements that set the display and ATMega 328 comms speeds. However the change only works at either 8600 or 19200. I can't get the display to operate on any other speeds higher than 19200.

          Can you advise me on this please.

          Also is there a user or command reference manual for the SoftwareSerial library please?



          • #6

            Here is the GOLDELOX Serial Command Set Reference Manual:


            Can you give us the reasons for the higher baud rate?
            As of the moment, higher baud rates such as 200,000 has not yet been added to the libraries of the displays such as 128-G2.