LPCOPEN usbd_rom_cdc example RTS/DTR

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPCOPEN usbd_rom_cdc example RTS/DTR

1,306 Views
philipchampagne
Contributor I

I am using the usbd_rom_cdc example to and the LPC11U68 to create a device that gets accessed via a COM port on the computer. I am using the Xpresso-LPC11U68 board and MCUXpresso IDE v10.2.0.

Here are the issues I am having:

1. I am a novice at writing code for embedded USB devices.

2. I altered the usbd_rom_cdc example and now have it so DTR will trigger the VCOM_SetCtrlLineState function but RTS does not trigger it.

3. I need a way to see when the COM port has opened and closed so that the program will only transmit something out when the COM port is open.

Here are my questions:

1. Does anyone have a good reference where I could read up on developing embbedded USB devices using the CDC class?

2. Does anyone know how I can configure the usbd_rom_cdc example so that when RTS is toggled it triggers the VCOM_SetCtrlLineState function?

3. Does anyone know how I can read when the COM port has opened or closed in the usbd_rom_cdc? 

Labels (6)
0 Kudos
Reply
5 Replies

971 Views
philipchampagne
Contributor I

TIC,

Here is how I test DTR and RTS:

Using the example I added the following line in the vcom_init function
cdc_param.SetCtrlLineState = VCOM_SetCtrlLineState;

I then added the following function:

/* Called when DTR is toggled. */
static ErrorCode_t VCOM_SetCtrlLineState(USBD_HANDLE_T hCDC, uint16_t state)
{
// state = 0 when DTR = CLR and RTS = CLR
// State = 1 when DTR = CLR and RTS = SET
// state = 2 when DTR = SET and RTS = CLR
// state = 3 when DTR = SET and RTS = SET
uint8_t intDTRState = 0;
intDTRState = state & 1;

Board_LED_Set(BLUE_LED, intDTRState);
return LPC_OK;
}

I place a break point at "Board_LED_Set(BLUE_LED,intDTRState); after I open the COM port using "Realterm". I then go to the "Pins" tab in Realterm and toggle the RTS line. The program continues to run. I then toggle the DTR line and the program stops at the break point. On page 58 table 51 of the "usbcdc11.pdf" document it states "The device ignores the value of this bit when operating in full duplex mode." This is for RTS.  I am guessing that I need to set the device to half duplex mode but I can't find anything that says how to do this. 

0 Kudos
Reply

971 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Philip Champagne,
Thanks for your reply.
I was wondering if you can capture the USB transaction and share it, it may provide me the more information about this issue.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

971 Views
philipchampagne
Contributor I

TIC,

I found that the problem with RTS may not be the example program but it might be the usbser.sys with Windows. USBSER.SYS quirks explained 

RTS does update but only when DTR updates. This is just a little bit frustrating. 

0 Kudos
Reply

971 Views
philipchampagne
Contributor I

Tic,

I will get you the information as soon as I can. I have to finish up a different project and it might be a little while before I get back to this one. 

Have a great day,

Phil

0 Kudos
Reply

971 Views
jeremyzhou
NXP Employee
NXP Employee

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1. Does anyone have a good reference where I could read up on developing embedded USB devices using the CDC class?
-- Please checking the attachment.
2- 2. Does anyone know how I can configure the usbd_rom_cdc example so that when RTS is toggled it triggers the VCOM_SetCtrlLineState function?
-- Callback function is provided by the application software. I have no idea the testing process you did, so I was wondering if you can describe it.
3. Does anyone know how I can read when the COM port has opened or closed in the usbd_rom_cdc?
-- I think the notifications feature can implement it and you can learn the more detailed information about this feature in usbcdc11.pdf, section 6.3.5


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply