Closed igrek-xavier closed 7 months ago
When building portenta_STM_template_CM7 Release, I got a library error fatal error: usbd_cdc.h: No such file or directory usbd_cdc_if.h /PortentaH7_VFR_CM7/Core/Inc line 15 C/C++ Problem
Hi Xavier,
I am glad you have started working on it.
I tried to run the code on a new machine to be able to diagnose any problems correctly.
You are right, the code didn't run as I had to initialize pin J0 which is connected to the Power Management IC standby pin, I added the modification on main() of the M7 to get it running, it should be fine now.
As for the configurations, it is strange that you don't see them, I see them all, Run->:Run Configurations:
I want you to try the following: Open main.c in the Portenta_STM_template_CM7 project: Then click on the arrow next to the play button on the ribbon and select portenta_STM_template_Release It should be available and run normally.
As for the usbd_cdc.h file not being found I think you are compiling the wrong project as it says it is for PortentaH7_VFR_CM7 which is another project you have in your workspace.
Another thing to check is to make sure the boot pin is no longer pulled up, make sure to return the boot dip switch on the breakout board to the off position after programming otherwise it will always boot in DFU mode.
One more thing to check is the option bytes on the MCU. Using the STM32 ST-Link Utility click on Target->Option Bytes, make sure they are as shown below: I have tested the code on two different machines and it ran ok.
Let me know how it goes for you.
Regards, Sofian.
On Thu, Apr 18, 2024 at 8:06 AM igrek-xavier @.***> wrote:
When building portenta_STM_template_CM7 Release, I got a library error fatal error: usbd_cdc.h: No such file or directory usbd_cdc_if.h /PortentaH7_VFR_CM7/Core/Inc line 15 C/C++ Problem
— Reply to this email directly, view it on GitHub https://github.com/skjafar/Portenta_Cube_Template/issues/3#issuecomment-2063001227, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYKROQGS7EM3JSUN6XN4L3Y55IG7AVCNFSM6AAAAABGMKD3PGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRTGAYDCMRSG4 . You are receiving this because you were mentioned.Message ID: @.***>
Dear @skjafar thanks a lot for you quick updates. I will try to sum-up my understanding with my set-up as it is progressing 1.To program (either IDE or Programmer) I need to have BOOT switch on 2.STLink3-MINNIE will open a virtual com port for UART output when CM7 will be running ? 3.Once the programming is done, the UART should be displaying the Heap Statistics from console.c but I don't see any output on the UART (either with BOOT=1 nor with BOOT=0) 4.The PortentaH7 seems to behave correctly (PHY Link up with traffic but no IP Address provided from the DHCP point of view like some DHCP is missing somewhere, the LED next to the USB connector is toggling at 500ms rate like in LED.c)
Below is a screenshot of the flashing of CM7_Release which seems correct with latest J0 pin enabled code. My main issue is why I don't see any output of the UART so I can start adding code to your project and check that through printf on the console which could lead to some pull request.
Much regards, Xavier.
Dear @skjafar when we run the code with breakpoint we are stuck on ErrorHandler in main.c maybe there is a relation with the fact that I dont see any output on the UART over Virtual COM through the STLink USB programmer ? Best, Xavier.
The COM port is not the same as the one on the STLINK MINI3. This UART is populated over the USB-C connection of the portenta itself, so you should have it plugged in to your PC:
Run the Debug configuration and check the call stack in order to have an idea of where it stops. This is strange as I do no see it stopping.
Thanks for the upgrade dear Sofian, current status
For the breakpoint in ErrorHandler, I will check more with callstack but now my priority is got get the UART output the Free Heap Statistics so I can work with printf running code with internal and external flash memory.
@skjafar I have plugged a freshly bought PortentaH7 to Win10 and it gets recognized right away in the Device Manager, so I am wondering if there is an issue with my set-up. I have tried with another PortentaH7 and Win10 PC and get the same result. I feel I am missing something on the way where as on your side you were able to get the UART correctly after flashing the STM32CubeIDE project and restart in BOOT=0
I am glad to read this!
Are they all normal Portenta H7 boards and the light variant or some other variant?
You only need to set BOOT=1 when programming for the first time, afterwards it is not required unless you brick the device.
Check the telnet feature now.
Dear Sofian @skjafar , Thanks for the great template.
I am trying this template together with Xavier, and like Xavier, I have observed a similar phenomenon with USB CDC.
_os_show_statistics()
)So I checked the behavior using the debugger, and it seems that USBD_Init()
called inside of usb_uart_start()
in the main task is returning an error and goes to an infinite loop by Error_Handler()
.
Therefore, app_usb_info_task()
is not spawned and no output in console. On the other hand, the LED task is created just before usb_uart_start()
, so the LED blinking seems to be working.
I have looked at the code briefly, and it may work if I initialize it as USB CDC instead of USB HS, but I am not familiar with STM32Cube, so I could not figure out how to change the driver for USB CDC...
I want to ask for your wisdom, as you have much experience with STM32. Do you have any insight into how to fix this USB initialization error?
Thank you very much for your help!
@hideakitai
Do you know the exact error code you are receiving?
As for USB-CDC in fact I did get it running once before switching to USB-HS. Let me take a look and I will get back to you.
What's baffling me is that @igrek-xavier was able to get it to run and it's not working with you!
I will compile it on my PC and send it to you then you can flash it and check if it works for you or not. This will help us know if the problem is in the configuration or the code itself.
Another thing I suspect is differences between board revisions from Arduino. I am worried there are actual differences between boards.
Dear @skjafar maybe i was wrongly describing my situation but i was not able to get the uart on usb of the portenta even once. I see the led blinking and the rj45 interface going up but no ip adresse get acquired and i dont see the mac address of the portenta trafficking on the LAN. What do you mean by USB-HS ? not usable USB ? Concerning the difference between boards. this is an option and we should put the exact version number and features here to be sure I think.
I have tried everything tying to reproduce this error and I am not able to! One thing I can point out is that you will need to remove all power from the board and reapply it again after programming for the first time, this is due to Power Domains configuration in the STM32H7 MCU. Remove USB-C cable from the Portenta and remove the USB cable of the ST-LINK as well just to make sure there is no source of power, then plug them back in.
I even reprogrammed the Arduino bootloader after completely wiping it, then flashing my code and again it worked.
Tested on Windows 10 (putty), Linux Manjaro (minicom), Virtual Box running Windows 10 (putty) under Manjaro and another Windows 10 device (putty and realterm). All of them read UART output!
did you make sure to run the device using this?
Also, please check the driver under windows 10. I have the following:
Please do the following:
Hi Guys,
I have been working with the Portenta H7 on CubeMX for about 6 months now.
A few important points:
There are slight differences between different hardware versions. The Lite will boot past the Ethernet Init code. The WiFi version will not. I haven't spent much time on why, because I don't need WiFi on my application.
Pay very close attention to the Reset pins on BOTH the USB HS chip and the Ethernet chip. I have noticed in some versions of the hardware you can leave these floating and the init code works. On other boards, you must pull them in the correct direction. For safety simply enable the pull ups or pull downs as required by each chip. Refer to the Portenta H7 schematic to identify which pins.
Debugging and stepping through the Init code is your friend! Simply disable the Init code that fails, until you can get to the while(1) loop. CubeMX is a little flakey, but trust in the debugger. When setup correctly it works very well.
BOOT pins should only be used to enable the STM default hard bootloader (otherwise it will never boot your code!!)
The Ethernet Chip enables and blinks the LEDs INDEPENDENTLY of the STM32 CPU. Do not confuse the LEDs blinking with the Ethernet being correctly configured and operating! Once the Ethernet chip has power and reset is released, it does provide some feedback via the LEDs, without and CPU intervention.
I hope this helps,
@TheOrignalCDV You are right, I have observed some differences between the regular H7 and the Lite. Mostly in in setting up the Power Management module.
I have changed how we start the power management IC.
Please check the latest commit c22d08fd71ef668eab0eb70a0248ab7d1b611587
One other issue that I have updated is the delay after setting up the PMIC.
This used to halt the m7 core on dome devices (Lite).
Should be ok now with c3d398702fa9b1a21f6fe85bc46223811f30d83f
Dear @skjafar
thanks again for your great project and all this work around this great board PortentaH7. I have been able to connect the STLINK-V3MINIE to the Breakout-board and flash from STM32CubeIDE through the debugger. However I don't seem to be able to run the code and get the UART showing the FreeRTOS information. It seems that the CM7 is not actually running. Also I dont find the CM7 release configurations when I try to run it only the Debug is available.
Am I missing something in the Release or Debug process to have the code running ?