Reply by Yusuf Husainy July 15, 20132013-07-15
Hello Tsuneo,

I appreciate your reply, thank you.

I will work on this more and see what happens.

Will keep this thread updated with my findings.

Regards,
Yusuf Husainy.
________________________________
From: t_chinzei
To: l...
Sent: Monday, 15 July 2013 2:56 AM
Subject: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

 
Hi Yusuf,

> as I am using only two endpoints, each of which has maximum packet size of 64 bytes, I would be using only 128 bytes of the USB-RAM

Sound like your firmware always enables USB-DMA on the bulk IN/OUT endpoints, and USB-DMA transfers just single packet.

1) You may switch DMA/slave mode on the fly by USBEpIntEn register. Just at the data transport stage of READ10 and WRITE10, corresponding bulk endpoint (IN or OUT) is set to DMA mode. In this way, these two endpoints share the same DMA buffer on the USB RAM, because READ10 and WRITE10 never occur simultaneously.

2) Single DMA Descriptor (DD) can exchange multiple USB packets. Sector size, usually 512 bytes, (and buffer of this size) is assigned to a DD. In this way, the double buffer of the bulk endpoints work effectively to speed up the transfer.

3) You may place two or more sector-size buffers on the USB RAM, so that MCI (SD/MMC IF) works on another buffer, while USB exchanges data on a buffer.

> this function has a limitation to format at max 32KB storage.

Huh?
You are mixing up cluster size with volume size.

"Default cluster size for NTFS, FAT, and exFAT"
http://support.microsoft.com/kb/140365/en-us

Tsuneo

--- In l..., Yusuf Husainy wrote:
>
> Hello All,
>
> Yes I can share the project with this forum. Will upload it soon.
>
> Some further issues that I am facing are:
> 1. The speed of transfer of files from/to the sd-card is very slow. A 10 MB file copied from my desktop and pasted to the sd-card took 6 minutes for the transfer. However, I did some more work and tried enabling DMA transfer. This reduced the duration of the transfer to 3 minutes!!, a 50% improve. Although the USB-RAM(8KB) and the DMA are shared, I realized, as I am using only two endpoints, each of which has maximum packet size of 64 bytes, I would be using only 128 bytes of the USB-RAM, so the rest can be used by DMA itself. Then also, a 3 minute duration is too much for a 10MB file!!!
>
> 2. I did some study and came to know, as Mike had said, the volume label is in the filesystem partition table. So I looked into Chan's FatFs code, specifically the f_mkfs() function in ff.c . This, if I am not wrong, formats the sd-card and creates a new partition specified by the "allocationsize"  argument to this function. We can then specify our own volume label. But the problem is, if I am correct, this function has a limitation to format at max 32KB storage. So if I want to format the whole 1.83GB volume, it wold not be possible with this function. So what workaround can I do with this?
>
> I appreciate everyone's help and response.
>
> Regards,
> Yusuf Husainy.
>
>
> ________________________________
> From: Michael Anton
> To: l...
> Sent: Friday, 12 July 2013 1:17 PM
> Subject: RE: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
>
>
>
>  
> The volume label is stored in the root directory, not in an SD card register. If you want to change it, you just need to write a new one. Wikipedia has some information on how this is stored.
>
> Mike
>
> -----Original Message-----
> From: l... [mailto:l...]On Behalf
> Of Yusuf Husainy
> Sent: Wednesday, July 10, 2013 11:17 PM
> To: l...
> Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card
> attached on a custom board.
>
> Hello All,
>
> I have finally done it!!
>
> The sd-card is detected by Windows as 1.83GB volume showing all the files on it. I can read and write to it also. I can cut, copy and paste data to and from the sd-card too!!!
>
> The problem was, I has nested interrupts disabled as soon as a USB interrupt occured. So the sd/mmc unit of lpc2368 was unable to interrupt the processor core. I enabled interrupts at the start of the udb isr, and then disabled just before the ISR returned.
>
> Everything is working great now!!
>
> Onlly, I would like to change the volume name of the sd-card. I know I can do it on Windows, but how would I do it in code, I mean what register or something would I have to program of the sd/mmc unit to change the volume name when it is detected by Windows?
>
> I appreciate everyone's help and response.
>
> Regards,
> Yusuf Husainy.
>
> ________________________________
> From: Yusuf Husainy
> To: "l..."
> Sent: Monday, 8 July 2013 5:27 PM
> Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
>
>
> Hi all,
>
> I have made some progress. I was successful in reading from the sd card while DMA is disabled and also I shifted the src and dest addresses which were used to write to and read from the MCI FIFO respectively, to the normal RAM from the USB-RAM.
>
> Now, should it be that I should call the low level disk api disk_read() when a MSC_MemoryRead() request comes from the host(i.e., SCSI_READ requests?). I am asking this because,. when i call disk_read() from MSC_MemoryRead(), it necer returns, meaning, the flag it loops for getting cleared never gets cleared by of the interrupt handler. This is beacuse, the interrupt never occurs. So, what I think is that, I should be calling disk_read() in a way that the host would expect, not as Chan's FATFS f_read() would expect. Am I correct here?
>
> I mean, what way should I read data from the disk_read(), so that the host would expect it to be in a correct format?
>
> This does not happen if I use normal f_read() call from my main() function, to read a line from an existing file. An interrupt does occur, and disk_read() returns successfully.
>
> Regards,
> Yusuf Husainy.
>
> ________________________________
> From: Yusuf Husainy
> To: "l..."
> Sent: Saturday, 6 July 2013 4:42 PM
> Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
>
> Oh, I thought it were the links from where i got the code.
>
> OK here are my parts of the code relevant to the problem:
>
> http://pastie.org/8115232
>
> It is a bit long, but most probably easy to grasp.
>
> The thing not working is the copying of the sd/card received data from the MCI FIFO to memory(USB-RAM), when DMA is diabled.
> The pointers,
> volatile BYTE *WriteBlock = (BYTE *)(DMA_SRC); /* treat WriteBlock as a constant address */
> volatile BYTE *ReadBlock = (BYTE *)(DMA_DST); /* treat ReadBlock as a constant address */
>
> actually define the memory region where the received data will be put from MCI FIFO as well as the from where the pick-up of data will be done to write to the MCI FIFO.
>
> These pointers are used as the sole arguments of MCI_ReadFifo and MCI_WriteFifo, implemented as assembly routines in the file readfifo.s(this is given in the above link), when DMA is disabaled, and used as the destination and source addresses when DMA is enabled. This memory region is defined to be in the USB-RAM space as defined in dma.h file here:
> #define DMA_SRC0x7FD00000/* This is the area original data is stored
> or data to be written to the SD/MMC card. */
> #define DMA_DST0x7FD01000/* This is the area, after writing to the SD/MMC,
> // data read from the SD/MMC card. */
>
> If anyone has more questions on the implementation of my code, feel free to ask.
>
> And also, I appreciate everyone's help and response.
>
> Regards,
> Yusuf Husainy
>
> ________________________________
> From: Fx
> To: l...
> Sent: Saturday, 6 July 2013 4:00 PM
> Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
>
> Please post the relevant part of your code to be discussed.
>
> On Sat, Jul 6, 2013 at 3:07 AM, Yusuf Husainy wrote:
>
> > **
> >
> >
> > Hello all,
> >
> > Donald:
> > Here are the links:
> >
> > LPC2368 USB MSC implementation:http://www.keil.com/download/docs/336.asp (I
> > was mistaken, I had got it from the Keil website, not NXP).
> > USB-SD card implementation:
> > http://www.lpcware.com/content/blog/lpcxpresso-lpc11u14-usb-sd-card-exmple
> > SD/FAFTS imlementation: I can't find the exact link but, it is Chan's
> > implementation of the FATFS.
> >
> > Fx:
> >
> > Ok, I see, but my current implementation is based on interrupts itself,
> > meaning, the interrupts received from the sd/mmc subunit of LPC2368. So, I
> > did not get what you meant that you got rid of the DMA transfers and used
> > interrupts. Looking in the lpcware link code above, you can see that when
> > DMA is disabled, we do get interrupts from the sd/mmc subunit. So, what
> > exactly did you do to make it work?
> >
> > Also, I am not calling any of Chan's fatfs API's when an endpoint in/out
> > event occurs. I call directly the lower level disk_read(), when an IN
> > request comes from the host PC.
> >
> > Also, sorry about the most previous thread I posted just before this, it
> > was a duplicate, it got sent to the group mistakenly.
> >
> > Regards,
> > Yusuf Husainy
> >
> > ________________________________
> > From: Donald H
> > To: l...
> > Sent: Friday, 5 July 2013 7:58 PM
> > Subject: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on
> > a custom board.
> >
> >
> >
> >
> >
> > --- In l..., Yusuf Husainy wrote:
> > >
> > > Hi Fx and everyone else,
> > >
> > > Thanks for the help.
> > >
> > > I went through the code in the given link and modified it to suit the
> > LPC2368.
> > >I used the mmc/sdfatfs & USB-MSC implementation from NXP's site
> >
> > Please post the link to this code, Thank You.
> >
> > don
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
>
> --
> /* Jumping Flowers */
>
> [Non-text portions of this message have been removed]
>
>
>
>

