Thanks, that's where I took the information, BUT what's not clear is : does it change the pin for Serial1, meaning by creating mySerial with the previous command, does it change the Serial1 pin or those it create a new third serial (so can I have Serial, Serial1 and mySerial all 3 at once)?
(but I will try it and post my result here)
Thanks a lot, Cattledog, now my board seems read something.
Before I followed this example:
that defines RX/TX inverted in comparison your suggestion:
UART mySerial(digitalPinToPinName(4), digitalPinToPinName(3), NC, NC); //4 is tx, 3 is rx that runs fine.
I still have some issue in my code, but I'll update the result
I noted that with UART mySerial is not possible to set the baudrate at 10400. The Nano 33 sends to the closest 9600 speed. Do you have a software serial to suggest to use as third Uart able to work at 10400 Baud?
Thanks again cattledog. I modified the prescaler register as in your suggested tread:
so now I have three serial communication lines in Nano 33 BLE with one with no standard baud too.
// PINS FOR Nextion display comm
const unsigned int NEXTIONRX_PIN = D3; // connect to NEXTION RX
const unsigned int NEXTIONTX_PIN = D4; // connect to NEXTION TX
// PINS FOR A SECOND COMM LINE, E.G. OBD ISO9141 LINE
const unsigned int RX_PIN = D1; // connect to ISO9141 OBD transceiver Rx
const unsigned int TX_PIN = D0; // connect to ISO9141 OBD transceiver Tx
// Definitions for a no standard baudrate at 10400
#define UARTE0_BASE_ADDR 0x40002000 // As per nRF52840 Product spec - UARTE
#define UART_BAUDRATE_REG_OFFSET 0x524 // As per nRF52840 Product spec - UARTE
#define UART0_BAUDRATE_REGISTER (*(( unsigned int *)(UARTE0_BASE_ADDR + UART_BAUDRATE_REG_OFFSET)))
#define BAUD10400 0x2A9930 // Value theoretical but trimmed at 0x2A1E00 for my specific HW
UART Serial2(NEXTIONTX_PIN, NEXTIONRX_PIN); // TX, RX set the second UART pins
Serial.begin(115200,SERIAL_8N1); // Start serial comm at baud=115200 to USB Serial Monitor
Serial1.begin(10400,SERIAL_8N1); // Start serial comm at no std baud=10400 to OBD interface for example
Serial2.begin(115200,SERIAL_8N1); // Start serial comm at baud=115200 for display Nextion, remember to modify the Nexconfig.h in Nextion library setting "Serial2"
UART0_BAUDRATE_REGISTER = BAUD10400; // set the baudrate register of micro to have 10400 baud accurate in Serial 1
Serial.print(" This is the USB monitor: "); // Text on IDE monitor
Serial1.write( 0x55); //data sent at 10400 precise baud
Serial2.print("message.txt=\""); // a message to display Nextion