0
\$\begingroup\$

I'm using ATMEGA328P implement on a miniPCB to control the Raspberry Pi Start and control LED Status. The code works fine when ATMEGA328P is plugged on Arduino UNO board, but on the PCB, on the first start, the LED has an strange behaviour, switching on the LED when the LED should be off.

If I connect the ATMEGA328P miniPCB RX/TX to Arduino board (connecting to GND too) the behaviour is perfect, but if I disconnect RX/TX lines from Arduino board, the LED does something strange the first time.

The ATMEGA is flashed with Arduino UNO code, I have deleted Serial.begin and all serial commands, but if ATMEGA328P is not connected to RX/TX board pins, the led does strange things the first time. What could be the problem?

Diagram block added. ATMEGA328P board is supplied by 5V and GND Raspberry pins. When I connect RX line with ARDUINO board (without ATMEGA328P chip) I connect all the GNDs between them.

enter image description here

Between Raspberry and Arduino there is not communication, only GPIOs and write and read HIGH or LOW.

Thank you so much.

\$\endgroup\$
7
  • \$\begingroup\$ Why do you disconnect the GND between devices? Or rather, why do you think it will work without it, because it won't? \$\endgroup\$
    – Justme
    Oct 13, 2021 at 7:42
  • \$\begingroup\$ @Justme sorry, my mistake. I realize that GND is not the problem. The RX/TX lines have to be connected. If they are not connected there is a strange behaviour. \$\endgroup\$
    – Juanma
    Oct 13, 2021 at 7:49
  • \$\begingroup\$ Yes, RX line being unconnected means nothing is driving it and it receives random noise which your code does not expect and it interprets as LED command bytes? Makes perfect sense. What kind of protocol you are using? \$\endgroup\$
    – Justme
    Oct 13, 2021 at 7:57
  • \$\begingroup\$ RX/TX are not used for nothing, I mean, Raspberry and ATMEGA328P "communicate" between them by GPIOs, reading states on these pins. RX/TX lines are used to communicate with Serial Monitor on Arduino IDE. \$\endgroup\$
    – Juanma
    Oct 13, 2021 at 8:14
  • \$\begingroup\$ I am confused what exactly is connected and how and which cases are problematic. So now there is also GPIO communication? Can you please make the question more clear with all the details that should be in the question? Please add diagrams which include ground and power supply wiring. \$\endgroup\$
    – Justme
    Oct 13, 2021 at 8:53

1 Answer 1

0
\$\begingroup\$

Adding a 100 miliseconds delay on setup part the problem is solved. The undesirable behaviour has disappeared.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.