USB on F303xE

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

Moderator: RoccoMarco

Post Reply
fractal
Posts: 16
Joined: Mon Oct 28, 2013 12:13 pm
Has thanked: 2 times
Been thanked: 5 times

USB on F303xE

Post by fractal »

Hello everyone,

I have a small project running with an F303xC which connects to USB just fine, with an external 1.5k resistor on the DP line and a disconnect-macro which pulls the pin low:

Code: Select all

#define usb_lld_disconnect_bus(usbp) (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_OUTPUT_PUSHPULL))
#define usb_lld_connect_bus(usbp)     (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_ALTERNATE(14)))


I now switched the controller to a F303xE, which is a version with larger flash. This controller runs into an exception in the USB code and freezes during the initialization. Somewhat unusually this minor flash change is accompanied by some other differences which are hard to find since ST does not provide a list, but I found out that the USB is not an alternate function on these parts, but an additional function. Difference seems to be that the additional function is switched by the peripheral itself and one does not need the pins in alternate but in input mode. Now, when I change the alternate to input mode the exception disappears, but the enumeration fails, windows won't recognize the device.

Has anyone used the USB peripheral with these specific devices (e.g. on the F303 Nucleo) and knows how to adapt the code?

Thanks in advance,
Thomas
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: USB on F303xE

Post by Giovanni »

Hi,

I don't know but on L1 devices USB must be plain input too if I remember well.

I haven't tested the device, try enabling debug options and see if something is caught.

Giovanni
fractal
Posts: 16
Joined: Mon Oct 28, 2013 12:13 pm
Has thanked: 2 times
Been thanked: 5 times

Re: USB on F303xE

Post by fractal »

Debug options are on, nothing. So far I didn't investigate the exception further as I assumed there is some obvious (for someone else :) ) misconfiguration.
The L1 is similar in some respects, but not quite the same as it seems to have a switchable pullup. Anyway, I looked at the config for the L1 and I have set everything the same (input, high speed, no pullups).

The manual is not particularly helpful, the only note of a difference between the B/C and the D/E USB hardware is that the latter has more buffer and LPM support. I also looked at the ST drivers for the chip as well as your drivers for F303, F103, F407 and L1 and didn't find anything useful. I also couldn't find any appnotes or anything on this particular USB hardware.

So, maybe I will continue to look on monday, but I don't feel like wasting more time on this problem and may just try to live with the C-version....

Thanks for your support Giovanni, have a good evening.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: USB on F303xE

Post by Giovanni »

I would check the USB clock settings too.

I just saw that the device is not among those supported, it is possible that some registry settings are different from the xC, for example STM32_USB_ACCESS_SCHEME_2x16.

ST headers need an update in the repository too.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: USB on F303xE

Post by Giovanni »

OK, just verified, STM32_USB_ACCESS_SCHEME_2x16 should be TRUE on this device.

I will update headers and registry soon.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: USB on F303xE

Post by Giovanni »

Hi,

I merged the new headers, xE devices support should be OK now but I cannot test it because no HW.

Giovanni
fractal
Posts: 16
Joined: Mon Oct 28, 2013 12:13 pm
Has thanked: 2 times
Been thanked: 5 times

Re: USB on F303xE

Post by fractal »

Hi Giovanni,

of course, when I added the device I left the USB_ACCESS_SCHEME the same as for the xC... Where do you even find this info?
I built against trunk this morning and it works perfectly, thank you very much :)

Just one cosmetic edit: the hal_lld.h is missing the xE:

#elif defined(STM32F303xE)
#define PLATFORM_NAME "STM32F303xE Analog & DSP"

Regards,
Thomas
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: USB on F303xE

Post by Giovanni »

Hi,

It is in the STM32 RM, where it lists USB features, this is a recent enhancement to the peripheral that allows a slightly quicker data copy from PMA.

Giovanni
Post Reply