An Engineer's Guide to the LPC2100 Series

Reply by t_chinzei July 14, 20132013-07-14
Hi Yusuf,

> as I am using only two endpoints, each of which has maximum packet size of 64 bytes, I would be using only 128 bytes of the USB-RAM

Sound like your firmware always enables USB-DMA on the bulk IN/OUT endpoints, and USB-DMA transfers just single packet.

1) You may switch DMA/slave mode on the fly by USBEpIntEn register. Just at the data transport stage of READ10 and WRITE10, corresponding bulk endpoint (IN or OUT) is set to DMA mode. In this way, these two endpoints share the same DMA buffer on the USB RAM, because READ10 and WRITE10 never occur simultaneously.

2) Single DMA Descriptor (DD) can exchange multiple USB packets. Sector size, usually 512 bytes, (and buffer of this size) is assigned to a DD. In this way, the double buffer of the bulk endpoints work effectively to speed up the transfer.

3) You may place two or more sector-size buffers on the USB RAM, so that MCI (SD/MMC IF) works on another buffer, while USB exchanges data on a buffer.

> this function has a limitation to format at max 32KB storage.

Huh?
You are mixing up cluster size with volume size.

"Default cluster size for NTFS, FAT, and exFAT"
http://support.microsoft.com/kb/140365/en-us

Tsuneo

