This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Smartcard USB application

Hello,
Im writing a usb communication tool on the LPC2368 for smartcard devices. I still don't get any communication between the host and the smartcard device for couple of weeks know. It seems like the program is be missing something and i dont know what.

Do you Know where I can find any smartcard USB application for arm7 microcontroller?

Can anybody help me on it? If necessary I will post the fully commented code that I have written.

Thanks in advance

Parents
  • > The Interrupt IN seems to work, since I can catch the IN message in the USB Sniffer but the BULK endpoints don't work!!

    The interrupt IN EP is always polled by host to notify event from the device.
    When you write some data to the EP, it is always sent to host at the next interval.

    Bulk IN/OUT EP are used to exchange command - response.
    Until host sends a command to the device over bulk OUT EP, no data (response) is transfered from bulk IN EP.

    I recommend you to establish the descriptor first.
    Wrong parameters on the descriptor may block the operation over bulk OUT/IN.



    > Yes I have verified the reader is bus-powered!

    I pointed out REMOTE WAKEUP bit, not the self/bus-powered bit.
    As you set remote-wakeup bit to 1, host will send Set_Feature( DEVICE_REMOTE_WAKEUP ) and Clear_Feature( DEVICE_REMOTE_WAKEUP ) requests.
    When your device fails to handle these requests, the connection is cut off.

    If you don't use remote wakeup on your device, change bmAttributes field of the config descriptor from 0xA0 to 0x80

    #define WBVAL1(x) ((x >> 24) & 0xFF), ((x >> 16) & 0xFF), ((x >> 8) & 0xFF), (x & 0xFF) //DWORD to 4 bytes
    

    The endian is reversed. USB takes little endian - low-byte first
    Fix it, as follows,

    #define WBVAL1(x) (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF) //DWORD to 4 bytes
    

    The #defines for Smartcard Class Descriptor are messed up, anyway.
    As the start point, copy the values from the CCID example of ST micro.
    After realizing more about this class, modify it as you like.

    Tsuneo

Reply
  • > The Interrupt IN seems to work, since I can catch the IN message in the USB Sniffer but the BULK endpoints don't work!!

    The interrupt IN EP is always polled by host to notify event from the device.
    When you write some data to the EP, it is always sent to host at the next interval.

    Bulk IN/OUT EP are used to exchange command - response.
    Until host sends a command to the device over bulk OUT EP, no data (response) is transfered from bulk IN EP.

    I recommend you to establish the descriptor first.
    Wrong parameters on the descriptor may block the operation over bulk OUT/IN.



    > Yes I have verified the reader is bus-powered!

    I pointed out REMOTE WAKEUP bit, not the self/bus-powered bit.
    As you set remote-wakeup bit to 1, host will send Set_Feature( DEVICE_REMOTE_WAKEUP ) and Clear_Feature( DEVICE_REMOTE_WAKEUP ) requests.
    When your device fails to handle these requests, the connection is cut off.

    If you don't use remote wakeup on your device, change bmAttributes field of the config descriptor from 0xA0 to 0x80

    #define WBVAL1(x) ((x >> 24) & 0xFF), ((x >> 16) & 0xFF), ((x >> 8) & 0xFF), (x & 0xFF) //DWORD to 4 bytes
    

    The endian is reversed. USB takes little endian - low-byte first
    Fix it, as follows,

    #define WBVAL1(x) (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF) //DWORD to 4 bytes
    

    The #defines for Smartcard Class Descriptor are messed up, anyway.
    As the start point, copy the values from the CCID example of ST micro.
    After realizing more about this class, modify it as you like.

    Tsuneo

Children
No data