SD card with lpc176x

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SD card with lpc176x

5,332件の閲覧回数
stefanoturchi
Contributor I

Hi all,

 

I'm developing a board with the LPC1768 microcontroller, with some peripherals and finally with one SD card. I have to write data into the SD card, so which is the best mode to do this with the max transfer rate?

Then I have to read the SD card connecting a personal computer to the board by a USB connector. Due to the enormous quantity of data stored in SD card after some days, I would transfer the data from SD card to PC at the maximun data rate. Can I use the LPC1768 as a USB controller? If yes, how can I do this? And which is the data rate? If is not possible to use the LPC1768 to read data from the SD card at high speed, how can I share the lines of SD card between LPC1768 and another device (controller)?

Thanks

Stefano

タグ(2)
0 件の賞賛
返信
6 返答(返信)

3,508件の閲覧回数
tyler_drazich
Contributor III

Hi Stefano,

Overall, what you describe is possible with the LPC1768. The 1768 does not have an SD/MMC peripheral, so you'd need to access the card using a standard SPI port. This would not give optimal transfer rate since SPI is a serial transfer versus the 4/8-bit data bus provided by an SD/MMC peripheral (e.g. the LPC177x/8x, LPC18xx, LPC43xx etc has SD/MMC interface).

There are various file system software components out there that you can use to read/write the card in a FAT file format. I see many folks using the FatFs component, and I've seen it included within in the LPC open distributions. Also see https://www.lpcware.com/content/nxpfile/an10916-fat-library-efsl-and-fatfs-port-nxp-lpc1700

You are correct, the LPC1768 can be used as a USB mass storage device, which provides a PC (or another other USB host) access to the SD card. As for sharing the lines of the SD card, you don't really do that. You have one SPI port attached to the physical card, then the LPC app needs to switch access to the card between itself and the attached USB host. The attached USB host will access the card as a raw block device, and it will manage the file system on the card, thus the LPC app cannot write the card at the same time. Typically, you have an arrangement where the LPC app can have the card while there is no USB. Then, when the USB is attached, the LPC app can either give the USB host access to the card, or it can indicate to the USB host that the card is unavailable (same as card not inserted). In the end, only one app at a time gets to mount and access the card.

You mentioned maximum transfer rate several times, and I don't have actual rate numbers, but be aware that using SPI to access the card is not as fast as using a 4/8-bit data bus. Also note that the LPC1768 has a full speed (12Mbit/s), not high speed (480Mbit/s), USB peripheral.

Best Regards,

tyler.drazich

0 件の賞賛
返信

3,508件の閲覧回数
stefanoturchi
Contributor I

Hi Tyler,

if I understood some microcontrollers can manage directly the SD CARD with 4/8bit data tansfer, so I could have a faster transfer rate.

Searching on NXP products thanks to your advice, I found the LPC1778 with SD/MMC peripheral, I would use the LPC1778FBD144 (less pin and cheaper).

Attached you can find a schematic draft of our system. As you can see the green line is the board and out of that we could attach the PC.

The board is battery powered, so the current consumption is important, our goal is 3mAh max in power down mode (this mean no data reading from GPS, current probe, 6 Axis acc+gyro and no use of GPRS and SD Card, NFC has a low power card detection).

During normal operation, the system read data from GPS, Acc+Gyro, Current Probe and store those data in the SD card.

Once a week, when the system is in power down mode, we could connect the board to the PC and we would download the data from the SD CARD.

Now I have some questions:

1. How can we reduce the SD current consumption when the system not use that (in power down mode)? I could use a pass transistor enabled by a GPIO so I could power the SD card when the PC is connected. Reading LPC1778 datasheet, I saw the pin 82, SD_PWR (Power Supply Enable for external SD card power supply), can I use this pin? Could you explain me the function of this pin? Coul you please give me a schematic with LPC1778 and a SD card? So I could understand how interface the SD card.

2. Is the LPC1778 able to recognize when the PC is connected?

3. Is there a source code for the LPC1778 to manage the SD card (writing normal opaeration and reading when I connect the PC)?

4. Is there an evaluation board with LPC 1778 and a SD card?

Please give me your support, this project is very important for us, our customer ordered thousands of boards!

Thank you

Stefano

Da: tyler.drazich

