Skip to main content
ardulfino
Associate
July 27, 2021
Question

Hi, do any of you know how to achieve the advertised MHz ADC sampling rates on the Arduino H7 Portenta board, which I believe has STM32 H7?

  • July 27, 2021
  • 8 replies
  • 3621 views

I tried the STM32Cube Programmer but it could not connect to the board. I'm on Linux Manjaro. Many thanks

This topic has been closed for replies.

8 replies

Technical Moderator
July 27, 2021

Hello @ardulfino​ ,

Let me first welcome you to the Community :)

What exactly did the error message say? You can share a screenshot to better understand your issue.

Make sure to use the latest release of STM32CubeProgrammer V2.8.0.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
ardulfino
ardulfinoAuthor
Associate
July 27, 2021

Many thanks for your warm welcome, Imen!

Yes, I can confirm I have STM32CubeProgrammer V2.8.0.

The error is "Error: Cannot open port ttyACM0, it may be used by another application or port name is invalid." I attach a screenshot.

I rebooted my PC and made sure the Arduino IDE didn't hog the port ttyACM0. I've used this port to upload sketches from Arduino IDE and to forward serial comms with socat, so I know it works. The system can see the port:

[ulf@ulf-manj ~]$ ls /dev | grep ACM 
ttyACM0

I tried all the four ways to connect, but with the same error message. If you believe that the Portenta H7 board should work with for instance kubuntu 20.04 or even Windows 10, I could give this a go too.

Many thanks,

Ulf

ardulfino
ardulfinoAuthor
Associate
July 27, 2021

.. better screenshot, sorry grabbed the wrong file

ardulfino
ardulfinoAuthor
Associate
July 27, 2021

Further to the above, I managed to get rid of that error message by running the Cube CLI as super user:

normal user:

[ulf@ulf-manj bin]$ ./STM32_Programmer_CLI --connect port=ttyACM0 P=NONE br=9600
 -------------------------------------------------------------------
 STM32CubeProgrammer v2.8.0 
 -------------------------------------------------------------------
 
Error: Cannot open port ttyACM0, it may be used by another application or port name is invalid.

sudo:

[ulf@ulf-manj bin]$ sudo ./STM32_Programmer_CLI --connect port=ttyACM0 P=NONE br=9600
 -------------------------------------------------------------------
 STM32CubeProgrammer v2.8.0 
 -------------------------------------------------------------------
 
Serial Port ttyACM0 is successfully opened.
Port configuration: parity = none, baudrate = 9600, data-bit = 8,
 stop-bit = 1.0, flow-control = off
 
Timeout error occured while waiting for acknowledgement.

I tried parity even, baudrate 115200 too, even --go noack, but the timeout error persists

Technical Moderator
July 27, 2021

Thanks for sharing more details. It seems your issue is related to Cubeprogrammer tool.

I will escalate this to our Tools team for check and analysis.

If possible to share the complete log file for more investigation.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
ardulfino
ardulfinoAuthor
Associate
July 27, 2021

Thank you! Where can I find the log file you need?

Technical Moderator
July 27, 2021

You can use the log option: -log [filePath.log] on the STM32CubeProgrammer_CLI.

Please refer to this UM2237 for more details about the command used.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
ardulfino
ardulfinoAuthor
Associate
July 27, 2021

logfile content:

19:22:28:441 -------------------------------------------------------------------
19:22:28:442 STM32CubeProgrammer v2.8.0 
19:22:28:442 -------------------------------------------------------------------
 
19:22:28:442 
 
19:22:28:442 Log output file: /home/ulf/cube_log.txt
19:22:28:442 Command line: --connect port=ttyACM0 p=none br=115200 -log /home/ulf/cube_log.txt
19:22:28:442 
19:22:28:444 Serial Port ttyACM0 is successfully opened.
19:22:28:444 Port configuration: parity = none, baudrate = 115200, data-bit = 8,
 stop-bit = 1.0, flow-control = off
19:22:28:444 No Init bits value is : 0 
 
19:22:28:444 Sending init command: 
19:22:28:444 byte 0x7F sent successfully to target
19:22:30:445 Wait ends after 1 loop, dataready = 0, delay = 2001
19:22:30:445 
Timeout error occured while waiting for acknowledgement.
19:22:30:445 No response from target received
19:22:31:446 waitForBytesWritten Error : Operation timed out

 Note: logfile paths with uppercase letters will fail

Tesla DeLorean
Guru
July 27, 2021

The STM32 Serial Boot Loader uses EVEN parity, 8E1

Only works once out of reset, so BOOT0 needs to be HIGH, device reset, UART connectivity

AN2606 should indicate viable UART pins on the H7

https://www.st.com/resource/en/application_note/cd00264342-usart-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf

https://www.st.com/resource/en/application_note/cd00167594-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
ardulfino
ardulfinoAuthor
Associate
July 28, 2021

Thank you Tesla,

just to clarify, I am trying to connect to the board via USB cable.

Parity even doesn't make a difference and I struggle with finding out how to set BOOT0 on the Portenta H7 board. I came across this post:

https://community.st.com/s/question/0D53W00000ElW5DSAV/stm32h747-how-to-start-the-system-boot-loader-via-software

 including a comment by TDK:

"Looks like the USB connector on that board is using the HS USB which is not supported by the STM32 bootloader."

to which reefwing replied:

"The Portenta can do both HS and FS USB however Arduino devices have a proprietary USB VID/PID"

Do the errors I get make sense in this context? Any idea how to connect to the board using FS USB?

However, returning to my initial question, my goal is to achieve the advertised ADC rates for this particular board. In the meantime, I have found a promising tutorial at https://deepbluembedded.com/stm32-adc-read-example-dma-interrupt-polling/ which uses the STM32CubeMX to generate some background code. Most of the hal libraries have been ported by the arduino people, so my next approach would be to generate the setup code (main.h and Init functions) for the STM32H747XI (thank you @reefwing !) and incorporating that using the arduino IDE.

If this approach works, I will not need to use the STM32CubeProgrammer to connect to the board. I'll post any progress here.

Many thanks for your help!