--- In l..., Yusuf Husainy wrote:
>
> Hello All,
>
> Yes I can share the project with this forum. Will upload it soon.
>
> Some further issues that I am facing are:
> 1. The speed of transfer of files from/to the sd-card is very slow. A 10 MB file copied from my desktop and pasted to the sd-card took 6 minutes for the transfer. However, I did some more work and tried enabling DMA transfer. This reduced the duration of the transfer to 3 minutes!!, a 50% improve. Although the USB-RAM(8KB) and the DMA are shared, I realized, as I am using only two endpoints, each of which has maximum packet size of 64 bytes, I would be using only 128 bytes of the USB-RAM, so the rest can be used by DMA itself. Then also, a 3 minute duration is too much for a 10MB file!!!
>
> 2. I did some study and came to know, as Mike had said, the volume label is in the filesystem partition table. So I looked into Chan's FatFs code, specifically the f_mkfs() function in ff.c . This, if I am not wrong, formats the sd-card and creates a new partition specified by the "allocationsize"  argument to this function. We can then specify our own volume label. But the problem is, if I am correct, this function has a limitation to format at max 32KB storage. So if I want to format the whole 1.83GB volume, it wold not be possible with this function. So what workaround can I do with this?
>
> I appreciate everyone's help and response.
>
> Regards,
> Yusuf Husainy.
>
>
> ________________________________
> From: Michael Anton
> To: l...
> Sent: Friday, 12 July 2013 1:17 PM
> Subject: RE: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
>
>
>
>  
> The volume label is stored in the root directory, not in an SD card register. If you want to change it, you just need to write a new one. Wikipedia has some information on how this is stored.
>
> Mike
>
> -----Original Message-----
> From: l... [mailto:l...]On Behalf
> Of Yusuf Husainy
> Sent: Wednesday, July 10, 2013 11:17 PM
> To: l...
> Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card
> attached on a custom board.
>
> Hello All,
>
> I have finally done it!!
>
> The sd-card is detected by Windows as 1.83GB volume showing all the files on it. I can read and write to it also. I can cut, copy and paste data to and from the sd-card too!!!
>
> The problem was, I has nested interrupts disabled as soon as a USB interrupt occured. So the sd/mmc unit of lpc2368 was unable to interrupt the processor core. I enabled interrupts at the start of the udb isr, and then disabled just before the ISR returned.
>
> Everything is working great now!!
>
> Onlly, I would like to change the volume name of the sd-card. I know I can do it on Windows, but how would I do it in code, I mean what register or something would I have to program of the sd/mmc unit to change the volume name when it is detected by Windows?
>
> I appreciate everyone's help and response.
>
> Regards,
> Yusuf Husainy.
>
> ________________________________
> From: Yusuf Husainy
> To: "l..."
> Sent: Monday, 8 July 2013 5:27 PM
> Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
>
>
> Hi all,
>
> I have made some progress. I was successful in reading from the sd card while DMA is disabled and also I shifted the src and dest addresses which were used to write to and read from the MCI FIFO respectively, to the normal RAM from the USB-RAM.
>
> Now, should it be that I should call the low level disk api disk_read() when a MSC_MemoryRead() request comes from the host(i.e., SCSI_READ requests?). I am asking this because,. when i call disk_read() from MSC_MemoryRead(), it necer returns, meaning, the flag it loops for getting cleared never gets cleared by of the interrupt handler. This is beacuse, the interrupt never occurs. So, what I think is that, I should be calling disk_read() in a way that the host would expect, not as Chan's FATFS f_read() would expect. Am I correct here?
>
> I mean, what way should I read data from the disk_read(), so that the host would expect it to be in a correct format?
>
> This does not happen if I use normal f_read() call from my main() function, to read a line from an existing file. An interrupt does occur, and disk_read() returns successfully.
>
> Regards,
> Yusuf Husainy.
>
> ________________________________
> From: Yusuf Husainy
> To: "l..."
> Sent: Saturday, 6 July 2013 4:42 PM
> Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
>
> Oh, I thought it were the links from where i got the code.
>
> OK here are my parts of the code relevant to the problem:
>
> http://pastie.org/8115232
>
> It is a bit long, but most probably easy to grasp.
>
> The thing not working is the copying of the sd/card received data from the MCI FIFO to memory(USB-RAM), when DMA is diabled.
> The pointers,
> volatile BYTE *WriteBlock = (BYTE *)(DMA_SRC); /* treat WriteBlock as a constant address */
> volatile BYTE *ReadBlock = (BYTE *)(DMA_DST); /* treat ReadBlock as a constant address */
>
> actually define the memory region where the received data will be put from MCI FIFO as well as the from where the pick-up of data will be done to write to the MCI FIFO.
>
> These pointers are used as the sole arguments of MCI_ReadFifo and MCI_WriteFifo, implemented as assembly routines in the file readfifo.s(this is given in the above link), when DMA is disabaled, and used as the destination and source addresses when DMA is enabled. This memory region is defined to be in the USB-RAM space as defined in dma.h file here:
> #define DMA_SRC0x7FD00000/* This is the area original data is stored
> or data to be written to the SD/MMC card. */
> #define DMA_DST0x7FD01000/* This is the area, after writing to the SD/MMC,
> // data read from the SD/MMC card. */
>
> If anyone has more questions on the implementation of my code, feel free to ask.
>
> And also, I appreciate everyone's help and response.
>
> Regards,
> Yusuf Husainy
>
> ________________________________
> From: Fx
> To: l...
> Sent: Saturday, 6 July 2013 4:00 PM
> Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
>
> Please post the relevant part of your code to be discussed.
>
> On Sat, Jul 6, 2013 at 3:07 AM, Yusuf Husainy wrote:
>
> > **
> >
> >
> > Hello all,
> >
> > Donald:
> > Here are the links:
> >
> > LPC2368 USB MSC implementation:http://www.keil.com/download/docs/336.asp (I
> > was mistaken, I had got it from the Keil website, not NXP).
> > USB-SD card implementation:
> > http://www.lpcware.com/content/blog/lpcxpresso-lpc11u14-usb-sd-card-exmple
> > SD/FAFTS imlementation: I can't find the exact link but, it is Chan's
> > implementation of the FATFS.
> >
> > Fx:
> >
> > Ok, I see, but my current implementation is based on interrupts itself,
> > meaning, the interrupts received from the sd/mmc subunit of LPC2368. So, I
> > did not get what you meant that you got rid of the DMA transfers and used
> > interrupts. Looking in the lpcware link code above, you can see that when
> > DMA is disabled, we do get interrupts from the sd/mmc subunit. So, what
> > exactly did you do to make it work?
> >
> > Also, I am not calling any of Chan's fatfs API's when an endpoint in/out
> > event occurs. I call directly the lower level disk_read(), when an IN
> > request comes from the host PC.
> >
> > Also, sorry about the most previous thread I posted just before this, it
> > was a duplicate, it got sent to the group mistakenly.
> >
> > Regards,
> > Yusuf Husainy
> >
> > ________________________________
> > From: Donald H
> > To: l...
> > Sent: Friday, 5 July 2013 7:58 PM
> > Subject: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on
> > a custom board.
> >
> >
> >
> >
> >
> > --- In l..., Yusuf Husainy wrote:
> > >
> > > Hi Fx and everyone else,
> > >
> > > Thanks for the help.
> > >
> > > I went through the code in the given link and modified it to suit the
> > LPC2368.
> > >I used the mmc/sdfatfs & USB-MSC implementation from NXP's site
> >
> > Please post the link to this code, Thank You.
> >
> > don
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
>
> --
> /* Jumping Flowers */
>
> [Non-text portions of this message have been removed]
>
>
>
>
Reply by Yusuf Husainy July 12, 20132013-07-12
Hello All,

