cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F769i-disco - is there a way to tell if the board is connected to USB like by using vbus or another facility?

jhanc.11
Senior

I'm really trying to tell if the board is connected to an external comm port to turn off usart sends so they don't potentially backup and slow things down. I know other products expose thinks like vbus sensing? Don't know much about it. I tried to find it in the board support code but unless there is another include file, I haven't had any luck.

Thanks

5 REPLIES 5
TDK
Guru

You can route VBUS to a GPIO pin (typically with a resistor bridge) and monitor that. If it disappears, de-initialize the USB. The schematic would show if this is done on that board.

If you feel a post has answered your question, please click "Accept as Solution".
jhanc.11
Senior

I saw some things about that yesterday and that 's pretty easy to implement. The real issue, and I don't know if so on the stm boards, but on an arduino, if you send data that isn't received, further sends will start backing up and slowing down the processor mainline. Now that I think about it more, I think what I'm really looking for is something to tell if nobody is listening on the virtual comm port. I looked at the usart registers as I brought up and down a serial monitor and they didn't seem to change. Maybe I need to implement some kind of flow control.

jerry

TDK
Guru

If you're talking about the VCP provided on ST-boards, there's no way for the chip to know if the other end is connected. The signals get converted to UART signals.

If the other side isn't connected, the signal will still be sent.

If you feel a post has answered your question, please click "Accept as Solution".
jhanc.11
Senior

I can test this, but what about the transmit timeouts? Do they expire if the device on the other end of the vcom port don't receive them? Short of the other device sending an ack of some type, can you think of another way using the vcp to accomplish this?

Data is still sent if the other side isn’t listening. It will not time out. You have no way of knowing if the other side is listening barring an ack system or external flow control.
If you feel a post has answered your question, please click "Accept as Solution".