Hi,
I'm trying to get USB running on my own device (my Pecan Project). I had a predecessor Pecan Pico 8b and I got it working on this device using a STM32F429.
The sucessor Pecan Pico 9a doesn't use a STM32F413 instead. That chip has only the OTG1 and no OTG2. So I moved everything to the PA port. Unfortunately there is no STm32F413 yet available for ChibiOS, so I'm using the alternative STM32F412 model which works also fine (with some exceptions).
Since this is my own design I checked all pins and especially the design. I did this by wiggling PA11 (D-) and PA12 (D+) by software and measure this on a cut USB cable. The voltage level is at around 2.90V which is a little bit low. Tough I think it should still work. But at the moment I feed 3.3V externally to rule out such an error.
I also see my computer looking for a device on my oscilloscope having a signal level of 3.7V but the STM32F413 doesn't respond. It would have a lower voltage level on the oscilloscope. But I cannot see any.
I saw the datasheet telling: "The USB OTG full-speed controller requires a dedicated 48 MHz clock, which is generated by a PLL connected to the HSE oscillator" (Datasheet STM32F413xG/H [DocID029162 Rev 4], Chapter 3.33, Page 40).
While I cannot bring the HSE currently to work, I use the HSI. I think that is possible since I have used USB with the HSI on the STM32F429 before (or might there be an issue).
Currently I can't bring the HSE to work. The MCU stops working when enabling it (using STM32_HSE_ENABLED), even if the MCU supposed to use the HSI.
The Code which I use is available on Github if somebody wants to check something: https://github.com/DL7AD/pecanpico9/tre ... r/software
USB is started in the main.c
https://github.com/DL7AD/pecanpico9/blo ... are/main.c
In the usbcfg.c I have changed everthing to USBD1
https://github.com/DL7AD/pecanpico9/blo ... e/usbcfg.c
Best Regards
Sven
Problems using USB on STM32F413 Topic is solved
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problems using USB on STM32F413
Hi,
The F413 is not supported yet, differences with other devices have not been analyzed yet, hard to tell what your problem could be.
Giovanni
The F413 is not supported yet, differences with other devices have not been analyzed yet, hard to tell what your problem could be.
Giovanni
Re: Problems using USB on STM32F413
That could be a problem. But so far I know, nothing has changed between the STMF412 and STMF413. I couldn't see any difference in the Reference Manual.
By the way. I've got the HSE working. It has been a hardware problem. But it didn't affect the USB problem unfortunately.
Sven
By the way. I've got the HSE working. It has been a hardware problem. But it didn't affect the USB problem unfortunately.
Sven
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problems using USB on STM32F413
Note that both F412 and F413 are different from the other F4s and require a new clock tree.
Giovanni
Giovanni
- RoccoMarco
- Posts: 655
- Joined: Wed Apr 24, 2013 4:11 pm
- Has thanked: 83 times
- Been thanked: 67 times
Re: Problems using USB on STM32F413
Hi, F412 and F413 are still unsupported since there are some small differences in clock tree. I will add support soon.
Re: Problems using USB on STM32F413
Hi Rocco and Giovanni,
I've been adding STM32F413 to RT.
Made updates to:
os/common/ext/CMSIS/ST/STM32F4xx/stm32f4xx.h
os/hal/ports/STM32/STM32F4xx/hal_lld.h
os/hal/ports/STM32/STM32F4xx/stm32_rcc.h
os/hal/ports/STM32/STM32F4xx/stm32_registry.h
Added:
os/common/ext/CMSIS/ST/STM32F4xx/stm32f413xx.h
So far have added the extra timers (inc LPTIM1), uart, spi, i2c, i2cfmp (not sure if this should be added as I2C4 with a define for supports FMP), etc. but not made any driver changes.
Thus I've got only the basics of what will really be needed in order to make a F413 specific implementation but it's a start.
At least a demo project of NUCLEO-F413ZH (a clone of the F412 demo project with changes, new board config) will compile.
I thought as the next step to load this to the NUCLEO-F413ZH board to see if the basics work.
Unfortunately openocd in Chibistudio doesn't recognise the F413.
So next adventure is to get the latest patched openocd with F413 support (http://openocd.zylin.com/#/c/4045/).
Before I mess about with installing MSYS2 and building openocd I wondered if you had the patched openocd already?
Thanks,
Bob
I've been adding STM32F413 to RT.
Made updates to:
os/common/ext/CMSIS/ST/STM32F4xx/stm32f4xx.h
os/hal/ports/STM32/STM32F4xx/hal_lld.h
os/hal/ports/STM32/STM32F4xx/stm32_rcc.h
os/hal/ports/STM32/STM32F4xx/stm32_registry.h
Added:
os/common/ext/CMSIS/ST/STM32F4xx/stm32f413xx.h
So far have added the extra timers (inc LPTIM1), uart, spi, i2c, i2cfmp (not sure if this should be added as I2C4 with a define for supports FMP), etc. but not made any driver changes.
Thus I've got only the basics of what will really be needed in order to make a F413 specific implementation but it's a start.
At least a demo project of NUCLEO-F413ZH (a clone of the F412 demo project with changes, new board config) will compile.
I thought as the next step to load this to the NUCLEO-F413ZH board to see if the basics work.
Unfortunately openocd in Chibistudio doesn't recognise the F413.
So next adventure is to get the latest patched openocd with F413 support (http://openocd.zylin.com/#/c/4045/).
Before I mess about with installing MSYS2 and building openocd I wondered if you had the patched openocd already?
Thanks,
Bob
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problems using USB on STM32F413
Hi,
The latest OpenOCD we compiled is here under tools: https://svn.code.sf.net/p/chibios/svn/b ... udio_trunk
Giovanni
The latest OpenOCD we compiled is here under tools: https://svn.code.sf.net/p/chibios/svn/b ... udio_trunk
Giovanni
Re: Problems using USB on STM32F413
Thanks Giovanni.
The openocd in the SVN reports version as: Open On-Chip Debugger 0.10.0-dev-00107-ge4848fe (2015-11-13-11:49)
F413 support was initially added in March 2017 and was still getting patch updates as recently as June 13.
Your repo version of openocd (derived from MSYS2) is not that recent.
So I may have to setup to build openocd from scratch or perhaps wait for Freddie Chopin to release a binary.
Depends on time availability.
Meanwhile I've flashed the NUCLEO demo code (same functionality as F412 demo) using ST-LINK Utility V4 and updated firmware on the Nucleo ST-LINK to V2.J28.M18.
The demo code loads and runs the Chibios test suite so at least the basics are working.
Regarding earlier posts in this thread I'm not sure which differences exist that need a revised clock chain setup.
For sure I2CFMP uses different clock selection that needs to be catered for.
Not sure if that was it or there are more/different changes required?
If you can let me know what you saw as needing work I'll review the RM, etc. and see if I can implement required changes.
Thanks,
Bob
The openocd in the SVN reports version as: Open On-Chip Debugger 0.10.0-dev-00107-ge4848fe (2015-11-13-11:49)
F413 support was initially added in March 2017 and was still getting patch updates as recently as June 13.
Your repo version of openocd (derived from MSYS2) is not that recent.
So I may have to setup to build openocd from scratch or perhaps wait for Freddie Chopin to release a binary.
Depends on time availability.
Meanwhile I've flashed the NUCLEO demo code (same functionality as F412 demo) using ST-LINK Utility V4 and updated firmware on the Nucleo ST-LINK to V2.J28.M18.
The demo code loads and runs the Chibios test suite so at least the basics are working.
Regarding earlier posts in this thread I'm not sure which differences exist that need a revised clock chain setup.
For sure I2CFMP uses different clock selection that needs to be catered for.
Not sure if that was it or there are more/different changes required?
If you can let me know what you saw as needing work I'll review the RM, etc. and see if I can implement required changes.
Thanks,
Bob
- RoccoMarco
- Posts: 655
- Joined: Wed Apr 24, 2013 4:11 pm
- Has thanked: 83 times
- Been thanked: 67 times
Re: Problems using USB on STM32F413
Hi,
have you checkout the right subfolder?
https://svn.code.sf.net/p/chibios/svn/b ... s/openocd/
My version reports
Open On-Chip Debugger 0.10.0+dev-00146-g1025be363 (2017-06-11-20:37)
Let me know where the problem is.
have you checkout the right subfolder?
https://svn.code.sf.net/p/chibios/svn/b ... s/openocd/
My version reports
Open On-Chip Debugger 0.10.0+dev-00146-g1025be363 (2017-06-11-20:37)
Let me know where the problem is.