FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  


Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support

New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.

Messages - Rajavelu

Pages: [1]
I have three threads namely setup,UART,BOMS for USB pendrive
One thread called firmware for  USB Keyboard
One thread called Device_Check to detect port status and corresponding device.

   tcbDevice_Check = vos_create_thread_ex(26, 1024, Device_Check, "Check", 0);
        tcbFIRMWARE     = vos_create_thread_ex(25, 4096, firmware, "Application", 0);
        tcbSETUP           = vos_create_thread_ex(24, 1024, setup, "Setup", 0);
   tcbUART             = vos_create_thread_ex(23, 1024, UART, "Read", 0);
   tcbBOMS            = vos_create_thread_ex(23, 1024, BOMS, "Write", 0);

If suppose Keyboard is detected on my port, how to use/call the firmware thread and similarly how to use/call the setup,uart,boms thread?

Please provide me an idea of how to move from one thread to other

Rajavelu Balasubramanian

->VNC2-32L1C - single UART- i have configured USB Pendrive to Port1 & USB Keyboard to Port1 & Port2.

->I'm able to operate keyboard alone on my device separately(i.e) either Port1 or Port2 one at a time
 and similarly USB Pendrive separately(i.e) Port1

       USB Keyboard on Port2(Port1 is not connected with any device). Transmits from keyboard  ( Vinculum to main controller )
       I wish to use USB pendrive now on Port1. But i'm forced to remove the Keyboard on Port2 for the data copying of Pendrive in port1

I wish i shouldn't remove the keyboard while i connect pendrive. How to resolve the issue. 

Please help me with this issue.


  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?

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 ??

Rajavelu Balasubramanian

Discussion - Software / 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
LCS Controls Pvt., Ltd.,

Discussion - Software / Prioritizing the threads
« on: November 20, 2018, 05:28:32 AM »
I have the following threads being used for USB Pendrive
        tcbSETUP = vos_create_thread_ex(25, 1024, setup, "Setup", 0);
   tcbUART = vos_create_thread_ex(25, 1024, UART, "Read", 0);
   tcbBOMS = vos_create_thread_ex(25, 1024, BOMS, "Write", 0);

and following thread for USB Keyboard
    tcbFIRMWARE = vos_create_thread_ex(25, 4096, firmware, "Application", 0);

Will the vos_start_scheduler schedules the thread  so that the threads being created will run forever?

I have combined both of them so the setup,uart,boms goes on fine and so the firmware doesn't work at all, i suspect the process is within those three threads alone. How to make all threads work?

Kindly clarify the following

1) what does "usbhost_connect_state" returns?( thought i can use it in void main(void) to create threads which is only necessary
2)Is it possible to provide me a sample code of operating two USB host ports at a single time. Preferably Pendrive or keyboard
3) I have used the following threads
   ->for USB Memory stick(Pendrive)
        tcbSETUP = vos_create_thread_ex(25, 1024, setup, "Setup", 0);
   tcbUART = vos_create_thread_ex(24, 1024, UART, "Read", 0);
   tcbBOMS = vos_create_thread_ex(24, 1024, BOMS, "Write", 0);
   ->for USB Keyboard
   tcbFIRMWARE = vos_create_thread_ex(25, 1024, firmware, "Application", 0);   
inside void main(void)    
4) If i use both set of threads only Pendrive works on port1 but keyboard doesn't work on port2(intention is to make usb pendrive work on port1 and keyboard on port2). If i comment either set of threads the other one works fine

I also found that memory plays an issue here i think since i have used 1024 to all, it is working for only the first port. Is it so?
i have used tcbFIRMWARE = vos_create_thread_ex(31, 512, firmware, "Application", 0); alone  but  keyboard didnt work at all
does my priority makes the issue or the memory????
5) Under UART2DSC.h
 i have define the following
#define VOS_DEV_USBHOST_1 0
#define VOS_DEV_USBHOST_2 1
#define VOS_DEV_UART 2
#define VOS_DEV_BOMS 4


( Is it correct)
Pls find the UART2DSC.C & .H files

  Good Day!!
      i'm using Vinculum II 32 pin package- i have working codes for 2 slaves (USB port and USB Flash drive ), but they are  2 separate codes and will work only on one  USB port.
     Our aim is to Configure USB Keyboard on one USB port and USB Flash drive on other USB port, and the next step would be connecting two slaves on either of the USB ports.

PS: Took the help of precompiled firmware for separate codes but i dont find precompiled firmware for configuring 2 ports at same time.

Rajavelu Balasubramanian

Pages: [1]