basic USB project

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

basic USB project

484 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by L.simon on Fri Feb 28 09:24:38 MST 2014
Dear,

I am trying to find a basic USB example project to simply be able to transfer a bit from the PC to the LPC4357 for example to set a byte to a GPIO port.
I found some examples to do so (LPCopen) but they were not compatible to CMSIS, i need one that is so i can afterwards run it on freeRtos. I also found an example that only works on keil (http://www.lpcware.com/content/project/lpc43xx-dual-core-examples), the project is a .uvproj file and i work with redsuite/LPCXpresso. after trying to make a new project in red suite and adding the files manually there seem to be lots of problems.

Does someone know an easy way to convert .uvproj files to .cproject files?
Or even better, a USB project that runs on red suite (or LPCXpresso) for my LPC4357FET256?

Thank you for your time,

Greetings,
Simon
Labels (1)
0 Kudos
3 Replies

355 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by L.simon on Fri Mar 28 05:58:53 MST 2014
Found it!!

in the function CDC_Device_SendData() the parameter CDCInterfaceInfo->State.LineEncoding.BaudRateBPS is needed, if it is deleted out of the function, the program works!

My CDC program now runs without using the serial part and only the bulking part!
0 Kudos

355 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by L.simon on Fri Mar 28 02:57:36 MST 2014
thank you for your reply,

I am now using the nxpUSBlibV0.98b and got the HID working but after some time working with it i realized i needed bulking tranfers.
So i started using the CDC example and tested it with a hyperterminal and it works.

The problem is that i want to use the pyUSB project to communicate with the program,
Sending bulk transfers to the device works perfectly and i can send multiple transfers.
But from the moment i start to try to read something out, the python program gives me a timeout error.
I have a usb sniffer Beagle USB480 which tells me that i do send a read request to my device but the device doesn't seem to give the data.
I tried constantly sending data from the device(it works with the hyperterminal) and reading it with the python program, the same thing happens, i do get the read request in beagle but they give "IN-NACK", the pyUSB uses an other driver (libUSB-win32) than the hyperterminal.
But i don't think that is a problem because the write command does work.

is there something specific i need to do before reading? maybe some sort of configuration or setup?
i dont think so for i have no specific one with the hyperterminal.

i think it might because the read command and the command to put data on the bus are not synchronized?
That does happen with a write command

if(CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface))
{
recv_byte[0] = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
                CDC_Device_SendData(&VirtualSerial_CDC_Interface, (char *)recv_byte, 1);
}

in python i read directly after the write command.


basically the serial connection is not needed but i do need bulking to work.


is anyone able to help me?
thank you for your time,

Greetings,
Simon
0 Kudos

355 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Fri Feb 28 10:57:16 MST 2014
You need to decide what type of USB device you want to implement.
all OS provide class drivers for HID, CDC, and some others, but you are most likely going to choose HID or CDC.
HID might be preferred, it is used for keyboard, mouse, and indicators (send a byte to a GPIO)
CDC is a serial port emulator class, but you could define your own protocol and write a parser on the LPC side that operates the protocol

0 Kudos