USB vcom read write problem sdk 2.3 MK21FN1M0xxx12

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

USB vcom read write problem sdk 2.3 MK21FN1M0xxx12

6,603 Views
cristianpietrob
Contributor I

Hi everyone,

I'm having trouble making the vcom example work as expected.

I implemented the read/write blocking functions, but sending long data packets (chunked at 56-byte block consecutive transfer)
presents some problem.

Example Terminal output:

pastedImage_1.png

/* main example using freertos */

/* Init board hardware. */
BOARD_InitPins();
BOARD_BootClockRUN();

/*init the api usb*/
APPInit();

uint8_t buff[70];
int k = 32;
for(int i=0;i<sizeof(buff);i++){
buff[i] = k;
k++;
}

while(1) {
usb_write(buff,sizeof(buff),100);
usb_write("\n\r",2,100);
vTaskDelay( pdMS_TO_TICKS( 1000 ) );
}


I tried without and with hardware flow control, nothing changed.
I'm using the nxp driver located inside the folder usb_device_cdc_vcom.

OS windows 10

mcu MK21FN1M0xxx12

sdk version 2.3

Same problem under ubuntu (tail -f xxxx)

2 Replies

3,018 Views
mjbcswitzerland
Specialist V

Hi Cristian

Have a go with the free OpenSource uTasker K21FN project - it allows you to do multiple CDCs at the same time and uses code from industrial implementations that have been proven during several years of extensive service.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
Kinetis K21:
- http://www.utasker.com/kinetis/TWR-K21F120M.html

USB: http://www.utasker.com/docs/uTasker/USB_User_Guide.PDF
USB composites: http://www.utasker.com/kinetis/USB_Device.html
USB-CDC host<->device video: https://www.youtube.com/watch?v=XhISV1czIo4&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&index=16

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

Professional Kinetis support, one-on-one training and complete fast-track project solutions: http://www.utasker.com/support.html

3,018 Views
cristianpietrob
Contributor I

Thank you, Mark, in the end, it was a Qt bug + a problem with the USB driver.

I'm sharing the code the solve everyone else similar problem.


0 Kudos