USB on STM32F750.

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

rew
Posts: 341
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 11 times

USB on STM32F750.

Postby rew » Wed May 27, 2020 11:52 am

I'm bringing up a board with an STM32F750.

Chibios CMSIS does not have this CPU, so for now I've started from an STM32F746 example project.

First it ran into an "unhandled exception" for GPIOJ. Last time this happened to me the ST docs indicated that this port didn't exist, this time, as far as I can see the documentation specifies that this GPIO port should exist on my processor (even though I may have zero pins on the outside of the CPU)

Now that I have disabled GPIOJ and GPIOK, it gets stuck at this line:

Code: Select all

0x00202bf6 in otg_core_reset.isra.3 () at chibios/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c:141
141       while ((otgp->GRSTCTL & GRSTCTL_CSRST) != 0)

My board doesn't have VBUSSENSE, so I put

#define BOARD_OTG_NOVBUSSENS

in board.h.

I have adjusted the ld script to reflect the smaller flash size. I think the other memories are the same. Still that doesn't seem to be the problem.

Any suggestions?

User avatar
Giovanni
Site Admin
Posts: 13085
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 759 times
Been thanked: 637 times
Contact:

Re: USB on STM32F750.

Postby Giovanni » Wed May 27, 2020 12:16 pm

So it does not come out of reset... differences in clocks?

Giovanni

rew
Posts: 341
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 11 times

Re: USB on STM32F750.

Postby rew » Wed May 27, 2020 1:11 pm

I think I was writing this down, decided to write down the part about vbussense before actually testing it and when I got back this morning I saw that I hadn't posted this yet and.... I seem to have forgotten that I got it to work when testing the vbussense....

The first time it didn't work it ran into the board configuration specifying that LSE would run. Not implemented on my board... I double checked the HSE clock and found the multiplier of 432 "quite a lot, that probably won't work" but ran into trouble when 216 cannot be divided by 4.5 to get the 48MHz USB clock.... Checked the datasheet and: 432 is just fine (and precisely "max").

The chips share the reference manual. Including the "memory map" that in older models would've been in the datasheet and not in the reference manual.

Oh.. You mean the USB module? Yeah, that seems to have been stuck in reset. I thought you were talking about the whole chip.

Anyway:

Code: Select all

