4
\$\begingroup\$

When using the USB host mode, the STM32 has a pin named OTG_FS_SOF that ST gives very little useful information (in both Datasheet and USB tech documents) other than it has something to do with syncing when driving Audio devices.

However, I've seen various designs where no audio application was used but the SOF pin was connected anyway — pull up with 47k under most cases. Why is that? Is it very important to host mode? Must I connect it, or data wouldn't be sent and received properly? What does it do anyway?

\$\endgroup\$
7
\$\begingroup\$

The Start Of Frame signal can be used as a (slow) clock derived from the host's USB clock, which ideally should be locked to the host's general idea of time.

The focus on audio applications is because this is basically what it is useful for. If you let an audio stream run for a few hours without synchronized clocks, you are likely to have a FIFO over- or underrun, which would be audible, and deriving the ADC/DAC clocks from a host provided clock moves the responsibility to the host, allowing you to work without an elaborate resynchronization schema.

As the clock is rather slow, deriving anything faster than a few hundred kHz is going to run into stability issues on its own, so other applications don't really benefit.

What should happen with unused pins is usually specified in the datasheet or a separate pin connection guide -- if the 47k pull-up is common, it appears to be either from that document or assumed so because the last person also thought so. I'd probably cargo-cult that as well if I don't use the pin.

\$\endgroup\$
2
\$\begingroup\$

SOF pin is used to synchronize an external source of data with a USB frame. The length of a frame can be adjusted in OTG_FS_HFIR register so synchronization is important. The manual mentions audio applications simply because it is an obvious example where samples should arrive at a DAC (or an ADC depending on whether the host side is an audio output or input)at a steady rate. If such synchronicity is not important, one can forget about SOF output and use the pin as a generic GPIO output.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.