Olimex Support Forum

DUINO => ARDUINO => Topic started by: a_horst on April 05, 2018, 06:04:52 PM

Title: OLIMEXINO-328 with NHD-0216SZW-BY5-51481
Post by: a_horst on April 05, 2018, 06:04:52 PM
Hi guys I am quite new to arduino in general, so please excuse if i ask something trivial but searching the web didn't lead to success.   :-\

I am using a Newhaven Display NHD-0216SZW-BY5-51481 (https://mouser.com/datasheet/2/291/NHD-0216SZW-BY5-51481.pdf) connected directly via 22AWG jumper wires to an OLIMEXINO-328 (https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-328/) which gets powered via the USB-port of my notebook.

this i my source code:

#include <LiquidCrystal.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal disp(rs, en, d4, d5, d6, d7);


void setup() {
  delay(1000);
  disp.begin(16, 2);
  delay(1000);
  disp.setCursor(0, 1);
  delay(1000);
  disp.clear();
  delay(1000);
  disp.write("Test");
}

void loop() {}

"Test" gets written to the display but then the led 13 blinks 7 times and the board seems to reset.
After this not intended "reset" the screen often shows a bunch of random/magic values (always the same actually).

Has anybody an idea what might cause this?
Thanks already in advance for every helpful though/answer.  :)

EDIT: When I plug it into a usb powersuppy the described doesn't happen.
By pressing the reset button several times i can reproduce it (with each press the LED blinks once).
So my question is now how does it come that after some seconds (~5) I get from the usb port of my laptop some signals which cause the OLIMEXINO to to reset 7 times?
Title: Re: OLIMEXINO-328 with NHD-0216SZW-BY5-51481
Post by: KeesZagers on April 05, 2018, 06:55:05 PM
In my opinion your problem will be solved by changing: void loop(){ delay(1000); }
In the Arduino IDE the SETUP will be executed and after that the LOOP continuously. If there is nothing to do, I guess the CPU gets crazy. Next step ofcourse is placing the display routine within the loop in stead of the setup.
Title: Re: OLIMEXINO-328 with NHD-0216SZW-BY5-51481
Post by: a_horst on April 06, 2018, 09:11:59 AM
Both unfortunately also leads to the same

Could it be that it gets to less current via the usb port?

EDIT: When I plug it into a usb powersuppy the described doesn't happen.
By pressing the reset button several times i can reproduce it (with each press the LED blinks once).
So my question is now how does it come that after some seconds (~5) I get from the usb port of my laptop some signals which cause the OLIMEXINO to to reset 7 times?
Title: Re: OLIMEXINO-328 with NHD-0216SZW-BY5-51481
Post by: LubOlimex on April 06, 2018, 10:28:43 AM
The big question here is why the LED is on at all! Your code doesn't seem to initialize any of the two pins with LEDs. One LED is pin D13 (as you noticed), the other LED is pin D9. Maybe your library is at fault?

Disregard this. It is because of the bootloader that makes the green LED blink 7 times after power up before executing the user program. It makes the green LED blink just once after resetting the board.
Title: Re: OLIMEXINO-328 with NHD-0216SZW-BY5-51481
Post by: a_horst on April 06, 2018, 01:18:15 PM
I can't imagine as it is a standard library :/
Title: Re: OLIMEXINO-328 with NHD-0216SZW-BY5-51481
Post by: JohnS on April 06, 2018, 01:52:52 PM
The LED must be a clue as to what is wrong.  Your wiring, perhaps.

What happens with the Arduino hello world LCD example?

John
Title: Re: OLIMEXINO-328 with NHD-0216SZW-BY5-51481
Post by: a_horst on April 06, 2018, 02:14:15 PM
Quote from: JohnS on April 06, 2018, 01:52:52 PM
What happens with the Arduino hello world LCD example?
depends on

Quote from: JohnS on April 06, 2018, 01:52:52 PM
The LED must be a clue as to what is wrong.  Your wiring, perhaps.
What could be wrong if I sometimes get it right?
Title: Re: OLIMEXINO-328 with NHD-0216SZW-BY5-51481
Post by: LubOlimex on April 06, 2018, 03:43:43 PM
Disregard what I said, the green LED blinks 7 times always after power up, even if you don't set it in the code since the board is in bootloader mode initially. The bootloader causes the board to blink few times then the board exists bootloader mode and executes the user code.

If you use the reset button instead of removing the power supply; the blink would be just one, then the board would execute the user code.

Did you do something to D0 and D1 - these are the two signals used for the USB connection?

Probably your hardware connections and software initialization are wrong. Did you set the SPI properly? Do you have ISP programmer attached to the setup (or something extra attached to the UEXT connector)?

Show us pictures of your hardware setup so we can inspect all the hardware connections between the board and the display. You can't upload pictures in the forum, so host them else and give us links.

Best regards,
Lub/OLIMEX
Title: Re: OLIMEXINO-328 with NHD-0216SZW-BY5-51481
Post by: a_horst on April 12, 2018, 10:39:02 AM
sry seems like I back then messed up posting

anyway I found out it was caused by the controller from the OLED module, as it required additional commands to clear the RAMs (as they might not always loose their stored data fast enough)