Need help with serial/bootloader on AtMega4808

I made my own (first) PCB with AtMega4808 (32pin).
I can send programs to it using the JTAG2UPDI. And it runs an OLD correctly.
I’m having problems with the serial bus. Both for Serial.print output and updating new code.

I’ve loaded the MegaCoreX -> Optboot (UART0 default pins) bootloader. Then connected my usb2serial converter (WAVGAT FT232RL https://www.aliexpress.com/item/32519490747.html - color=red) which I also use to program a Pro Min. I switch the port to the FT232 port and click upload.
I constantly get the error:
avrdude error: programmer is not responding
avrdude warning: attempt 1 of 10: not in sync: resp=0x00

My PCB have the connector to the FT232:
image

image

RST -> pin 26 = PF6
RXI -> pin 30 = PA0
TXO -> pin 31 = PA1

In the serial monitor I get a single rectangle character for each time I power the PCB up.
The code is:

void setup() {
  Serial.begin(9600);
  Serial.println(F("Hi"));
}

void loop() {
    Serial.println("in");
    delay (1000);
}

I can live with updating code using the JTAG2UPDI, but cannot debug my code without the serial monitor.

a) Which hardware pins does Optboot use for the serial in each of its versions?
b) What I’m doing wrong?

I think you may have RX and TX swapped over. The 4808/4809 datasheet says that for the 32-pin device, TX0 is pin 30 and RX0 is pin 31.

Have a look at the MegaCoreX 32-pin minimal setup. It uses UART2, but you can see where RX & TX are wired on the 6-pin FTDI connector.

1 Like

THANKS!!
I used wires from the FT232 to my PCB and swapped the two lines and now I can read the serail and update the code!

I saw that page yestorday.
I will try to understand how I swapped these two lines.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.