Inviato: venerdì 17 febbraio 2017 19:46

A: Stefano Turchi <stefano.turchi@digitech-group.com>

Oggetto: Re: - Re: SD card with lpc176x

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg> NXP Community

Re: SD card with lpc176x

reply from Tyler Drazich <https://community.nxp.com/people/tyler.drazich?et=watches.email.thread> in LPC - View the full discussion <https://community.nxp.com/message/878734?commentID=878734&et=watches.email.thread#comment-878734>

0 件の賞賛
返信

3,508件の閲覧回数
tyler_drazich
Contributor III

Hi Stefano,

First, I want to be clear that I don't represent NXP, I am an independent consultant who happens to be experienced with using their microcontroller devices.

For a development board with the LPC1788 and an SD card, I've used the LPC1788 OEM board from Embedded Artists. See http://www.nxp.com/products/software-and-tools/software-development-tools/software-tools/lpcxpresso-....

Embedded Artists provides a schematic for the entire board, but I don't remember, you may have to purchase the board before they give you a copy.

You can use the SD_PWR pin in conjunction with a transistor to power down the SD card when not in use. The board I recommended uses this arrangement. This pin can be controlled through a register within the SD/MMC peripheral. 

Yes, the LPC software will know when the PC is attached. There are several ways to this. The LPC can check for VBUS (power signal from the USB cable) or it can also check for SOF tokens which are sent from the PC host every USB frame.

NXP provides example code for the Embedded Artists LPC1788 board. You can download from here: http://www.nxp.com/products/software-and-tools/hardware-development-tools/lpcxpresso-boards/lpcopen-...

Also, I personally provide and support an SDK for some NXP controllers, with source code, of my own at https://dzxdesigns.com. It's more restrictive with licensing than NXP, so I can make a living, but it's a bit leaner and more purpose built.

Best Regards,

tyler.drazich

0 件の賞賛
返信

3,508件の閲覧回数
stefanoturchi
Contributor I

Hi Tyler,

thank you for your support.

I saw LPC1788 OEM board from Embedded Artists, but I didn’t understand if this require another board, because on the NXP website there is a kit containing One LPC1788 OEM Board and One OEM Base Board. What did you buy? Both or just one?

I found this kit on the Embedded Artist website, is ok?

https://www.embeddedartists.com/products/kits/lpc1788_kit.php

Thanks in advance.

Stefano

Da: tyler.drazich

Inviato: lunedì 20 febbraio 2017 15:59

A: Stefano Turchi <stefano.turchi@digitech-group.com>

Oggetto: Re: - Re: SD card with lpc176x

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg> NXP Community

Re: SD card with lpc176x

reply from Tyler Drazich <https://community.nxp.com/people/tyler.drazich?et=watches.email.thread> in LPC - View the full discussion <https://community.nxp.com/message/879244?commentID=879244&et=watches.email.thread#comment-879244>

0 件の賞賛
返信

3,508件の閲覧回数
tyler_drazich
Contributor III

Hi Stefano,

Yes, you'd want the one that has both the MCU board and the base board. The link you shared to Embedded Artists is correct.

The smaller red board only contains the LPC1788 along with additional RAM and flash memory. The base board contains all the interface circuitry along with the connectors (e.g. USB, SD card etc). The base board also has several expansion connectors to attach the other modules you're considering via GPIO, I2C, SPI etc for dev purposes.

Best Regards

-Tyler

0 件の賞賛
返信

3,508件の閲覧回数
stefanoturchi
Contributor I

Hi Tyler,

I purchased the Evaluation kit from Embedded Artists. Now I’m waiting for it so then I’ll download the schematic to see how the SD card is connected to the LPC.

For the moment I thank you, if I’ll have problems with the firmware I’ll open a new ticket.

Best Regards

Stefano

Da: tyler.drazich

Inviato: martedì 21 febbraio 2017 14:30

A: Stefano Turchi <stefano.turchi@digitech-group.com>

Oggetto: Re: - Re: SD card with lpc176x

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg> NXP Community

Re: SD card with lpc176x

reply from Tyler Drazich <https://community.nxp.com/people/tyler.drazich?et=watches.email.thread> in LPC - View the full discussion <https://community.nxp.com/message/879801?commentID=879801&et=watches.email.thread#comment-879801>

0 件の賞賛
返信