Yes I can share the project with this forum. Will upload it soon.

Some further issues that I am facing are:
1. The speed of transfer of files from/to the sd-card is very slow. A 10 MB file copied from my desktop and pasted to the sd-card took 6 minutes for the transfer. However, I did some more work and tried enabling DMA transfer. This reduced the duration of the transfer to 3 minutes!!, a 50% improve. Although the USB-RAM(8KB) and the DMA are shared, I realized, as I am using only two endpoints, each of which has maximum packet size of 64 bytes, I would be using only 128 bytes of the USB-RAM, so the rest can be used by DMA itself. Then also, a 3 minute duration is too much for a 10MB file!!!

2. I did some study and came to know, as Mike had said, the volume label is in the filesystem partition table. So I looked into Chan's FatFs code, specifically the f_mkfs() function in ff.c . This, if I am not wrong, formats the sd-card and creates a new partition specified by the "allocationsize"  argument to this function. We can then specify our own volume label. But the problem is, if I am correct, this function has a limitation to format at max 32KB storage. So if I want to format the whole 1.83GB volume, it wold not be possible with this function. So what workaround can I do with this?

I appreciate everyone's help and response.

Regards,
Yusuf Husainy.
________________________________
From: Michael Anton
To: l...
Sent: Friday, 12 July 2013 1:17 PM
Subject: RE: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

 
The volume label is stored in the root directory, not in an SD card register. If you want to change it, you just need to write a new one. Wikipedia has some information on how this is stored.

Mike

-----Original Message-----
From: l... [mailto:l...]On Behalf
Of Yusuf Husainy
Sent: Wednesday, July 10, 2013 11:17 PM
To: l...
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card
attached on a custom board.

Hello All,

I have finally done it!!

The sd-card is detected by Windows as 1.83GB volume showing all the files on it. I can read and write to it also. I can cut, copy and paste data to and from the sd-card too!!!

The problem was, I has nested interrupts disabled as soon as a USB interrupt occured. So the sd/mmc unit of lpc2368 was unable to interrupt the processor core. I enabled interrupts at the start of the udb isr, and then disabled just before the ISR returned.

Everything is working great now!!

Onlly, I would like to change the volume name of the sd-card. I know I can do it on Windows, but how would I do it in code, I mean what register or something would I have to program of the sd/mmc unit to change the volume name when it is detected by Windows?

I appreciate everyone's help and response.

Regards,
Yusuf Husainy.

________________________________
From: Yusuf Husainy
To: "l..."
Sent: Monday, 8 July 2013 5:27 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
Hi all,

I have made some progress. I was successful in reading from the sd card while DMA is disabled and also I shifted the src and dest addresses which were used to write to and read from the MCI FIFO respectively, to the normal RAM from the USB-RAM.

Now, should it be that I should call the low level disk api disk_read() when a MSC_MemoryRead() request comes from the host(i.e., SCSI_READ requests?). I am asking this because,. when i call disk_read() from MSC_MemoryRead(), it necer returns, meaning, the flag it loops for getting cleared never gets cleared by of the interrupt handler. This is beacuse, the interrupt never occurs. So, what I think is that, I should be calling disk_read() in a way that the host would expect, not as Chan's FATFS f_read() would expect. Am I correct here?

I mean, what way should I read data from the disk_read(), so that the host would expect it to be in a correct format?

This does not happen if I use normal f_read() call from my main() function, to read a line from an existing file. An interrupt does occur, and disk_read() returns successfully.

Regards,
Yusuf Husainy.

________________________________
From: Yusuf Husainy
To: "l..."
Sent: Saturday, 6 July 2013 4:42 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

Oh, I thought it were the links from where i got the code.

OK here are my parts of the code relevant to the problem:

http://pastie.org/8115232

It is a bit long, but most probably easy to grasp.

The thing not working is the copying of the sd/card received data from the MCI FIFO to memory(USB-RAM), when DMA is diabled.
The pointers,
volatile BYTE *WriteBlock = (BYTE *)(DMA_SRC); /* treat WriteBlock as a constant address */
volatile BYTE *ReadBlock = (BYTE *)(DMA_DST); /* treat ReadBlock as a constant address */

actually define the memory region where the received data will be put from MCI FIFO as well as the from where the pick-up of data will be done to write to the MCI FIFO.

These pointers are used as the sole arguments of MCI_ReadFifo and MCI_WriteFifo, implemented as assembly routines in the file readfifo.s(this is given in the above link), when DMA is disabaled, and used as the destination and source addresses when DMA is enabled. This memory region is defined to be in the USB-RAM space as defined in dma.h file here:
#define DMA_SRC0x7FD00000/* This is the area original data is stored
or data to be written to the SD/MMC card. */
#define DMA_DST0x7FD01000/* This is the area, after writing to the SD/MMC,
// data read from the SD/MMC card. */

If anyone has more questions on the implementation of my code, feel free to ask.

And also, I appreciate everyone's help and response.

Regards,
Yusuf Husainy

________________________________
From: Fx
To: l...
Sent: Saturday, 6 July 2013 4:00 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

Please post the relevant part of your code to be discussed.

On Sat, Jul 6, 2013 at 3:07 AM, Yusuf Husainy wrote:

