Generate .TXT file via USB

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

Generate .TXT file via USB

1,050 Views
ezequielwortman
Contributor I

Hi! I'm using a KWIKSTIK board and I'm trying to generate a .txt file (which could contain a log of ADC's measures, for example) via USB. I have experience with the board, MQX and a bit of USB theory, but honestly, I don't know how to do it, besides creating a driver and having the computer recognize the device. I think it should be a CDC device, but I wanted to ask you if you could give me some pointers, examples or documents I could read regarding USB communication and creating files in the computer's desktop (for example) via USB from the board.

Thanks!!

Ezequiel

Labels (2)
Tags (1)
0 Kudos
6 Replies

773 Views
ezequielwortman
Contributor I

Hi Monica and Erich,

Thanks! It gave some ideas!

Erich: Could you give example(s) of terminal programas I could use? Also, if possible, any more info on how should I "dump" the info to a terminal?

Thanks!

Ezequiel

0 Kudos

773 Views
BlackNight
NXP Employee
NXP Employee

Hi Ezequiel,

I'm using the Termite (Freeware, www.compuphase.com) which has a logging plugin.

Erich

0 Kudos

773 Views
ezequielwortman
Contributor I

Hi Erich,

i)I've been working on this for a while, so far i've read some of the articles on mcuoneclipse related to this:

http://mcuoneclipse.com/2012/03/10/usb-or-not-cdc-with-processor-expert/

http://mcuoneclipse.com/2012/10/07/tutorial-usb-cdc-with-the-kl25z-freedom-board/

I've downloaded the stack, added the bean FSL_USB_STACK to a new project and compiled it. I'm trying to adapt the clock configuration to the kwikstik in order to get the 48 Mhz for USB(file:///C:/ProgramData/Processor%20Expert/CWMCU_PE5_00/Beans/FSL_USB_Stack/FSL_USB_Stack.html) but, despite achieving 48 Mhz the computer does not recognize the board at all. At first there was a message of USB device not working properly (when I didn't touch the clock) but when I modified it I'm not receiving any messages from the host.

Do you have any experience with this or know how to make it work properly?

ii)Also, I had to modify the example code when declaring buffers:

static uint8_t cdc_buffer[USB1_DATA_BUFF_SIZE];

static uint8_t in_buffer[USB1_DATA_BUFF_SIZE];

when I try to compile this I get the following message: "data type is incomplete". I chose to put [10] instead and it compiles, I don't know if this has to do with the device not being enumerated.

Thanks for everything, any info is welcomed!

Ezequiel

0 Kudos

773 Views
BlackNight
NXP Employee
NXP Employee

Hi Ezequiel,

I stopped using my Kwikstik: the k40 on my board was an early mask set, and the boards have different revisions too, and the USB did not work at all even with the Freescale examples. Not sure if it really was the example or the boards. You might check the board errata and the silicon erratas too.

So it could be that you face the same issues with the USB not working properly. I had it working without problems with the K40 on the Tower Module.

The error you see I think is not related to the enumeration, but try to use 64 instead of 10.

I'll see if I can dig out my kwikstik board and give it a fifth (?) chance ;-)

0 Kudos

773 Views
Monica
Senior Contributor III

Hello Ezequiel,

Were this hints helpful?

Pleas let us know :smileywink:

Best,

Monica.

0 Kudos

773 Views
BlackNight
NXP Employee
NXP Employee

What comes to my mind:

- using USB CDC and dump the values to a terminal. Many terminal programs can save the output to a file automatically

- using USB MSD Host and use a memory stick. This requires that the board supports host mode (which I think might not be possible with the Kwikstik)

  I did this approach with the FRDM-KL25Z, FreeRTOS, USB MSD host stack and the FatFS file system: USB MSD Host for the Freedom Board

I hope this helps.