USB CDC on STM32F746 with ChibiOS 16.1

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

Moderator: RoccoMarco

User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: USB CDC on STM32F746 with ChibiOS 16.1

Post by Korken »

Okey, if I changed to OTG1 instead of OTG2 it started working while having the external 1.5k resistor.
But when I removed the external 1.5k resistor it stopped enumerating again.

What is it that I have to change to enable the internal 1.5k Pull-up for OTG1?
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 CDC on STM32F746 with ChibiOS 16.1

Post by Giovanni »

OTG2 can have an external PHY or not have it, the board configuration differs.

The STM32F7-Discovery has the external PHY for example.

Giovanni
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: USB CDC on STM32F746 with ChibiOS 16.1

Post by Korken »

Yes, but the USB FS that I am using should have an internal 1.5k pull-up resistor?

I checked the RM for the bit:

Code: Select all

/**
 * @brief   Connects the USB device.
 *
 * @api
 */
#if !defined(usb_lld_connect_bus)
#define usb_lld_connect_bus(usbp) (STM32_USB->BCDR |= USB_BCDR_DPPU)
#endif

But it does not exist, do you know which it is? I cannot seem to find it.
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 CDC on STM32F746 with ChibiOS 16.1

Post by Giovanni »

The pull-up is internal and the driver works on the Discovery board. If the enumeration starts then the resistor is working or plugging the device would not even be detected by host.

Giovanni
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: USB CDC on STM32F746 with ChibiOS 16.1

Post by Korken »

The thing is that the USB resistor is not working.
If I add an external resistor it works.

I checked the stm32f746x.h for the USB resistor pull-up bit for USB FS (OTG1) but it does not exist.
I am starting to believe that it is not there. I am though not familiar with the USB part of the RM, so I cannot find anything about the internal 1.5k when using USB FS.

Are you sure it is there?
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: USB CDC on STM32F746 with ChibiOS 16.1

Post by Korken »

Okey, I now found what gave the intermitent nature of the error, one of the 22 ohm resistors where broken and soldiering the big resistor made a connection.
When it was removed to try again, the resistor was broken. Now replaced it seems to work as it should. :)
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: USB CDC on STM32F746 with ChibiOS 16.1

Post by Korken »

Final question on the USB.

When opening the USB serial port from the PC the board Halts with the error:
chSysHalt (reason=0x8008c84 <__func__.9659> "obqReleaseEmptyBufferI") at ./ChibiOS/os/rt/src/chsys.c:184

and I get the error on the PC side:
cdc_acm 1-2:1.0: failed to set dtr/rts

It seems that something is not implemented that has to do with the DTR/RTS signals that I am missing, does anyone know what it is?
I am unable to find it in any example code for the CDC.

Thanks!
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 CDC on STM32F746 with ChibiOS 16.1

Post by Giovanni »

Probably an unimplemented CDC message, the CDC driver only implement a minium of them, you need to provide handlers for the others.

I cannot explain that error however, post a stack trace.

Giovanni
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: USB CDC on STM32F746 with ChibiOS 16.1

Post by Korken »

I see, is there a way to see which one is missing?
Sorry, but USB is not my strong side - I only want a "simple" USB serial port :)
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 CDC on STM32F746 with ChibiOS 16.1

Post by Giovanni »

The default handler is sduRequestsHook(), place a breakpoint there and you will know why it fails (return false).

Giovanni
Post Reply