cancel
Showing results for 
Search instead for 
Did you mean: 

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

NBlan.1
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
jean-michel.d
ST Employee

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

View solution in original post

7 REPLIES 7
Andrew Neil
Evangelist III

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

NBlan.1
Associate III

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

jean-michel.d
ST Employee

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

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"

jean-michel.d
ST Employee

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

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

It works ! The "validation on target" work thanks to you, maybe it was the version of CubeMX or I was initialize all peripherals with their defaults mode. I will play with ai_runner interface and tweak some parameters to fully understand theses tools. The step after that is to make it work on the STM32F429I-DISCO board. You have my gratitude.

Best regards,

Numa