> info
Kernel:       4.0.0
Compiler:     GCC 4.9.3 20150529 (prerelease)
Architecture: ARMv7E-M
Core Variant: Cortex-M7
Port Info:    Advanced kernel mode
Platform:     STM32F746 Very High Performance with DSP and FPU
Board:        STMicroelectronics STM32F746G-Discovery
Build time:   May 26 2020 - 22:20:00
It still has a few "strings" from the 746, but otherwise it is now working fine. Next step is some serial stuff (probably not through the chibios drivers because I need some stuff the hardware can do but the driver doesn't (and I have that code for a different STM already)).

I still have to "pretend" that my CPU is a '746. There are no CMSIS files for the '750. I checked current git and... no files there either. I would expect those to be published by ST somewhere but I couldn't find them. As they share the same reference manual I think I won't run into trouble due to this, but still it would be nice to know where to find the official files....

User avatar
Giovanni
Site Admin
Posts: 13085
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 759 times
Been thanked: 637 times
Contact:

Re: USB on STM32F750.

Postby Giovanni » Wed May 27, 2020 2:05 pm

Hi,

They now you can download headers only through their IDE... I will look if newer ones are available and update the trunk. If you have changes to the registry to be performed please post those here.

Giovanni

rew
Posts: 341
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 11 times

Re: USB on STM32F750.

Postby rew » Thu May 28, 2020 2:55 pm

I am now 5 hours into porting my working code to the latest chibios.

The CDC example that my code was based on (for F7) is no longer available. So I'm doing a three-way-merge between the F7 USB RAW example, the F4 USB CDC example and my application code that I had working so far.

In the F4 CDC example I see:

Code: Select all

/*
 * Serial over USB driver configuration 1.
 */
const SerialUSBConfig serusbcfg1 = {
  &USBD2,
  USB_DATA_REQUEST_EP_A,
  USB_DATA_AVAILABLE_EP_A,
  USB_INTERRUPT_REQUEST_EP_A
};

/*
 * Serial over USB driver configuration 2.
 */
const SerialUSBConfig serusbcfg2 = {
  &USBD2,
  USB_DATA_REQUEST_EP_B,
  USB_DATA_AVAILABLE_EP_B,
  USB_INTERRUPT_REQUEST_EP_B
};


I had disabled the second USBDx and the second configuration, but I still got USBD2 undefined. Is that first one wrong to use the wrong USBD driver?

rew
Posts: 341
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 11 times

Re: USB on STM32F750.

Postby rew » Thu May 28, 2020 3:02 pm

This is the only line in the whole source tree that seems to trigger this. Adding -std=c99 in the makefile helps, but as this is the only line (my compile jobs encouter) that has this problem, I would suggest to just fix this one line.

Code: Select all

../../../../os/hal/ports/common/ARMCMx/nvic.c: In function 'nvicInit':
../../../../os/hal/ports/common/ARMCMx/nvic.c:87:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for (uint32_t i = 0U; i <= n; i++) {

User avatar
Giovanni
Site Admin
Posts: 13085
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 759 times
Been thanked: 637 times
Contact:

Re: USB on STM32F750.

Postby Giovanni » Thu May 28, 2020 3:05 pm

Which demo is missing exactly?

Giovanni

rew
Posts: 341
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 11 times

Re: USB on STM32F750.

Postby rew » Thu May 28, 2020 3:49 pm

It turns out the STM32F7xxx CDC demo is located in "multi/CDC".
Found it.

Good that code is being merged between different platforms.

I have now started from that project, changed the USBDx and... now it works until starting the USB driver and then it crashes somewhere with an unhandled exception.

If I put my "blink the led until pigs fly" code before starting USB, then it blinks forever. If I put it after the start USB code then it blinks for about two seconds before stopping/crashing.

rew
Posts: 341
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 11 times

Re: USB on STM32F750.

Postby rew » Fri May 29, 2020 12:39 pm

I have bought the STM32F745 and '750 discovery kits. I normally just get things working on my own hardware, this time I need to be able to rule out any issue with the hardware.

rew
Posts: 341
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 11 times

Re: USB on STM32F750.

Postby rew » Tue Jun 02, 2020 4:00 pm

I have built the USB_CDC demo in testhal/STM32/multi/USB_CDC/ and flashed build/stm32f746_discovery/ch.bin to my F7discovery board with STM32F746G.

This does not enumerate correctly/fully:

Code: Select all

Jun  2 16:54:02 getafix kernel: [2679975.944017] usb 2-2: new high-speed USB device number 124 using ehci-pci
Jun  2 16:54:02 getafix kernel: [2679976.076345] usb 2-2: config 1 interface 0 altsetting 0 endpoint 0x82 has an invalid bInterval 255, changing to 11
Jun  2 16:54:02 getafix kernel: [2679976.076352] usb 2-2: config 1 interface 1 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 64
Jun  2 16:54:02 getafix kernel: [2679976.076356] usb 2-2: config 1 interface 1 altsetting 0 bulk endpoint 0x81 has invalid maxpacket 64
Jun  2 16:54:02 getafix kernel: [2679976.076840] usb 2-2: New USB device found, idVendor=0483, idProduct=5740
Jun  2 16:54:02 getafix kernel: [2679976.076844] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jun  2 16:54:02 getafix kernel: [2679976.076847] usb 2-2: Product: ChibiOS/RT Virtual COM Port
Jun  2 16:54:02 getafix kernel: [2679976.076850] usb 2-2: Manufacturer: STMicroelectronics
Jun  2 16:54:02 getafix kernel: [2679976.076853] usb 2-2: SerialNumber: 610
Jun  2 16:54:07 getafix kernel: [2679981.076125] usb 2-2: can't set config #1, error -110
Jun  2 16:54:07 getafix kernel: [2679981.098485] usb 2-2: USB disconnect, device number 124
Jun  2 16:54:12 getafix kernel: [2679985.828024] usb 2-2: new high-speed USB device number 125 using ehci-pci
Jun  2 16:54:12 getafix kernel: [2679985.960456] usb 2-2: config 1 interface 0 altsetting 0 endpoint 0x82 has an invalid bInterval 255, changing to 11
Jun  2 16:54:12 getafix kernel: [2679985.960463] usb 2-2: config 1 interface 1 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 64
Jun  2 16:54:12 getafix kernel: [2679985.960467] usb 2-2: config 1 interface 1 altsetting 0 bulk endpoint 0x81 has invalid maxpacket 64
Jun  2 16:54:12 getafix kernel: [2679985.960951] usb 2-2: New USB device found, idVendor=0483, idProduct=5740
Jun  2 16:54:12 getafix kernel: [2679985.960955] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jun  2 16:54:12 getafix kernel: [2679985.960958] usb 2-2: Product: ChibiOS/RT Virtual COM Port
Jun  2 16:54:12 getafix kernel: [2679985.960961] usb 2-2: Manufacturer: STMicroelectronics
Jun  2 16:54:12 getafix kernel: [2679985.960964] usb 2-2: SerialNumber: 610
Jun  2 16:54:17 getafix kernel: [2679990.960188] usb 2-2: can't set config #1, error -110
Any idea what could be wrong?


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 3 guests