Skip to main content
NBlan.1
Associate II
June 23, 2022
Solved

Is it possible to send a matrix (my dataset) manually on my stm32F4 via RX port and tabby terminal ?

  • June 23, 2022
  • 4 replies
  • 3357 views

The "validate on target" option doesn't work and I was wondering if it was possible to work around the problem by sending some data manually. I thanks you in advance.

This topic has been closed for replies.
Best answer by jean-michel.d

Hi,

What is the issue with the "validation on target"?

Have you try to generate the built-in validation project for your STM32 IDE?

If tabby terminal is equivalent to TeraTerm application, yes UART RX port other STLink VCP for example can be used, but you need to write your own protocol/application.

Else if the built-in validation project is OK, in the X-CUBE-AI pack, you have a simple Python module "ai_runner" allowing to communicate with the board. It allows to inject the data and to retreive the results through a simple interface (see "How to run locally a c-model" article in the embedded documentation).

from stm_ai_runner import AiRunner
 
runner = AiRunner()
runner.connect('serial')
runner.summary() # display the network/run-time information
# fill input tensor according the requsted shape/data type
inputs = FILL(runner.get_input_infos())
...
outputs, _ = runner.invoke(inputs) # invoke the model

Best regards,

Jean-Michel

4 replies

Andrew Neil
Super User
June 23, 2022

As far as sending & receiving is concerned, it's all just data - and, clearly, data can certainly be sent & received...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
NBlan.1
NBlan.1Author
Associate II
June 23, 2022

Thanks you for your time, I'm going to try it today.

jean-michel.dBest answer
ST Employee
June 23, 2022

Hi,

What is the issue with the "validation on target"?

Have you try to generate the built-in validation project for your STM32 IDE?

If tabby terminal is equivalent to TeraTerm application, yes UART RX port other STLink VCP for example can be used, but you need to write your own protocol/application.

Else if the built-in validation project is OK, in the X-CUBE-AI pack, you have a simple Python module "ai_runner" allowing to communicate with the board. It allows to inject the data and to retreive the results through a simple interface (see "How to run locally a c-model" article in the embedded documentation).

from stm_ai_runner import AiRunner
 
runner = AiRunner()
runner.connect('serial')
runner.summary() # display the network/run-time information
# fill input tensor according the requsted shape/data type
inputs = FILL(runner.get_input_infos())
...
outputs, _ = runner.invoke(inputs) # invoke the model

Best regards,

Jean-Michel

NBlan.1
NBlan.1Author
Associate II
June 23, 2022

Hello Jean-Michel,

Thank you for your attention. At first I used "validation on target" with my STm32H747-DISCO with the example FP-AI-VISION1_V3.1.0 (because with that I can determine that the problem isn't from the code) and after that I wanted to do it with a F429I-DISCO and a code of my design. And "validate on target" didn't work for the F4 and the H7, I have the same problem as this guy, but the answer didn't fix the problem.

I will show you my method, I'm surely doing it wrong. First I select the card on the select board menu. Then :0693W00000NscX8QAJ.png0693W00000NscOkQAJ.png 

0693W00000NscQ2QAJ.pngFinally I resolve cloc issues, generate the code (without changing the minimum heap and stack size), build the CM7 project, plug my board via St-Link, run the code and "validate on target" (on COM-3 and 4). I have always the same error :0693W00000NscY6QAJ.pngThank for your informations, I will look into "How to run locally a c-model" article. It will help me a lot.

I thank you again for your time,

Numa

Edit : I tried the Validation application like so :0693W00000Nscw3QAB.pngWith USART : Asynchronous as component and I get this error when building the project : "undefined reference to `MX_USART1_UART_Init"

ST Employee
June 23, 2022

Hello Numa,

I don't see the real issue in your method. I have applied the following sequence w/o issue.

0 - I have created a new project from scratch with a basic model: CubeMX 6.4.0 + X-CUBE-AI 7.1 + STM32H747I-DISCO

0693W00000Nsdj0QAB.png 

1 - It is preferable to not initialize all peripherals with the default mode.

0693W00000NsdONQAZ.png2 - Select the built-in validation application (Cortex-M7)

0693W00000NsdjPQAR.png 

3 - Click "YES" to atomatically set the max MCU clock

0693W00000NsdkmQAB.png 

4 - Import a model

0693W00000NsdlQQAR.png 

5 - Perform "automatic" validation on target. I have selected STM32CubeIDE here.

0693W00000NsdlaQAB.png 

After a build and flash of the two firmwares (M7 & M4), we have:

0693W00000NsdmJQAR.pngAt this step, the board is normally flashed and can be directly used to perform a new validation on target w/o re-generation of the projects with for example the user-data.

0693W00000NsdnHQAR.png 

STM32 IDE project can be also generated (for debug purpose or for example to increase the heap/stack) for your prefered STM32 IDE.

0693W00000NsdnMQAR.png 

You open the project with your prefered STM32 IDE, build and flash the board.

After this step, you can perform a new validation through the UI, or to use the ai_runner interface to perform new scenario of validation.

br,

JM

NBlan.1
NBlan.1Author
Associate II
June 23, 2022

Hello Jean-Michel,

Thanks for your indication, I will try your method first thing in the morning and will give you a report about the result. You are very helpful, thank you !

Best regards,

Numa