FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:



Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


Author Topic: File created_no data in USB pendrive -VNC2-32L1C  (Read 101 times)

Rajavelu

  • Newbie
  • *
  • Posts: 6
    • View Profile
File created_no data in USB pendrive -VNC2-32L1C
« on: December 04, 2018, 06:00:25 AM »

Dear Sir,
We use the VNC2-32L1C USB Host controller for controlling 2 USB devices(USB Pen-drive & USB Keyboard) simultaneously through single UART. I’m able to detect both devices on both ports, but data is not available in the file created on pen-drive. Please refer the attachment for reference.
•   Is data in-availability on pen-drive - due to single thread creation(USB_Check)/lack of separate stack memory?, i.e no memory created separately for setup, UART and BOMS. In such case what is the minimum and maximum stack size should i use for USB_Check thread.(Refer attachment)
•   What is the maximum stack size available for VNC2-32L1C. Minimum and maximum stack size to be used by pen-drive and keyboard functions and how they are calculated?
•   In order to detect which device is connected on which port, created a thread and using getDescriptors checked the port status.(Refer Attachment).Both devices were connected and appropriate configured leds were ON indicating the working of the function.
•   But when i call the function of the respective devices, the USB Keyboard works on both ports but with USB Pen-drive a file is created but no data within. The same functions of Pen-drive namely Setup,UART,BOMS were used separately without checking port status and device, but created 3 threads separately the  data is copied into file.
•   Through debugging it was found the data was present in the buf1 during fwrite operation but after fwrite on halt the cursor stops at assembly window
fwrite(buf1, (size_t)pBuf1, sizeof(char), file);

Kindly do the needful.

Best regards,
Rajavelu Balasubramanian
9841136718
LCS Controls Pvt., Ltd.,
Chennai.
Logged

FTDI Community

  • Administrator
  • Full Member
  • *****
  • Posts: 184
    • View Profile
Re: File created_no data in USB pendrive -VNC2-32L1C
« Reply #1 on: December 04, 2018, 10:46:06 AM »

Hello,

The controllers in some flash drives don't commit a file fully to their flash array correctly unless you do either a dummy open-close operation (i.e. finish data, close, open and close) or call fat_fileFlush(). If you see the file but the content isn't there, then one of these should help.

Best Regards, FTDI Community
Logged

Rajavelu

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: File created_no data in USB pendrive -VNC2-32L1C
« Reply #2 on: December 05, 2018, 04:15:50 AM »

Hi
Thanks for the response.

I have used fclose(file); while creating separate threads for setup, uart, boms it worked. But when i used getdescriptors and check condition and then call the function i face this issue.

Please share the stack size calculation for a thread. How does 1024 bytes arrived. Any specific calculation ??

Regards
Rajavelu Balasubramanian
« Last Edit: December 05, 2018, 07:02:03 AM by Rajavelu »
Logged

FTDI Community

  • Administrator
  • Full Member
  • *****
  • Posts: 184
    • View Profile
Re: File created_no data in USB pendrive -VNC2-32L1C
« Reply #3 on: December 05, 2018, 10:17:16 AM »

Hello,

You can find details on threads and resources in these application notes below and you can use the Thread Manager to check usage.

https://www.ftdichip.com/Support/Documents/AppNotes/AN_169_Vinculum_II_RTOS_Using_the_Kernel_Diagnostic_Service.pdf

https://www.ftdichip.com/Support/Documents/AppNotes/AN_157_Vinculum%20II%20Memory%20Management.pdf


Best Regards, FTDI Community


Logged

Rajavelu

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: File created_no data in USB pendrive -VNC2-32L1C
« Reply #4 on: December 08, 2018, 04:56:06 PM »

Hi

  Now i'm able to copy the data into pendrive. I have given a delay of 2000 milli seconds at receiving end in the UART function

// get bytes available...
uart_iocb.ioctl_code = VOS_IOCTL_COMMON_GET_RX_QUEUE_STATUS;
vos_delay_msecs(2000);   //delay to overcome data issue in pendrive
vos_dev_ioctl(hUART, &uart_iocb);

Is this the right way to do it, will it have any effects on other operations? Because i didn't use any delay here when i created three threads separately namely setup,uart and boms

And why im not able to use delay(milliseconds); function here and whats the key difference between vos_delay_msecs(millisecs); and delay(millisecs);
------------------------------------------------------------------------------------------------------------------------------------------------------

And now when i connect keyboard on port1 and then disconnect and insert pendrive-im able to do data copying but when i do vice versa im not able to do it. and similarly if i disconnect pendrive and re insert im not able to copy data.

how to resolve this issue?
Logged