cancel
Showing results for 
Search instead for 
Did you mean: 

Can't send data through my board

NBlan.1
Associate III

Hello,

I'm trying to send data and retrieve the output from my stm32f4-DISCO. I'm using a python based code and specifically stm_ai_runner. The code is rather simpler but I can't access the board because even runner.summary() doesn't work. My board is flashed with the network :

0693W00000QKrV1QAL.pngAnd this is what my code looks like :

0693W00000QKrVzQAL.pngAnd the terminal :

0693W00000QKrWJQA1.pngI thank you in advance,

Numa

1 ACCEPTED SOLUTION

Accepted Solutions
NBlan.1
Associate III

I successfully manage to fix the problem, sorry, It was a simple wire pronlem (he was in a bad shape) thanks you so much for your time. Have a nice day.

Regards,

Numa

View solution in original post

12 REPLIES 12
fauvarque.daniel
ST Employee

the tensorflow messages that you are seeing are because you don't have a NVIDIA graphics card on your machine. To get rid of those messages you can perform:

pip install tensorflow-cpu==2.9.0

of course the version of tensorflow-cpu must correspond to the version of tensorflow you have on the machine.

Also Tensorflow requires AVX2 enabled CPU, if you have an old machine with AVX2 not supported, tensorflow won't work

If the actual issue is in runner.summary(), the only thing I can think of is that the terminal is still opened and taking the COM port, on windows you can have only one process at a time accessing a COM port.

Regards

Daniel


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hello,

Firstly thank for your response.

I do not think that the problem come from the warnings, but I did as you asked and install tensorflow-cpu and my CPU is AVX2 enabled.

The problem must come from the fact that my code can't access via the Port COM 6 but I do not have any terminal still opened when lauching the code. Maybe he's trying to connect to COM 4 ?

Regards,

Numa

you can use the "mode" command to see all the available ports.

Normally it scans all the ports until there is one responding as the target will answer.

you can specify explicitly the com port to use by passing serial:COM6:115200 instead of serial

from stm_ai_runner import AiRunner

runner = AiRunner()

runner.connect('serial:COM6:115200')

runner.connect returns true if the connection is sucessfull.

You can also hit the reset button on the board before to launch the python code

Regards

Daniel


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thank for your quick response !

I added a bit of code to check if runner.connect() return true or false :

runner = AiRunner()
if runner.connect('serial:COM6:115200'):
    print("True")
else:
    print("False")
runner.summary() # display the network/run-time information
inputs = tf.fill([1,90,3,1], 0)
outputs, _ = runner.invoke(inputs)  # invoke the model

And it return false.

Hello Daniel,

There is some news, I changed my keras model into a tflite model and visibly He now tries to connect. When I do what you said about specify explicitly the COM port like so :

runner = AiRunner()
runner.connect('serial:COM6:115200')
runner.summary() # display the network/run-time information
inputs = tf.fill([1,96,96,1], 0)
outputs, _ = runner.invoke(inputs)  # invoke the model

I get this error message :

0693W00000QKv94QAD.pngAnd when I try to just put :

if runner.connect('serial'):

I get this error :

0693W00000QKv9xQAD.pngSo it seems to try to connect but doesn't seem to success...

Even when I change the port- default value in "serial_hw_drv.py" like so :

# default values
    port_ = 'COM6'
    baud_ = int(115200)

I get the same error, do you know why ?

Regards,

Numa

What about the stm32ai validate command on the target ? does it completes the validation ?

~/STM32Cube/Repository/Packs/STMicroelectronics/X-CUBE-AI/7.2.0/Utilities/windows/stm32ai validate -m model.tflite --target stm32


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hello,

The command create a report file and seems te work. Except that the accuracy is "n.a" and most importantly if I unplug my board it's working, so I think it's more of a "validate on host".

Avout the python code, the problem must be from the board because when I try with another board (I used a H747) it worked as intented.

Maybe the problem is that the stm32f4-DISCO don't have a virtual port COM so I use a FTDI as a Serial Port COM. Do I need to do some kin of manipulation to work via the FTDI ?

Best regard,

Numa

Hi @NBlan.1​ 

Are you using the latest AIRunner version associated with X-Cube-AI 7.2.0 ?

The Python and C code are linked together (stm32ai CLI, C code, and AIRunner should be aligned). One side will wait for specific messages from the other side and if messages are not aligned then the communication will not be possible.

Then I would suggest you to unplug all COM ports devices from your computer (even disabling the Intel default one if you're on Windows laptop), then try also killing all instances of Python you can have in the Task Manager (if instances are still using COM port then the communication will fail) and try again the procedure.

If the problem is still here, you can try rebooting your computer knowing that Windows can have strange behavior with COM ports pluging/unpluging multiple times

Hope this can help you,

Regards,

Romain

Sorry the param is "--mode stm32"

~/STM32Cube/Repository/Packs/STMicroelectronics/X-CUBE-AI/7.2.0/Utilities/windows/stm32ai validate -m model.tflite --mode stm32


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.