Author Topic: USB CDC Uart  (Read 15556 times)

Offline CarlMLE

  • Newbie
  • *
  • Posts: 5
    • View Profile
USB CDC Uart
« on: April 15, 2009, 10:06:08 AM »
Hi,

I have SP4 up and running and the USB Enumerating. The debug interface works over the UART so I'm happy.

My question, whats the best way of writing a task to use this new CDC port. I've followed your utaskerUart.pdf previously to get another UART sending and receiving my own protocol. Whats the best way to do it with USB CDC Uart. So that I can control it and not have the uTaskers debug interface/menu.

Also, if i wanted to remove the uTasker Menu from all uarts (0,1 and debug) and handle the coms from my own tasks how do I do it? I Tried removing the DEMO_UART define but this doesn't compile as its required by fnSetNewSerialMode in application.c.

Thanks
« Last Edit: April 15, 2009, 10:18:53 AM by CarlMLE »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3240
    • View Profile
    • uTasker
Re: USB CDC Uart
« Reply #1 on: April 15, 2009, 11:35:20 AM »
Hi Carl

Demo UART:
In some SP versions of the project doesn't compile/link when the define DEMO_UART is removed. This has been solved in the development project but will only be fully integrated in future SPs. However this is easy to fix: when the linker is failing due to a routine being missing, add the conditional statement around this routine:
#if defined SERIAL_INTERFACE && defined DEMO_UART
extern QUEUE_HANDLE fnSetNewSerialMode(unsigned char ucDriverMode)
{
...
}
#endif


This will allow you to free up all UARTs for your own use.


USB CDC:
Did you already check out the USB User's Guide: http://www.utasker.com/docs/uTasker/USB_User_Guide.PDF ?
The USB interface, as configured in the demo project, can be used (almost) identically to a UART interface. When the enumeration is successful you can then use the interface handle (USBPortID_comms) to write data to and read data from the USB connection using the same fnWrite() and fnRead() functions.

In the USB task (extern void fnTaskUSB(TTASKTABLE *ptrTaskTable)) USB receptions are being handled by passing them to the command line menu input. This is taking place in the block beginning with

    while (fnMsgs(USBPortID_comms) != 0) {                               // reception from endpoint 1

you can remove the content of this block and add your own protocol handling there, in the same manner as you do from the serial interface - it should be compatible. In your protocol transmission routines simply replace the serial handle with the usb handle and this should also be compatible.

Regards

Mark