Page 2 of 5

Re: USB CDC on STM32F746 with ChibiOS 16.1

Posted: Wed Jul 27, 2016 2:31 pm
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?

Re: USB CDC on STM32F746 with ChibiOS 16.1

Posted: Wed Jul 27, 2016 2:56 pm
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

Re: USB CDC on STM32F746 with ChibiOS 16.1

Posted: Wed Jul 27, 2016 2:59 pm
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.

Re: USB CDC on STM32F746 with ChibiOS 16.1

Posted: Wed Jul 27, 2016 3:05 pm
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

Re: USB CDC on STM32F746 with ChibiOS 16.1

Posted: Wed Jul 27, 2016 3:15 pm
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?

Re: USB CDC on STM32F746 with ChibiOS 16.1

Posted: Wed Jul 27, 2016 5:16 pm
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. :)

Re: USB CDC on STM32F746 with ChibiOS 16.1

Posted: Wed Jul 27, 2016 6:31 pm
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!

Re: USB CDC on STM32F746 with ChibiOS 16.1

Posted: Wed Jul 27, 2016 6:41 pm
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

Re: USB CDC on STM32F746 with ChibiOS 16.1

Posted: Wed Jul 27, 2016 6:46 pm
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 :)

Re: USB CDC on STM32F746 with ChibiOS 16.1

Posted: Wed Jul 27, 2016 6:51 pm
by Giovanni
The default handler is sduRequestsHook(), place a breakpoint there and you will know why it fails (return false).

Giovanni