Quantcast
Channel:
Viewing all articles
Browse latest Browse all 59170

Forum Post: RE: USB file transfer in microcontrollers flash memory

$
0
0
Hi Peter. Here is how I would go about it. Use the package R01AN2296EJ0102 (PCDC), or the PCDC package that is not "FIT" same reasoning below applies. In r_usb_pcdc_apl.h , set CDC_APL_MODE_PP to ECHO_PP. Connect your board to the PC and start your favorite terminal program and connect it to the COM port that popped up (Device Mgr). Here is how the demo works, and how to go about changing it: When data is typed into the terminal, data is received in the demo, in file  r_usb_pcdc_echo_apl.c,  via the USB callback-function  cdc_read_complete() . It is then echoed back to the terminal, which you don't want, so you will have to get rid of that when you are comfortable with how the demo works.  After echoing (sending) the received data[=one typed byte since you type so slow] the demo state machine ends up calling R_usb_pcdc_ReceiveData() to order USB to receive the next data. In your case, you just call this function over and over again to receive the whole file. You will be receiving 64 bytes at a time I believe. (Bulk max packet size). Again, get rid of all the stuff you don't need from the demo. (Actually, change the filename too since it is misleading.) If cdc_read_complete() stops firing, you probably missed calling   R_usb_pcdc_ReceiveData() again. Use your favorite terminal program to download a file. (File= Download/Send). Once you know how to write the file to a RAM buffer, you could write to flash instead.

Viewing all articles
Browse latest Browse all 59170

Trending Articles