Nicla Vision's UART communication.

Hello,

I’m developing with Nicla Vision.
It’s working with the files created here, these are edge_impulse_firmware_arduino_nicla_vision.bin and
labels.txt, trained.tflite.

I’m trying to do serial communication, but it’s not working.
Using Nicla Vision’s UART_RX (PA_10, J2 pin 4) and UART_TX (PA_9, J2 pin 3).

If the firmware is v4.4.2 of OpenMV, serial communication was possible using Nicla Vision’s PB_9 (J2 pin 1) and PB_8 (J2 pin 2) with UART(4, 115200) setting.

If the firmware is edge_impulse_firmware_arduino_nicla_vision.bin,
What pin of Nicla Vision and number of UART() should be used for serial communication?

The version of edge_impulse_firmware_arduino_nicla_vision.bin is
MicroPython: c9e8710 OpenMV: v4.3.1-dirty HAL: v1.9.0 BOARD: NICLAV-STM32H747.

Thank you.

1 Like

Hi! Here is the exact commit we use for building OpenMV firmware

and you can find Nicla Vision related settings, including UART pins here

Let me know if it solved the issue.

3 Likes

Hi, I’m having trouble determining which pins are pin_C10 and pin_C11 on the board. Any clues?

Also, in order to use UART with a 3.3V device (like an esp32) It is necessary to use “enable3V3LDO()” first? (Based on this: Nicla Vision Pinout. I’ve already transmitted data using UART with the latest version of the firmware (using the rx/tx pins of the official documentation) following the information that I found here, without specifying anything, so I suppose that it is not needed, but asking just in case…

But now I need to send a result based on the inference of an Edge Impulse trained, and I’m stuck with this now…

Thanks!

I think it will be more useful to ask these questions on Arduino/OpenMV forums, since these are general Arduino questions and not exactly related to our platform.

1 Like

Yeah, you are correct, just wondering over here because it is still related to how to use serial communication with the Nicla Vision while running the Edge Impulse - Open MV firmware. But I will let you know if I have any updates.

Thanks =)

1 Like

Hello,

Thank you for your answer.
I have two questions.

  1. In Nicla Vision’s circuit diagram, PC10 (USART3_TX) and PC11 (USART3_RX) of SMT32H747AI are connected to the I2S signal terminal of LBEE5KL1DX-883 (WiFi), so I don’t think it can be used for UART communication?

  2. The EON Tuner function is very convenient and I use it.
    I am using the firmware selected here as is, but is it possible to enable UART communication for this firmware?
    For example, is it possible to create firmware with EDGE IMPULSE by changing the mpconfigboard.h file as follows?

// UART config
#define MICROPY_HW_UART4_TX (pin_B9)
#define MICROPY_HW_UART4_RX (pin_B8)

or,

// UART config
#define MICROPY_HW_UART1_TX (pin_A9)
#define MICROPY_HW_UART1_RX (pin_A10)

Thank you.

1 Like
  1. Sorry, the questions about OpenMV firmware should be addressed on their forum - we did not modify that value. Neither did we check if this is a correct value.
  2. So, it’s not really documented, but you can compile OpenMV the following way:
  • get the abovementioned commit of OpenMV
  • copy the .tflite model from your project (can be downloaded from the Dashboard) to openmv/src/lib/libtf/models/
  • create the labels file named trained.txt, put it in the same folder as the model. write names of classes there, separated by a newline. for object detection first class should be "background ".
  • compile the firmware for your board, following OpenMV documentation

This way you can have OpenMV firmware with Edge Impulse model and your desired changes.

3 Likes

Hello,

Thanks for the useful advice on how to build the firmware.
I will try.

Thank you.

Hi! I just achieved using UART + TinyML.
I had to fork the OpenMV and Micropython repo, and I used GitHub Actions to generate a custom firmware using my tflite model and the pin configuration that I needed.

For the UART configuration, I copied/pasted a part of the Nicla Vision’s configuration file of a more recent version of the micropython repository:

#define MICROPY_HW_UART4_TX         (pin_B9)
#define MICROPY_HW_UART4_RX         (pin_B8)
// LPUART1 config
#define MICROPY_HW_LPUART1_TX       (pin_A9)
#define MICROPY_HW_LPUART1_RX       (pin_A10)

After generating the custom firmware, I ran the Bootloader on OpenMV to load it and I set up the UART like this:

uart = UART(1, 9600)

I’m using pins PA_9 and PA_10 as the original pinout of the Arduino Nicla Vision shows:

I’m working on a detailed tutorial on how to do everything, I will try to link it here as soon as possible. But for now, I achieved taking a picture, inferring with my model and then sending both the picture and the result through UART to an ESP32.
This also solves for me another problem that I had with the Edge Impulse’s Python SDK not being able to deploy my custom models to OpenMV firmware for my Nicla Vision. Now I can just put the model that I need to test on the folder, push it to my fork of the repo and after some minutes download the build of the firmware. It’s not as straight forward as just running the deploy() command on the Python SDK, but for now I have a workaround it :love_you_gesture:t2:

EDIT: Here is the tutorial. If anyone finds something wrong, please let me know, hope it helps somebody!

2 Likes