LPC2478 does not boot ucLinux

Hi,

While trying to initialize MMC card, my board gets stuck:

lpc-2478-stk # mmcinit

mmc_init

mci-cid (SD memory card):

Manufacturer ID: 0x03 = SanDisk

OEM/Application ID: SD

Product Name: SD01G

Product Revision: 8.0

Serial Number: 0x600b9394

Date Code: 2008.6

sector size = 512 (Bytes), card size = 1000 (MBytes)

dump csd data: 002600325f5983c8

befbcfff924040d6

mmc_block_read: start=0, blkcnt=1

Any idea what am I doing wrong here? I formatted the MMC card with FAT16.

Thanks!

Leilani

I have the same problem, on the same board. Any idea?

It looks like this thread is receiving exquisitely little attention from any experts. However, I would still like to add my experiences and cry for help to it.

I have a newly purchased LPC-2478STK board from Olimex. It does exactly the same thing as leilani describes during mmc_init. The system is recognizing the SD card, but the hang seems to occur when the fat driver tries to read the first block of the disk. Not sure yet if this is a software problem or a hardware problem.

I have turned on the board many times using the same SD card, and just one time it actually made it past the hang and booted into Linux. However, I have not been able to repeat this result. Have no idea what made the difference, except maybe bumping the card just right, a funny look on my face, or maybe a well-placed static discharge. It might be associated with fiddling with an ethernet plug. I tried getting a different SD card, but it still hangs.

FWIW, the system always boots just fine from USB. However, I need the USB port to drive a UBW, so can’t give it up for a boot drive. There’s no really good reason not to be able to boot from SD, especially since the quick start documentation gives that as one of the options.

Please, Olimex, if you are listening, help us solve this problem so we don’t have to struggle through this.

I had same problem.

but notice the following

if you start with MMC

it would not hang and then after it all works goed and I can even boot from mmc.

however I still was not able to automatic start from mmc.

it always want to start from usb???

maybe someone els found already a solution

hm:
if you start with MMC

it would not hang and then after it all works goed and I can even boot from mmc.

however I still was not able to automatic start from mmc.

Are you distinguishing Mulit-Media Card from Secure Digital? I am using an SD card, not an MMC.

It sounds like you are saying that you are able to boot from card (which I assume is actually an SD unless you correct me) as long as you start it up manually first, rather than having uBoot start it automatically. I would have to recheck this, but my experience is that manual startup has no different a result than automatic startup. Furthermore, there is not obvious reason why it should be different, since the automatic startup is just a script that executes the same commands one would issue manually.

Are you sure that you have exactly the same problem? Specifically, the problem is that the card hangs during startup, and at a very specific point: just after reading the card info and during the attempt to read the first block of the volume.

“startup” = the process of activating the device for reading

“boot” = loading the OS into memory and handing execution over to it

I have the unit just for 2 days so i did do not verry much testing yet.

I tried again and suddenly I had the old problem back.

This happend after repowering the unit

after long testing I found a way to make it work a bit.

if I start with usb first and then start with mmc by reset it by reset jumper

the mmc option seems to work ?

by the way I use a SD card

MMC = multy Memory memory (this can be i think sd or mmc card)

how it works than

type the following

MMC

fatload mmc 0 0xa0800000 romfs_5.img

fatload mmc 0 0xa0008000 vmlinux.bin

go a0008000

I found the solution to start automatic by changing the env varibles.

To make you sd card work it must be formatted as fat and the files should be copied on the sd card.

It looks like mmc does not want to work properly after powerdown.

if you boot the usb first then somehow a chip is set to the right state.

and after a reset it sudenly start working correctly.

hello, hm

Could you go into a little more detail about it?

Because I did many tests , but it is still not work.

Or anyone can give me solution.

Please help me , thanks .

Regards.

There are two problems with the u-boot code as it comes from Olimex:

  1. The interrupt vectors are not properly copied to SRAM during initialization. This causes the board to crash when it first tries to run code that depends on interrupts. MMC code is the prime instance of this. But note that USB code does not use interrupts (at least as far as I could tell).

  2. The MMC code uses block size in an inconsistent way. When using larger sized media, this causes buffer overruns on the stack, crashing the system.

Solutions:

  1. Fix the u-boot initialization: in board/lpc_2478_stk/lowlevel_init.c, at the top of lowlevel_init(), find the code commented “move vectors to beginning of SRM” and modify the assembly code to read as follows:

" ldmia r0!, {r3-r10} \n"

" stmia r2!, {r3-r10} \n"

" ldmia r0, {r3-r10} \n"

" stmia r2, {r3-r10} \n" : : :

Leave all the other code above and below these 4 lines the same. What this does is remove the “NE” condition from each opcode, so that they always execute rather than executing conditionally. This also copies an additional 4 bytes that aren’t currently used, but that could be used if one wrote FIQ code.

  1. Fix MMC: in board/lpc_2478_stk/mmc.c, within mmc_block_read(), modify this line

for ( j = 0; j < hw_sect_size; j+=4 )

to instead read

for ( j = 0; j < BLOCK_LENGTH; j+=4 )

This hack enables my SD cards sized >= 1GiB to work. I also modified DEFAULT_SECTOR_SIZE in disk/part_dos.h, but it proved unnecessary for some reason (don’t remember now). The mmc code, and perhaps the part_dos code as well, requires further attention by someone who really understands it.

Hello , rothgang

Thank you for your help .

I have solved the problem .

My SD card (512MB) can work , but another (4GB) can’t .

Regards .

king_8210:
My SD card (512MB) can work , but another (4GB) can’t .

Try the mmc hacks I described, and also see if modifying part_dos.h has any impact.

Hello , rothgang

I have already modified mmc.c and part_dos.h.

But the result is the same.

My SD card (512MB) can work , but another (4GB) can’t .

Thanks .

Regards.

king_8210:
I have already modified mmc.c and part_dos.h.

But the result is the same.

My SD card (512MB) can work , but another (4GB) can’t .

It’s hard to help without sitting there with you and your code. Some suggestions:

  • There are several paths through part_dos.h that set DEFAULT_SECTOR_SIZE, depending on your configuration. The key is to make sure that it is defined to be at least as large as the physical read size of your device. I believe the physical read size is printed out when mmc initializes the device. Just comment out all relevant #ifdefs and hard code the size to be at least what you need. Otherwise, you get a buffer overrun on the stack when it reads a block from disk, which crashes the system when it attempts to return from the function call. (Like I said before, it seems that I ended up not needing this fix for some reason, but don’t remember why, so maybe it really is necessary after all.)

  • There may be issues with the file system. Is you 4GiB card formatted to FAT32?

  • In general, the way I figured stuff out was to put a lot of print statements in the code, leading up to the point of failure. Basically, read the code, figure out how it is expecting to work, and then print out key variables and see if they satisfy those assumptions. Eventually, you will find the breakage.

Good luck!

Hello , rothgang

My 4G Card is formatted to FAT32 .

Because it can only be formatted to FAT32 in the windows XP .

I follow your suggestions to try it again. (4G Card)

But it still show the message:

MCI ERROR from MCI_CardInit()!

No MMC card found

Although there is no successful but still very thank you for your help.

I am a beginner on lpc2478 .

If I have problems afterwards , can I write e-mail to ask your advice ?

If it’s ok , would you please give me your e-mail address ?

Thank you .

Regards .