2024-08-01 07:13 AM
Hello! I would like to implement simple Embedded NN on STM32 MCU. I have followed tutorials but still have some questions:
1. For validation on target, I have flashed hex file into micocontroller and reconnected it. When run validate on target, the following message is shown.
Exec/report summary (validate)
--------------------------------------------------------------------------------------------------------------
model file : C:\Users\Control\Documents\STM32Home\model_sine.h5
type : keras
c_name : network
compression : low
options : allocate-inputs, allocate-outputs
optimization : balanced
target/series : stm32g0
workspace dir : C:\Users\Control\AppData\Local\Temp\mxAI_workspace1115474183200017071310444384230046
output dir : C:\Users\Control\.stm32cubemx\network_output
model_fmt : float
model_name : model_sine
model_hash : 0xa96cca22e011f8257d867dbaf6026b31
params # : 491 items (1.92 KiB)
--------------------------------------------------------------------------------------------------------------
input 1/1 : 'input_0', f32(1x20x1), 80 Bytes, activations
output 1/1 : 'dense', f32(1x1), 4 Bytes, activations
macc : 9,821
weights (ro) : 2,084 B (2.04 KiB) (1 segment) / +120(+6.1%) vs float model
activations (rw) : 400 B (400 B) (1 segment) *
ram (total) : 400 B (400 B) = 400 + 0 + 0
--------------------------------------------------------------------------------------------------------------
(*) 'input'/'output' buffers can be used from the activations buffer
Running the Keras model...
Running the STM AI c-model (AI RUNNER)...(name=network, mode=TARGET)
INTERNAL ERROR: E801(HwIOError): Invalid firmware - COM5:115200
Analyze and validation on desktop work well. My microcontroller is from G0 family, so is this a reason for this error message?
2024-08-01 07:18 AM
Hello,
Which hex file are you referring to ? Is your project a "validation" template ? Do you see any outputs if you open COM5 port with a tool such as PuTTY or TerraTerm ?
Best regards,
Yanis
2024-08-01 07:29 AM
@hamitiya Thank for reply. I have used .hex file which is located in folder release (I dont know if this is what you mean) and flashed it using STM32 Prog with UART port.
Is your project a "validation" template ?
What do you mean, sorry but I am new with STM.
Do you see any outputs if you open COM5 port with a tool such as PuTTY or TerraTerm ?
No, But accauly, I didn't modify the generated code so I don't expect any message on Putty.
2024-08-01 07:51 AM
Hello,
Yes the hex or elf file in Release folder.
From the documentation: Getting started with X-CUBE-AI Expansion Package for Artificial Intelligence (AI) - User manual, in page 15, you select in the wizard your project, you have 3 choices:
- System performance: standalone AI test application for performance purpose
- Validation: AI test application for validation purpose
- Template application: basic application template for AI application
Validation will generate a project which will allow you to validate using "validation on target".
SystemPerformance will print you inference time directly in the output and you can read it from tty.
You don't need to modify the code to see any message on putty. X-CUBE-AI appends the project main application with either validation or SystemPerformance structure. You only need to load a model (onnx, keras, tflite)
I suggest you to follow the documentation to start with X-CUBE-AI, and append this thread if you still see issues or if you have any questions.
Best regards,
Yanis
2024-08-01 08:01 AM - edited 2024-08-01 08:01 AM
@hamitiya , Yes my project is selected from wizard for validation purposes. So Microcontroller from family G0 is suitible for AI application? It is G0B1CEU6N.
2024-08-01 08:03 AM
To perform the hardware validation, first you have to flash the correct validation code. After flashing the validation code, connect the board to the Tera term. If the validation code is correct then a certain message appears on screen (as given in the xcube ide user manual). After completing this step try the hardware validation.
Ritesh
2024-08-01 08:48 AM
@hamitiya In documentation Getting started with X-CUBE-AI Expansion Package for Artificial Intelligence (AI) - User manual
There is one option "Set the MCU memory subsystem" which is not available in my micrcontroller.
2024-08-01 09:13 AM
Putty gives some message as in image. As wriiten "Ready to receive CMD from HOST". Should I write somthing to test, but anyway the terminal (cursor) doe not respond.
2024-08-01 09:56 AM
Now, try the hardware validation step.