> **
> Hello all,
>
> Donald:
> Here are the links:
>
> LPC2368 USB MSC implementation:http://www.keil.com/download/docs/336.asp (I
> was mistaken, I had got it from the Keil website, not NXP).
> USB-SD card implementation:
> http://www.lpcware.com/content/blog/lpcxpresso-lpc11u14-usb-sd-card-exmple
> SD/FAFTS imlementation: I can't find the exact link but, it is Chan's
> implementation of the FATFS.
>
> Fx:
>
> Ok, I see, but my current implementation is based on interrupts itself,
> meaning, the interrupts received from the sd/mmc subunit of LPC2368. So, I
> did not get what you meant that you got rid of the DMA transfers and used
> interrupts. Looking in the lpcware link code above, you can see that when
> DMA is disabled, we do get interrupts from the sd/mmc subunit. So, what
> exactly did you do to make it work?
>
> Also, I am not calling any of Chan's fatfs API's when an endpoint in/out
> event occurs. I call directly the lower level disk_read(), when an IN
> request comes from the host PC.
>
> Also, sorry about the most previous thread I posted just before this, it
> was a duplicate, it got sent to the group mistakenly.
>
> Regards,
> Yusuf Husainy
>
> ________________________________
> From: Donald H
> To: l...
> Sent: Friday, 5 July 2013 7:58 PM
> Subject: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on
> a custom board.
>
> --- In l..., Yusuf Husainy wrote:
> >
> > Hi Fx and everyone else,
> >
> > Thanks for the help.
> >
> > I went through the code in the given link and modified it to suit the
> LPC2368.
> >I used the mmc/sdfatfs & USB-MSC implementation from NXP's site
>
> Please post the link to this code, Thank You.
>
> don
>
> [Non-text portions of this message have been removed]
>
>
>

--
/* Jumping Flowers */

[Non-text portions of this message have been removed]

Reply by Michael Anton July 12, 20132013-07-12
The volume label is stored in the root directory, not in an SD card register. If you want to change it, you just need to write a new one. Wikipedia has some information on how this is stored.

Mike
-----Original Message-----
From: l... [mailto:l...]On Behalf
Of Yusuf Husainy
Sent: Wednesday, July 10, 2013 11:17 PM
To: l...
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card
attached on a custom board.
Hello All,

I have finally done it!!

The sd-card is detected by Windows as 1.83GB volume showing all the files on it. I can read and write to it also. I can cut, copy and paste data to and from the sd-card too!!!

The problem was, I has nested interrupts disabled as soon as a USB interrupt occured. So the sd/mmc unit of lpc2368 was unable to interrupt the processor core. I enabled interrupts at the start of the udb isr, and then disabled just before the ISR returned.

Everything is working great now!!

Onlly, I would like to change the volume name of the sd-card. I know I can do it on Windows, but how would I do it in code, I mean what register or something would I have to program of the sd/mmc unit to change the volume name when it is detected by Windows?

I appreciate everyone's help and response.

Regards,
Yusuf Husainy.
________________________________
From: Yusuf Husainy
To: "l..."
Sent: Monday, 8 July 2013 5:27 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

Hi all,

I have made some progress. I was successful in reading from the sd card while DMA is disabled and also I shifted the src and dest addresses which were used to write to and read from the MCI FIFO respectively, to the normal RAM from the USB-RAM.

Now, should it be that I should call the low level disk api disk_read() when a MSC_MemoryRead() request comes from the host(i.e., SCSI_READ requests?). I am asking this because,. when i call disk_read() from MSC_MemoryRead(), it necer returns, meaning, the flag it loops for getting cleared never gets cleared by of the interrupt handler. This is beacuse, the interrupt never occurs. So, what I think is that, I should be calling disk_read() in a way that the host would expect, not as Chan's FATFS f_read() would expect. Am I correct here?

I mean, what way should I read data from the disk_read(), so that the host would expect it to be in a correct format?

This does not happen if I use normal f_read() call from my main() function, to read a line from an existing file. An interrupt does occur, and disk_read() returns successfully.

Regards,
Yusuf Husainy.

________________________________
From: Yusuf Husainy
To: "l..."
Sent: Saturday, 6 July 2013 4:42 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

Oh, I thought it were the links from where i got the code.

OK here are my parts of the code relevant to the problem:

http://pastie.org/8115232

It is a bit long, but most probably easy to grasp.

The thing not working is the copying of the sd/card received data from the MCI FIFO to memory(USB-RAM), when DMA is diabled.
The pointers,
volatile BYTE *WriteBlock = (BYTE *)(DMA_SRC); /* treat WriteBlock as a constant address */
volatile BYTE *ReadBlock = (BYTE *)(DMA_DST); /* treat ReadBlock as a constant address */

actually define the memory region where the received data will be put from MCI FIFO as well as the from where the pick-up of data will be done to write to the MCI FIFO.

These pointers are used as the sole arguments of MCI_ReadFifo and MCI_WriteFifo, implemented as assembly routines in the file readfifo.s(this is given in the above link), when DMA is disabaled, and used as the destination and source addresses when DMA is enabled. This memory region is defined to be in the USB-RAM space as defined in dma.h file here:
#define DMA_SRC0x7FD00000/* This is the area original data is stored
or data to be written to the SD/MMC card. */
#define DMA_DST0x7FD01000/* This is the area, after writing to the SD/MMC,
// data read from the SD/MMC card. */

If anyone has more questions on the implementation of my code, feel free to ask.

And also, I appreciate everyone's help and response.

Regards,
Yusuf Husainy

________________________________
From: Fx
To: l...
Sent: Saturday, 6 July 2013 4:00 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

Please post the relevant part of your code to be discussed.

On Sat, Jul 6, 2013 at 3:07 AM, Yusuf Husainy wrote:

> **
> Hello all,
>
> Donald:
> Here are the links:
>
> LPC2368 USB MSC implementation:http://www.keil.com/download/docs/336.asp (I
> was mistaken, I had got it from the Keil website, not NXP).
> USB-SD card implementation:
> http://www.lpcware.com/content/blog/lpcxpresso-lpc11u14-usb-sd-card-exmple
> SD/FAFTS imlementation: I can't find the exact link but, it is Chan's
> implementation of the FATFS.
>
> Fx:
>
> Ok, I see, but my current implementation is based on interrupts itself,
> meaning, the interrupts received from the sd/mmc subunit of LPC2368. So, I
> did not get what you meant that you got rid of the DMA transfers and used
> interrupts. Looking in the lpcware link code above, you can see that when
> DMA is disabled, we do get interrupts from the sd/mmc subunit. So, what
> exactly did you do to make it work?
>
> Also, I am not calling any of Chan's fatfs API's when an endpoint in/out
> event occurs. I call directly the lower level disk_read(), when an IN
> request comes from the host PC.
>
> Also, sorry about the most previous thread I posted just before this, it
> was a duplicate, it got sent to the group mistakenly.
>
> Regards,
> Yusuf Husainy
>
> ________________________________
> From: Donald H
> To: l...
> Sent: Friday, 5 July 2013 7:58 PM
> Subject: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on
> a custom board.
>
> --- In l..., Yusuf Husainy wrote:
> >
> > Hi Fx and everyone else,
> >
> > Thanks for the help.
> >
> > I went through the code in the given link and modified it to suit the
> LPC2368.
> >I used the mmc/sdfatfs & USB-MSC implementation from NXP's site
>
> Please post the link to this code, Thank You.
>
> don
>
> [Non-text portions of this message have been removed]
>
>
>

