UART help on Nicla board

What are the settings needed to get Nicla to communicate over UART?

I am having one hell of a time trying to figure this out. I can get it to work with the H7 board using the example with zero problems, but with the same script using the Nicla (and changing the bus) I can’t get anything out. I’m really really regretting buying Nicla’s lately. There seems to be zero legit support for them.

edit: assume all whitespacing is correct.

OpenMV Code:

import time
from pyb import UART

uart = UART(4, 19200)

while(True):
uart.write(“Hello World!\n”)
if (uart.any()):
print(uart.read())
time.sleep_ms(1000)

Controllino (Arduino Mega) Code:

#include “Controllino.h”

void setup() {
// put your setup code here, to run once:
Serial.begin(19200);
Serial2.begin(19200);
}

void loop() {
// put your main code here, to run repeatedly:
if (Serial2.available()) {
// Read the most recent byte
byte byteRead = Serial2.read();
// ECHO the value that was read
Serial.write(byteRead);
}
}

You need to set the timeout char if you are running at a low baud rate:

https://docs.openmv.io/library/pyb.UART.html#pyb.UART.init

uart = UART(4, 19200, timeout_char=1000)

I will give that a shot tomorrow when I get back to that setup

Any reason you can think of why the H7 doesn’t need that timeout called, but the Nicla does?

No, it would be the same.

Mmm, it might be that UART4 doesn’t work in MicroPython. It should be operational however.

Let me test this.

Update:

Tried the timeout and I’m still not getting anything from the Nicla.

Edit: Update, in fact, the H7 WON’T work with that timeout in there.

Testing this now.

All good. Just wanted to keep you updated on what I was seeing.

This works no problem?

import time
from pyb import UART

uart = UART(4, 19200)

while(True):
    uart.write("Hello World!\n")

Not sure what’s wrong…

This too:

import time
from pyb import UART

uart = UART(4, 19200)

while(True):
    uart.write("Hello World!\n")
    if (uart.any()):
        print(uart.read())

I’m really really regretting buying Nicla’s lately. There seems to be zero legit support for them.

… Not sure how to answer that given I just took your code and tried it out and it worked…

Note, UART 4 is the two bottom pins on the side connector.

1 Like

Now that I have moved to those pins it does in fact work. But what I mean by zero legit support is that those pins are identified as the I2C bus pins on their pinout, and the two pins above that are the UART pins. There as nothing I could find in any documentation that would lead me to believe the I2C pins are also UART pins.

I dunno. It’s a bad combination I guess of minimal documentation, and I guess me not being extremely versed in this. Not exactly low barrier for entry to use the Nicla.

They just feel like an afterthought as compared to the OpenMV boards.

image

Yeah, that’s bad documentation.

I was able to find the answer via looking at their schematics.

Later on we will be rolling out better documentation support for the Arduino Portenta and Arduino Nicla.

A lot of folks are using the Nicla so I think it makes sense to put a lot more support behind it. Arduino hasn’t specifically asked us to add it to our documentation but when I get some time I will and do all the same type of page updates we have in our documentation like for the OpenMV Cams.

If the documentation and support for the Nicla match what you’ve done for your own cams, that would be incredible. The work you’ve done on OpenMV and your own hardware is excellent.

Thank you for your help on this.