I'm try to use the Nano 33 BLE to read a vehicle datalink which is a standard serial 8N1 port running at 7812 baud. I'm running the same code between this board and another board, but the other board is getting good data. This one isn't. I suspect that Arduino is NOT using the non-standard baud rate, but rounding to the closest standard rate.
Does arduino's Nano 33 library support Non-standard baud rates?
If not, is there some way I can correct this? Which file would I need to modify to convert from baudrate to the correct register value.
Can I use arduino to read and write nRF registers directly?
Here is the actual fix for this which allows non-standard baud rates with this hardware. I did several google searches, but (somehow) missed this one. It worked perfectly!!
#define UARTE0_BASE_ADDR 0x40002000 // As per nRF52840 Product spec - UARTE #define UARTE1_BASE_ADDR 0x40028000 // 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 UART1_BAUDRATE_REGISTER ((( unsigned int *)(UARTE1_BASE_ADDR + UART_BAUDRATE_REG_OFFSET)))
#define BAUD7812 0x001FFF7A
UART0_BAUDRATE_REGISTER = BAUD7812; //place this in Setup()
Here is a link to the post that helped me.
I was going to modify nrf52840_bitfields to add my baudrate to the baudrate enumeration (then NRF_UART to use it somehow), but this worked better.
Thanks ballscrewbob for providing a response. Hopefully, this helps someone else or Arduino can make there code more dynamic.