--
/* Jumping Flowers */

[Non-text portions of this message have been removed]

Reply by Donald H July 12, 20132013-07-12
--- In l..., Yusuf Husainy wrote:
>
> Hello All,
>
> I have finally done it!!
>

Is this a project that you can share with this forum ??

don

Reply by Yusuf Husainy July 11, 20132013-07-11
Hello All,

I have finally done it!!

The sd-card is detected by Windows as 1.83GB volume showing all the files on it. I can read and write to it also. I can cut, copy and paste data to and from the sd-card too!!!

The problem was, I has nested interrupts disabled as soon as a USB interrupt occured. So the sd/mmc unit of lpc2368 was unable to interrupt the processor core. I enabled interrupts at the start of the udb isr, and then disabled just before the ISR returned.

Everything is working great now!!

Onlly, I would like to change the volume name of the sd-card. I know I can do it on Windows, but how would I do it in code, I mean what register or something would I have to program of the sd/mmc unit to change the volume name when it is detected by Windows?

I appreciate everyone's help and response.

Regards,
Yusuf Husainy.
________________________________
From: Yusuf Husainy
To: "l..."
Sent: Monday, 8 July 2013 5:27 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

 
Hi all,

I have made some progress. I was successful in reading from the sd card while DMA is disabled and also I shifted the src and dest addresses which were used to write to and read from the MCI FIFO respectively, to the normal RAM from the USB-RAM.

Now, should it be that I should call the low level disk api disk_read() when a MSC_MemoryRead() request comes from the host(i.e., SCSI_READ requests?). I am asking this because,. when i call disk_read() from MSC_MemoryRead(), it necer returns, meaning, the flag it loops for getting cleared never gets cleared by of the interrupt handler. This is beacuse, the interrupt never occurs. So, what I think is that, I should be calling disk_read() in a way that the host would expect, not as Chan's FATFS f_read() would expect. Am I correct here? 

I mean, what way should I read data from the disk_read(), so that the host would expect it to be in a correct format? 

This does not happen if I use normal f_read() call from my main() function, to read a line from an existing file. An interrupt does occur, and disk_read() returns successfully.

Regards,
Yusuf Husainy.

________________________________
From: Yusuf Husainy
To: "l..."
Sent: Saturday, 6 July 2013 4:42 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
 
Oh, I thought it were the links from where i got the code.

OK here are my parts of the code relevant to the problem:

http://pastie.org/8115232

It is a bit long, but most probably easy to grasp.

The thing not working is the copying of the sd/card received data from the MCI FIFO to memory(USB-RAM), when DMA is diabled.
The pointers,
volatile BYTE *WriteBlock = (BYTE *)(DMA_SRC); /* treat WriteBlock as a constant address */
volatile BYTE *ReadBlock  = (BYTE *)(DMA_DST); /* treat ReadBlock as a constant address */

actually define the memory region where the received data will be put from MCI FIFO as well as the from where the pick-up of data will be done to write to the MCI FIFO.

These pointers are used as the sole arguments of MCI_ReadFifo and MCI_WriteFifo, implemented as assembly routines in the file readfifo.s(this is given in the above link),  when DMA is disabaled, and used as the destination and source addresses when DMA is enabled. This memory region is defined to be in the USB-RAM space as defined in dma.h file here:
#define DMA_SRC0x7FD00000/* This is the area original data is stored
or data to be written to the SD/MMC card. */
#define DMA_DST0x7FD01000/* This is the area, after writing to the SD/MMC,
// data read from the SD/MMC card. */

If anyone has more questions on the implementation of my code, feel free to ask.

And also, I appreciate everyone's help and response.

Regards,
Yusuf Husainy

________________________________
From: Fx
To: l...
Sent: Saturday, 6 July 2013 4:00 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

Please post the relevant part of your code to be discussed.

On Sat, Jul 6, 2013 at 3:07 AM, Yusuf Husainy wrote:

> **
> Hello all,
>
> Donald:
> Here are the links:
>
> LPC2368 USB MSC implementation:http://www.keil.com/download/docs/336.asp (I
> was mistaken, I had got it from the Keil website, not NXP).
> USB-SD card implementation:
> http://www.lpcware.com/content/blog/lpcxpresso-lpc11u14-usb-sd-card-exmple
> SD/FAFTS imlementation: I can't find the exact link but, it is Chan's
> implementation of the FATFS.
>
> Fx:
>
> Ok, I see, but my current implementation is based on interrupts itself,
> meaning, the interrupts received from the sd/mmc subunit of LPC2368. So, I
> did not get what you meant that you got rid of the DMA transfers and used
> interrupts. Looking in the lpcware link code above, you can see that when
> DMA is disabled, we do get interrupts from the sd/mmc subunit. So, what
> exactly did you do to make it work?
>
> Also, I am not calling any of Chan's fatfs API's when an endpoint in/out
> event occurs. I call directly the lower level disk_read(), when an IN
> request comes from the host PC.
>
> Also, sorry about the most previous thread I posted just before this, it
> was a duplicate, it got sent to the group mistakenly.
>
> Regards,
> Yusuf Husainy
>
> ________________________________
> From: Donald H
> To: l...
> Sent: Friday, 5 July 2013 7:58 PM
> Subject: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on
> a custom board.
>
> --- In l..., Yusuf Husainy wrote:
> >
> > Hi Fx and everyone else,
> >
> > Thanks for the help.
> >
> > I went through the code in the given link and modified it to suit the
> LPC2368.
> >I used the mmc/sdfatfs & USB-MSC implementation from NXP's site
>
> Please post the link to this code, Thank You.
>
> don
>
> [Non-text portions of this message have been removed]
>

