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

Combining examples keil_usbmem and sdcard_poll on lpc3131

Hi,

I'm trying to develop an usb mass storage memory key by combining two examples : one from NXP (keil_usbmem) and one from embedded artists (sdcard_poll).

Each examples taken separately works well. However if I try to combine them, the usb memory example do not work anymore.

In function MSC_MemoryRead I do the following :

mci_read_blocks(g_mcidev, BlockDevBuff, Offset, Offset);
USB_WriteEP(MSC_EP_IN, &Memory[Offset], n);

So I perform a read on my MMC card (that is well acquired with mci_open and so on), but I discard the data from my MMC and I put the RAM image content instead (just like the original keil_usbmem code).

If I remove the mci_read_blocks function everything works again.

In order to discard an USB timeout problem,I tried also to put a (very) long blocking timer instead of mci_read_blocks. Even with this long timer the code works well.

So I think that something is incompatible in the MCI and USB codes. Maybe, a timer or a memory region, is mistakenly shared between those codes. I search for such ''bug'' in the code but I don't succeed.

Do you have any idea ?

Best regards

Parents
  • I finally found out the problems.

    1) There was a mistake in my code (a buffer too small for a transfert).

    2) The evaluation version of µVision do not support well the LPC3131, so I had to modify memories areas.

    However there is still some problems :

    1) the resulting USB key do not work on linux (ehci_hcd kernel module must be remove)

    2) the transactions over the mci interface are slow (but maybe this is due to the SD card I use)

Reply
  • I finally found out the problems.

    1) There was a mistake in my code (a buffer too small for a transfert).

    2) The evaluation version of µVision do not support well the LPC3131, so I had to modify memories areas.

    However there is still some problems :

    1) the resulting USB key do not work on linux (ehci_hcd kernel module must be remove)

    2) the transactions over the mci interface are slow (but maybe this is due to the SD card I use)

Children
No data