SdCard with MCI interface from LPCopen

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SdCard with MCI interface from LPCopen

1,326 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by schisanoa on Tue Jul 29 00:35:06 MST 2014
I'm working with a LPC4088, with the embedded artist LPC4088 DEVELOPER'S KIT(OEM + BASE board) and I can't get working the SDMMC example.
I tried both Periph_SDMMC and App_SdMmc_Meas example(both provided from the LpcOpen 2.10 package for LPC4088) but the example code not work.
I use the LpcXpresso 7.2 and 7.3 on MAC laptop(but I also tried with Windows PC), with the Red Probe + debugger. It seem's that the interrupt is not working, but I'm not sure about this. However, yesterday I tried the IAR EW ARM, with a j-link lite, the same development board and the LPCOpen 2.10 example for IAR/KEIL and the same example code is now working.

After this test I have reconnected the LpcXpresso with RedProb+(without disconnect power supply) and the code is working also with the lpcxpresso tool now, but only until I cycle power. If I switch off, and On the power the LpcXpresso example code stop working. It work again only if I connect and start debug with the IAR tool before switch to the LPCXpresso, but I can't do that because I can't use the IAR anymore.

Could someone try the lpcOpen periph_sdmmmc example with ea development board+lpcxpresso+codered(or lpc link) debugger and tell me if it work?
Labels (1)
0 Kudos
6 Replies

1,181 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by schisanoa on Wed Jul 30 05:32:57 MST 2014
OK, Now it works!!

Thanks for the support.
0 Kudos

1,181 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Support on Tue Jul 29 10:42:00 MST 2014
There is a fix in a forthcoming version of LPCOpen software for these boards that might resolve this issue.

It was discovered that the MCIPWRAL bit in the SCS (System Controls and Status register) powers up with random polarity.  The result being that the polarity of the SD_PWR output becomes inverted.

The MCIPWRAL bit needs to be explicitly cleared to force active low polarity of SD_PWR on these boards.

Attached are the following updated files containing the fix:

software/lpc_core/lpc_board/boards_17xx/ea_devkit_4088/board.c
software/lpc_core/lpc_chip/chip_17xx_40xx/sdc_17xx_40xx.c
software/lpc_core/lpc_chip/chip_17xx_40xx/sdc_17xx_40xx.h
0 Kudos

1,181 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by schisanoa on Tue Jul 29 05:54:18 MST 2014
Example: periph_sdmmc

start debug, with break on:

"rc = f_open(&fileObj, "MESSAGE.TXT", FA_READ);"

(about line 229)

if I step over this line with lpcXpresso it return: FR_NOT_READY (hex code:0x03) and on the console I receive this message: "Card Acquire failed..."

if I step in when I am in the function Chip_SDMMC_Acquire(LPC_SDC_T *pSDC, SDMMC_CARD_T *pCardInfo), at this line:

"Ret = sendAppOpCond(pSDC, 0, true, &OCR, &CCS);"

I notice that "CCS" is a random number instead of a bool. So, stepping into this last function you will be in "sendAppOpCond(LPC_SDC_T *pSDC, uint16_t rca, bool hcs, uint32_t *pOcr, bool *pCCS)",

and here:

"Ret = executeCmd(pSDC, SD_ACMD41_SD_SEND_OP_COND, Argument, &Response);"

Response.Data[0] never match with "CMDRESP_R3_INIT_COMPLETE".

This is what I discovered until now, but may also be something else that I have not discovered yet.

Thank for your support.

PS, I think that you should have the same problem also with a different hardware
0 Kudos

1,181 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Jul 29 05:12:41 MST 2014
I'm trying to track down a board so that I can try this out. In the meantime, can you clarify in what way the example does not work?

Regards,
LPCXpresso Support
0 Kudos

1,181 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by schisanoa on Tue Jul 29 03:34:20 MST 2014
Thanks for reply.

I tried both the 2 solution you suggested but nothing changes, the example is still not working.

But the strange thing is that if I start debug one time with the IAR EW ARM, if I don't disconnect the power I can connect the RedProbe+ with LpcXpresso, build the project and it works, only until I Power Off the board.

Ale
0 Kudos

1,181 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Jul 29 03:09:20 MST 2014
I don't currently have access to a board to test this, but I suspect that this is an optimisation issue related to a delay loop.

LPCXpresso 7.2.0 and later build at -Og by default for debug builds. And looking in the source code for these examples, Chip_SDC_Init() in lpc_chip_40xx\src\sdc_17xx_40xx.c is using a simple 'for' loop as a delay - where the variable 'i' used for the delay is not declared as volatile.

I suspect therefore that the loop is simply not "long" enough (or is getting removed completely) when compiling with optimisation. I'll flag this to our LPCOpen team.

In the meantime, try making 'i' volatile, or even just change the optimisation level to -O0 for this file (or the whole project). Please then post back as to whether this gets the examples working for you.

For more information visit:

http://www.lpcware.com/content/faq/lpcxpresso/optimize-for-debug
http://www.lpcware.com/content/faq/lpcxpresso/compiler-optimization

Regards,
LPCXpresso Support

0 Kudos