>

--
/* Jumping Flowers */

[Non-text portions of this message have been removed]

Reply by Yusuf Husainy July 8, 20132013-07-08
Hi all,

I have made some progress. I was successful in reading from the sd card while DMA is disabled and also I shifted the src and dest addresses which were used to write to and read from the MCI FIFO respectively, to the normal RAM from the USB-RAM.

Now, should it be that I should call the low level disk api disk_read() when a MSC_MemoryRead() request comes from the host(i.e., SCSI_READ requests?). I am asking this because,. when i call disk_read() from MSC_MemoryRead(), it necer returns, meaning, the flag it loops for getting cleared never gets cleared by of the interrupt handler. This is beacuse, the interrupt never occurs. So, what I think is that, I should be calling disk_read() in a way that the host would expect, not as Chan's FATFS f_read() would expect. Am I correct here? 

I mean, what way should I read data from the disk_read(), so that the host would expect it to be in a correct format? 

This does not happen if I use normal f_read() call from my main() function, to read a line from an existing file. An interrupt does occur, and disk_read() returns successfully.

Regards,
Yusuf Husainy.
________________________________
From: Yusuf Husainy
To: "l..."
Sent: Saturday, 6 July 2013 4:42 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

 
Oh, I thought it were the links from where i got the code.

OK here are my parts of the code relevant to the problem:

http://pastie.org/8115232

It is a bit long, but most probably easy to grasp.

The thing not working is the copying of the sd/card received data from the MCI FIFO to memory(USB-RAM), when DMA is diabled.
The pointers,
volatile BYTE *WriteBlock = (BYTE *)(DMA_SRC); /* treat WriteBlock as a constant address */
volatile BYTE *ReadBlock  = (BYTE *)(DMA_DST); /* treat ReadBlock as a constant address */

actually define the memory region where the received data will be put from MCI FIFO as well as the from where the pick-up of data will be done to write to the MCI FIFO.

These pointers are used as the sole arguments of MCI_ReadFifo and MCI_WriteFifo, implemented as assembly routines in the file readfifo.s(this is given in the above link),  when DMA is disabaled, and used as the destination and source addresses when DMA is enabled. This memory region is defined to be in the USB-RAM space as defined in dma.h file here:
#define DMA_SRC0x7FD00000/* This is the area original data is stored
or data to be written to the SD/MMC card. */
#define DMA_DST0x7FD01000/* This is the area, after writing to the SD/MMC,
// data read from the SD/MMC card. */

If anyone has more questions on the implementation of my code, feel free to ask.

And also, I appreciate everyone's help and response.

Regards,
Yusuf Husainy

________________________________
From: Fx
To: l...
Sent: Saturday, 6 July 2013 4:00 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.
Please post the relevant part of your code to be discussed.

On Sat, Jul 6, 2013 at 3:07 AM, Yusuf Husainy wrote:

> **
> Hello all,
>
> Donald:
> Here are the links:
>
> LPC2368 USB MSC implementation:http://www.keil.com/download/docs/336.asp (I
> was mistaken, I had got it from the Keil website, not NXP).
> USB-SD card implementation:
> http://www.lpcware.com/content/blog/lpcxpresso-lpc11u14-usb-sd-card-exmple
> SD/FAFTS imlementation: I can't find the exact link but, it is Chan's
> implementation of the FATFS.
>
> Fx:
>
> Ok, I see, but my current implementation is based on interrupts itself,
> meaning, the interrupts received from the sd/mmc subunit of LPC2368. So, I
> did not get what you meant that you got rid of the DMA transfers and used
> interrupts. Looking in the lpcware link code above, you can see that when
> DMA is disabled, we do get interrupts from the sd/mmc subunit. So, what
> exactly did you do to make it work?
>
> Also, I am not calling any of Chan's fatfs API's when an endpoint in/out
> event occurs. I call directly the lower level disk_read(), when an IN
> request comes from the host PC.
>
> Also, sorry about the most previous thread I posted just before this, it
> was a duplicate, it got sent to the group mistakenly.
>
> Regards,
> Yusuf Husainy
>
> ________________________________
> From: Donald H
> To: l...
> Sent: Friday, 5 July 2013 7:58 PM
> Subject: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on
> a custom board.
>
> --- In l..., Yusuf Husainy wrote:
> >
> > Hi Fx and everyone else,
> >
> > Thanks for the help.
> >
> > I went through the code in the given link and modified it to suit the
> LPC2368.
> >I used the mmc/sdfatfs & USB-MSC implementation from NXP's site
>
> Please post the link to this code, Thank You.
>
> don
>
> [Non-text portions of this message have been removed]
>

>

--
/* Jumping Flowers */

[Non-text portions of this message have been removed]

Reply by Yusuf Husainy July 6, 20132013-07-06
Oh, I thought it were the links from where i got the code.

OK here are my parts of the code relevant to the problem:

http://pastie.org/8115232
It is a bit long, but most probably easy to grasp.

The thing not working is the copying of the sd/card received data from the MCI FIFO to memory(USB-RAM), when DMA is diabled.
The pointers,
volatile BYTE *WriteBlock = (BYTE *)(DMA_SRC); /* treat WriteBlock as a constant address */
volatile BYTE *ReadBlock = (BYTE *)(DMA_DST); /* treat ReadBlock as a constant address */

actually define the memory region where the received data will be put from MCI FIFO as well as the from where the pick-up of data will be done to write to the MCI FIFO.

These pointers are used as the sole arguments of MCI_ReadFifo and MCI_WriteFifo, implemented as assembly routines in the file readfifo.s(this is given in the above link), when DMA is disabaled, and used as the destination and source addresses when DMA is enabled. This memory region is defined to be in the USB-RAM space as defined in dma.h file here:
#define DMA_SRC0x7FD00000/* This is the area original data is stored
or data to be written to the SD/MMC card. */
#define DMA_DST0x7FD01000/* This is the area, after writing to the SD/MMC,
// data read from the SD/MMC card. */

