Part Number: TMS320C6748
Other Parts Discussed in Thread: BQ25703, TPS65987
I am attempting to setup usb OTG on our TMS320C6748 DSP based system.
USB was already working in device mode, now we need to add features that require the DSP to act as a USB host.
Our system connects to USB through a USB C plug. The power configuration and data role negotiation through the CC lines are handled by an external PD3 controller (TPS65987). When a device is plugged in VBUS is supplied by the charger IC (BQ25703) in our system, which is controlled by software. The USB0_DRVVBUS pin is not connected and the USB0_ID pin is also left floating (as specified for OTG mode in the DSP reference manual).
So far everything is functional - When a device is plugged in, the PD3 controller detects it and sets itself up to be an DFP source port. Switching on the charger IC's OTG enable pin then puts 5V on VBUS.
A snippet of the log output:
===
# PD3 controller polls between sink and source modes, defaulting to UFP data mode
PD3 state: disconnected sink No connection UFP
PD3 state: disconnected source No connection UFP
PD3 state: disconnected sink No connection UFP
PD3 state: disconnected source No connection UFP
# <Plug event>
# PD3 controller lands on source mode and lands on DFP (host) mode
PD3 state: connected source Connection+Ra DFP
===
My plan is to use the PD3 controller status to determine whether to initialise the USB device driver or host driver.
Things go wrong when I try to setup host mode on the DSP.
The steps that I take are:
- Poll the PD3 controller for a plug event
- Initialize the CPPI 4.1 DMA for four endpoints
- Enable the USB peripheral clock
- Reset the USB peripheral
- Enable the USB Phy
- Setup endpoints
- Enable interrupts for the peripheral
- Enable endpoint interrupts
- Set the session request bit
- Poll the USB0_DRVVBUS bit to enable VBUS
The first issue is that the USB peripheral never seems to switch to host mode. The DEVCTL[HOSTMODE] is never set, and the DEVCTL[BDEVICE] remains set to "B" device. The session bit remains 0 and the VBUS is not being switched on.
Forcing the peripheral to operate in hostmode using the TESTMODE[FORCE_HOST] bit switches the DEVCTL lets me start a session.
With this configuration I can set the session bit and it remains active, triggering enabling of VBUS. However shortly after that, the VBUS is driven low again, and the peripheral reports a babble error. Also, when inspecting the data lines through a logic analyser the bus behaves very weird (see included capture). The DEVCTL[BDEVICE] is never set to "A" device.

Some details about the capture:
- the pulses on D- starting at 0.2s are short pulses (600ns) 1ms apart
- the pulses on D- get longer when the pulses on D+ start (600ns -> 1.5us), but are still happening every 1ms
- the pulses on D+ are 900ns and happen simultaneously with the pulses on D- (SE1)
An analog capture reveals that D+ and D- float at around 560mV:

I do not know where to look next to find what is failing.