Second Serial on A-Star 328PB not working

Hi,

I’ve been trying to use the second Serial port of the A-Star 328PB (8MHz/3V3).

The first Serial port is connected to the PC (Arduino IDE) via USB to program and to use the console to send/receive comands (for testing).

The second Serial port (Serial1) is connected to a Wi-Fi module (SainSmart Neu ESP8266 Esp-05).

When I try to send a Sketch to the board, I need to disconnect the power cable of the Wi-Fi module otherwise it will fail.
When I program the board (without the Wi-Fi Module) it works but I can’t send or receive nothing.

I’ve readed that in the case of the A-Star version 8MHz/3V3 the baud rate must be 57600 instead of the 115200. This is for the Serial1 too? The ESP8266 is 115200 and I don’t know if I can change it to 57600.

I’ve been searching the net and can’t find none about the use of the two Serial ports in this board.

Best regards

AF

Hello, AF.

Can you post close-up pictures showing how you are connecting the computer and Wi-Fi module to the A-Star 328PB board?

The maximum standard baud rate that works on an ATmega328PB running at 8 MHz is 57600 baud, and this limitation applies to both UARTs. (You can use lower baud rates.) There should be an AT command to change the ESP8266’s baud rate setting so that you can match the baud rate of your A-Star. I suggest doing an Internet search for “how to set the baud rate” for your ESP8266 version.

- Amanda

Hello Amanda,

I bought another board, A-Star 328PB 12MHz 3v3 because of the 57600 baud rate limitation of the other.

Now I´m just trying two serial ports and the A-Star just bridging between both.
They are configured to 115200.
I´m just using two putty connected to COM11 and COM12 (the two USB to TTL cables).

The code that I´m using is this:

  Serial.begin(115200);   // USB serial port (PROGRAMMING)
  Serial1.begin(115200);  // Serial Port 1 of Due (UART 1)
}

char rx_byte = 0;

void loop() {
  // send terminal byte
  if (Serial.available() > 0) {
    rx_byte = Serial.read();
    Serial1.print(rx_byte);
  }
  // send byte to terminal
  if (Serial1.available() > 0) {
    rx_byte = Serial1.read();
    Serial.print(rx_byte);
  }
}

Both connections are 3v TTL serial. The first is connected with an FTDI board and USB cable. It´s what I use to program and debug.
The other is connected to Pin 11(TXD1), Pin 12(RXD1) and GND.

Behaviour:
When I restart board, I can send bytes from the FTDI port to the Serial1. If I try to send from Serial1 nothing appens and I´t stop working, even from the FTDI one. I need to restart board to be able to send from FTDI to Serial1 again.

Best regards

Andre Fonseca

Can you please post pictures showing how you have everything connected in your current setup? Also, can you describe step-by-step how you are sending data from Serial1 to Serial from your Arduino Due? Can you post the complete code that you are running on the Arduino Due? I might be able to provide a better solution once I have more information about your current setup.

- Amanda

Hello Amanda,

I can’t send you pictures right now bacause I not have it here. But the connectiosn are very simple.

I’m not using an Arduino DUE.

First connection Serial is from the FTDI cable connected to my computer and I’m using the Arduino Serial Monitor to send and recieve (and program) on Serial port 11.
imagem

Second connection is with an USB TTL cable connected in Serial1 to my computer and I’m using putty to open the serial port 12 to send and recieve.
imagem

Right now what I’m trying to do is send some text from one Serial to the other Serial. So from Arduino Serial Monitor to Putty and back. Just that, so the code is exactly what I sent in the previous post.

Best regards

I assumed you were using an Arduino Due from this comment in your code Serial1.begin(115200); // Serial Port 1 of Due (UART 1). Thank you for clarifying.

I tested your code here using a similar setup and was able to reproduce the behavior you are seeing. The problem seems to be due to our add-on for the ATmega328PB in the Arduino IDE. (You can find more details about the add-on in the “ATmega328PB support in the Arduino IDE” section of the A-Star 328PB User’s Guide.) We are looking into the problem. For now, can you call pinMode with any pin and mode in your setup() (e.g. pinMode(13, OUTPUT)) and let us know if that fixes the issue?

- Amanda

Hello,

I’m sorry about that comment line. I Copy/Paste the code from an example with an Due.

I can only try that later but I will let you know the result.

Best regards

Hello, Andre.

We published a new version of the software add-on for the Arduino IDE for our A-Star boards. The new version (4.0.1) fixes the problem of not being able to use USART1 properly on the A-Star 328PB board. Please update your add-on version using the Boards Manager in your Arduino IDE and your program should work without the workaround described in my last post.

- Amanda

Thank you Amanda.

Enviado de meu ASUS

-------- Mensagem original --------