MCUdude / MegaCoreX

An Arduino hardware package for ATmega4809, ATmega4808, ATmega3209, ATmega3208, ATmega1609, ATmega1608, ATmega809 and ATmega808
GNU Lesser General Public License v2.1
247 stars 52 forks source link

I cannot program a sketch after programming a sketch which uses Serial2. #87

Closed nekosan0 closed 4 years ago

nekosan0 commented 4 years ago

I bought a Arduino Nano Every compatible board with Mega4808 at Aliex.

https://ja.aliexpress.com/item/4000933835185.html

First, I tried to program a example "blink" sketch with options below.

It works fine with the MegaCoreX.

Next, I tried to program a sketch which uses serial monitor. It is from example "ASCIITable". (I modified only "Serial" to "Serial2") BTW, on this board, the serial port is connected to the PC via Serial2.

The sketch runs normally and output a ASCII table on serial monitor. But after that, I cannot program any sketches on the board, and the on-board red LED(tx) is blinking for a while. It seems conflicting "Serial2 output" and "programming sketches via JTAG2UPDI". The IDE don't start uploading the sketch.

Now, I cannot upload any sketches at all.

I guess that ... 1: The ASCIITable sketch starts output some data on Serial2 immediately on cpu reset. 2: Next, the IDE starts uploading a sketch. But the ASCII table data disturbs updating the sketch. Thus the IDE cannot connect with mega4808 board via JTAG2UPDI and UART2.

I want to know how to avoid "the jamming" and how to program a sketch on my Mega4808 board.

And I wonder whether genuine Arduino Nano Every can work after writing a sketch which uses serial monitor. Does anyone have tried programming such a sketch on Mega4809 Nano Every? If it would work fine with Mega4809, I wonder what is the difference?

MCUdude commented 4 years ago

I have seen that board at Aliexpress before, and I was about to buy it before I read over at the Avrfreaks forum that the Jtag2updi + serial adapter were total rubbish. I'm sure you can read more about this board and its issues there.

You can probably wire up your own jtag2updi programmer and connect to the UPDI line directly.

The official Nano Every is different in this respective, and it handles "jamming" just fine.

nekosan0 commented 4 years ago

Thank you for your information. I think you mean this site.

https://www.avrfreaks.net/forum/nano-every-use-atmega4808?page=all

I this page, someone says that ...

I can't avoid this situation with the present "compatible board" circuit. I may need another UPDI programming circuit to re-program the mega4808 board to avoid the reset signal jamming to UPDI interface IC.

I will try to flash the mega4808 chip via UPDI while referencing these sites.

https://freesoft.dev/program/121697458 http://ghz2000.com/wordpress/?p=1387

MCUdude commented 4 years ago

I think you mean this site. https://www.avrfreaks.net/forum/nano-every-use-atmega4808?page=all

Yes, there is the thread!

As you might already have understood, the Chinese Nano Every "clone" isn't a very clever design, since it's very easy to "lock yourself out".

I'm closing this issue because this is more of a hardware related issue that really isn't MegaCoreX's fault. If you need assistance for the UPDI programming part, or your "4808 Nano Every", you can ask over at the Avrfreaks or Arduino forum 🙂