- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm making improvements to my custom Term component.
I've got a modest work-around to determine if the host port is open. I'd like to improve upon that.
The goal: Quickly determine if the Host port is open and ready to comm or if the host port is closed and DO NOT try to transmit.
Note: USBUART_CDCIsReady() will not work in this instance since it will always return 'not ready' if the Tx buffer is full OR if the HOST port is NOT opened.
I've gone through the datasheet, the USBUART component source code, and made some experimental code. All to no luck.
Is there an API or Global variable that indicates whether the Host port is open?
Thanks in advance for your help and suggestions.
"Engineering is an Art. The Art of Compromise."
Solved! Go to Solution.
- Labels:
-
PSoC3 MCU
-
PSOC5 LP MCU
- Tags:
- usb host
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rodolfo,
In my case, I never get the USBUART_wValueLoReg = 0 for some reason. Your results do make more sense.
According to what I have read the USBUART_wValueLoReg in this request is suppose to contain the flow control signaling bits from the host. Only DTR and RTS are defined for now with '0' being "No Flow Control".
Another thing I noticed is that when I closed the port, there are two requests to update the lineControlBitmap[], while when opening the port, there is only one. Also, when opening the port, it does have some additional requests to read/write.
The multiple requests are not unusual. It's host dependant.
My own terminal program sends out about 4 to 5 requests (I should check into that).
I also use Termite. It sends out two requests. (Termite has "None, DTR and RTS" flow settings).
I also use the default Windows 10 terminal host program called "Terminal". It has NO flow control and is extremely simple. It only sends one request.
As I mentioned before, I think you can create a state machine to track the sequence of actions on the dispatcher, so it could eventually move from one state to other. It could have four states:
- Port is open
- Opening port
- Closing port
- Port is closed
I want to detect one of three conditions:
- Port Opened
- Port Closed
- USB comm active. (Cable connected)
I can detect USB comm active is detected by the presence of a 1ms SOF pulse. This is easily supported with enabling the SOF ISR. If I miss 3 pulses, I can assume the port is closed.
I have studied the PSTN V1.2 of the USB CDC spec. Using this protocol, I have not conclusively detected a signal being passed from the host to device to indicate port open or port close at the host side.
"Engineering is an Art. The Art of Compromise."