If anyone has more questions on the implementation of my code, feel free to ask.

And also, I appreciate everyone's help and response.
Regards,
Yusuf Husainy

________________________________
From: Fx
To: l...
Sent: Saturday, 6 July 2013 4:00 PM
Subject: Re: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.


Please post the relevant part of your code to be discussed.
On Sat, Jul 6, 2013 at 3:07 AM, Yusuf Husainy wrote:

> **
> Hello all,
>
> Donald:
> Here are the links:
>
> LPC2368 USB MSC implementation:http://www.keil.com/download/docs/336.asp (I
> was mistaken, I had got it from the Keil website, not NXP).
> USB-SD card implementation:
> http://www.lpcware.com/content/blog/lpcxpresso-lpc11u14-usb-sd-card-exmple
> SD/FAFTS imlementation: I can't find the exact link but, it is Chan's
> implementation of the FATFS.
>
> Fx:
>
> Ok, I see, but my current implementation is based on interrupts itself,
> meaning, the interrupts received from the sd/mmc subunit of LPC2368. So, I
> did not get what you meant that you got rid of the DMA transfers and used
> interrupts. Looking in the lpcware link code above, you can see that when
> DMA is disabled, we do get interrupts from the sd/mmc subunit. So, what
> exactly did you do to make it work?
>
> Also, I am not calling any of Chan's fatfs API's when an endpoint in/out
> event occurs. I call directly the lower level disk_read(), when an IN
> request comes from the host PC.
>
> Also, sorry about the most previous thread I posted just before this, it
> was a duplicate, it got sent to the group mistakenly.
>
> Regards,
> Yusuf Husainy
>
> ________________________________
> From: Donald H
> To: l...
> Sent: Friday, 5 July 2013 7:58 PM
> Subject: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on
> a custom board.
>
> --- In l..., Yusuf Husainy wrote:
> >
> > Hi Fx and everyone else,
> >
> > Thanks for the help.
> >
> > I went through the code in the given link and modified it to suit the
> LPC2368.
> >I used the mmc/sdfatfs & USB-MSC implementation from NXP's site
>
> Please post the link to this code, Thank You.
>
> don
>
> [Non-text portions of this message have been removed]
>
>
>

--
/* Jumping Flowers */
[Non-text portions of this message have been removed]

Reply by Fx July 6, 20132013-07-06
Please post the relevant part of your code to be discussed.
On Sat, Jul 6, 2013 at 3:07 AM, Yusuf Husainy wrote:

> **
> Hello all,
>
> Donald:
> Here are the links:
>
> LPC2368 USB MSC implementation:http://www.keil.com/download/docs/336.asp (I
> was mistaken, I had got it from the Keil website, not NXP).
> USB-SD card implementation:
> http://www.lpcware.com/content/blog/lpcxpresso-lpc11u14-usb-sd-card-exmple
> SD/FAFTS imlementation: I can't find the exact link but, it is Chan's
> implementation of the FATFS.
>
> Fx:
>
> Ok, I see, but my current implementation is based on interrupts itself,
> meaning, the interrupts received from the sd/mmc subunit of LPC2368. So, I
> did not get what you meant that you got rid of the DMA transfers and used
> interrupts. Looking in the lpcware link code above, you can see that when
> DMA is disabled, we do get interrupts from the sd/mmc subunit. So, what
> exactly did you do to make it work?
>
> Also, I am not calling any of Chan's fatfs API's when an endpoint in/out
> event occurs. I call directly the lower level disk_read(), when an IN
> request comes from the host PC.
>
> Also, sorry about the most previous thread I posted just before this, it
> was a duplicate, it got sent to the group mistakenly.
>
> Regards,
> Yusuf Husainy
>
> ________________________________
> From: Donald H
> To: l...
> Sent: Friday, 5 July 2013 7:58 PM
> Subject: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on
> a custom board.
>
> --- In l..., Yusuf Husainy wrote:
> >
> > Hi Fx and everyone else,
> >
> > Thanks for the help.
> >
> > I went through the code in the given link and modified it to suit the
> LPC2368.
> >I used the mmc/sdfatfs & USB-MSC implementation from NXP's site
>
> Please post the link to this code, Thank You.
>
> don
>
> [Non-text portions of this message have been removed]
>
>
>

--
/* Jumping Flowers */
[Non-text portions of this message have been removed]

Reply by Yusuf Husainy July 6, 20132013-07-06
Hello all,
Donald:
Here are the links:

LPC2368 USB MSC implementation:http://www.keil.com/download/docs/336.asp (I was mistaken, I had got it from the Keil website, not NXP).
USB-SD card implementation: http://www.lpcware.com/content/blog/lpcxpresso-lpc11u14-usb-sd-card-exmple
SD/FAFTS imlementation: I can't find the exact link but, it is Chan's implementation of the FATFS.

Fx:

Ok, I see, but my current implementation is based on interrupts itself, meaning, the interrupts received from the sd/mmc subunit of LPC2368. So, I did not get what you meant that you got rid of the DMA transfers and used interrupts. Looking in the lpcware link code above, you can see that when DMA is disabled, we do get interrupts from the sd/mmc subunit. So, what exactly did you do to make it work?

Also, I am not calling any of Chan's fatfs API's when an endpoint in/out event occurs. I call directly the lower level disk_read(), when an IN request comes from the host PC.

Also, sorry about the most previous thread I posted just before this, it was a duplicate, it got sent to the group mistakenly.

Regards,
Yusuf Husainy

________________________________
From: Donald H
To: l...
Sent: Friday, 5 July 2013 7:58 PM
Subject: [lpc2000] Re: LPC2368 USB MSC Device for SD/MMC card attached on a custom board.

 
--- In l..., Yusuf Husainy wrote:
>
> Hi Fx and everyone else,
>
> Thanks for the help.
>
> I went through the code in the given link and modified it to suit the LPC2368.
>I used the mmc/sdfatfs & USB-MSC implementation from NXP's site

Please post the link to this code, Thank You.

don


[Non-text portions of this message have been removed]