Using usb fullspeed on highspeed phy (stm32f723)

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
User avatar
sabdulqadir
Posts: 49
Joined: Fri Mar 23, 2018 7:29 pm
Has thanked: 13 times
Been thanked: 4 times

Using usb fullspeed on highspeed phy (stm32f723)

Postby sabdulqadir » Tue Sep 29, 2020 2:23 pm

Hi guys,
On stm32f723, I am using otg_hs controller with internal hs-phy. My application enumerates as a CDC class device (virtual com port). I am able to do highspeed transfers using chnWrite(). Recently there was a case where we need to slow the physical interface down. So I changed otg_dcfg_dspd = DCFG_DSPD_HS_FS. This would enable hs-phy to negotiate with the host to communicate using full-speed protocol. After the change, the device would not enumerate. After a bit of effort, I realized, by changing MaxPacketSize on Interrupt_request_ep to 64 (from 512), it would enumerate. The interval on that end-point is set to 0xff. So my first query

1. Would anyone know if there is any such limit of packet size on interrupt_request_ep?

After the change, the device now enumerates but still I am not able to transfer big chunks of data. ChnWrite() after a few attempts just sits idle. I have declared three serial_usb buffers. I see data is present in all three of them. 'bcounter' field in obqueue is 0.

2. What is the best way to troubleshoot this issue ?

Thanks,
AQ

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

Re: Using usb fullspeed on highspeed phy (stm32f723)

Postby Giovanni » Tue Sep 29, 2020 3:19 pm

Hi,

I never tested this scenario, probably there is something in the USB2 standard, 64 bytes could be a limit at that speed.

What is the buffers size? apparently the buffers are full and the serial_usb is not emptying them like it is supposed to do, it is like the driver does not call sduDataTransmitted().

Giovanni

mck1117
Posts: 28
Joined: Wed Nov 11, 2020 6:41 am
Has thanked: 1 time
Been thanked: 5 times

Re: Using usb fullspeed on highspeed phy (stm32f723)

Postby mck1117 » Mon Feb 15, 2021 9:32 am

sabdulqadir wrote:Hi guys,
After a bit of effort, I realized, by changing MaxPacketSize on Interrupt_request_ep to 64 (from 512), it would enumerate. The interval on that end-point is set to 0xff. So my first query

1. Would anyone know if there is any such limit of packet size on interrupt_request_ep?


You need to set the max packet size on both your CDC data descriptor and the endpoint to 64 bytes. Did you change both? If you have that set to 512 but the descriptor configured for 64, that's a recipe for undefined behavior since the buffer will never fill.

User avatar
sabdulqadir
Posts: 49
Joined: Fri Mar 23, 2018 7:29 pm
Has thanked: 13 times
Been thanked: 4 times

Re: Using usb fullspeed on highspeed phy (stm32f723)

Postby sabdulqadir » Thu Mar 25, 2021 12:59 am

Thanks mck for the help and taking time to reply.
You are right, i did finally realize that after few hit and miss trials :)
Thanks,
AQ


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 5 guests