OLIMEXINO-328 with NHD-0216SZW-BY5-51481

Started by a_horst, April 05, 2018, 06:04:52 PM

Previous topic - Next topic

a_horst

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 connected directly via 22AWG jumper wires to an 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?

KeesZagers

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.

a_horst

#2
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?

LubOlimex

#3
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.
Technical support and documentation manager at Olimex

a_horst

I can't imagine as it is a standard library :/

JohnS

The LED must be a clue as to what is wrong.  Your wiring, perhaps.

What happens with the Arduino hello world LCD example?

John

a_horst

Quote from: JohnS on April 06, 2018, 01:52:52 PM
What happens with the Arduino hello world LCD example?
depends on

  • if I unplug it for a while and then it to the external usb power supply it prints perfectly hello world in the first line and the counter in the second
  • if I then press reset it starts scrambling things up and/or magic numbers are shown
  • same happens if I reprogram it

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?

LubOlimex

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
Technical support and documentation manager at Olimex

a_horst

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)