• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To
  • Operating System iPod Nano 2G
  • Severity Medium
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by liar - 2009-11-11
Last edited by TheSeven - 2010-02-08

FS#10775 - IPod NANO 2G NAND issues

Some IPod Nano 2G’s(with a specific flash type) seem to need a delay after clearing the NAND write FIFO. Without that delay i cant view files, play files or start apps/games/demos, FTL errors occur frequently when writing ⇒ i had to restore my ipod nearly every day)

I dont know why they need this delay and a loop that counts from 0 to 3500 is propably not the best solution(a sleep would be too slow) but its working properly with this flash type.

Closed by  TheSeven
2010-02-08 18:37
Reason for closing:  Fixed
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Looks like we finally fixed it.

liar commented on 2009-11-12 20:07

this should be a more proper fix now
the problem was, we didnt wait for the write fifo as described in the datasheet

liar commented on 2009-11-12 21:42

wait for the r fifo too, add a timeout

liar commented on 2009-11-12 23:00

the previous ones locked up sometimes, hopefully this one doesnt. if rockbox still locks up with this patch the problem might have a different root than not waiting for the fifos…

liar commented on 2009-11-17 16:27

this one should be fully working, i have tested it thoroughly and its working fine - the fifo waiting has to be done before flushing it, thats why the previous ones failed sometimes

I have tried your patch with r23991. It failed on boot after display rockbox logo.

FTL: Lowlevel NAND driver init failed!

Switching back to r23991 and the nano boot without error.

liar commented on 2009-12-15 20:53

its failing with some ipods but with others not… (i have tried it with 3 different nanos)
on mine it dont get read/write problems anymore but still its failing sometimes.. i am still looking for a better(the right) solution

Great for the nano patch 3, it has solved many problems on my ipod nano 2gen.
The last one make the error wich is described by laurent papier.

So, the third works fine with my ipod. Thanks a lot.

liar commented on 2009-12-19 20:41

i have updated my patch
would be great if you could test it and report how it works

I'm sorry but i obtain the following error with the console when i try to apply the patch :
patch : malformed patch at line 110: @@ -287,18 +314,21 @@

You can notice i'm working with the version 24085 (downloaded right now).

After a few day trying the 2nd version (in fact, it was the 2nd and not the third, but we can't edit, the third obtain the same error with "Lowlevel NAND Driver init failed"), i often get crash, when the firmware works on files (for instance, when i launch a music, the firmware crashes sometimes, and sometimes it doesn't).

I had a question too, (i'm a "newbie" in applying patch in svn files) : how can i apply a patch over an old one, in order to recompile without compile again from start (and redownloading sources)?
Thanks for the patches, i wish this error will be soon corrected :).
I try your patch as soon as it's available.

I've tried the patch by editing manually the source code, and put in the original files the corrections of the patch.
I get the initial error, i.e, i can't go in the directories, launch app…

Maybe it's because what i ve done to apply the patch is a little hazardous (i'm not sure to have done the correct manipulations, as i have edited the files without applying the patch with the console), but maybe not.

liar commented on 2009-12-20 20:48

hm seems like there was something wrong with the patch, this one should work, sorry

liar commented on 2009-12-20 21:25

i forgot to delete some undervolting stuff from the previous patch, again sorry…

I've tried right now, and it works fine.
I've noticed that the version need a little bit more time to boot.

So, thank you really much, i will post if I notice anything which works bad.

decke commented on 2009-12-21 15:39

I couldn't properly navigate anymore with recent builds (about 3 weeks) but r23850 with that patch solves that problems for me. Thanks again!

liar commented on 2009-12-21 23:19

please also try this patch or binary, that can help me debugging

Hey! Just wanted to say thanks liar! i just successfully compiled 24099 witch your patch and that solved it for me on my nano 2g (8gb)! So thanks again and merry X-mas!

liar commented on 2009-12-24 08:44

this one shows the nand id. please tell me what it is(only if you have nand problems without my patch)

Grant commented on 2009-12-24 17:38

liar, the binary works great!
hope that it gets added to svn soon

Thx the patch is working fine and it saved me and my friends day.
It is working correctly without any misbehaviour.

I've got
nand_reset:nand_wait_rfifo_d ne

on boot. Build from svn today(r24148-100102), ipod nano 2gen 4gb, with last patch

liar commented on 2010-01-04 00:15

this patch:
differences to my recent patch:
* revert the fifo waiting - it is not needed(just some bits need to be set at different places, see below)
* falling back to the TheSeven(Apple) way of waiting for the chips to be ready(i changed that because it failed once for me. but now i am sure it was because of a side effect - i could reproduce it) - the datasheet is inaccurate in this matter

differences to the current svn:
* do not reset the NAND in nand_get_chip_type - a select bank is enough as we already reset the NAND before(and resetting is slow on NANOs with the NAND issue)
* set the fifo flush bits like the datasheet does - this avoids data corruption.
* wait for the NAND to be ready ⇒ be sure the NAND is ready for new commands - this avoids data corruption during writing to the NAND. it also avoids data corruption and panics during poweroff

do you have any problems with the NAND Driver?
i thought only 8GB nanos are affected by this problem
this patch should work for you.

jho commented on 2010-01-04 05:42

I have a 2GB Nano 2g. With vanilla Rockbox I had multiple issues:

· I could not browse any files on the system. Pressing select would only throw the "selector" to the topmost entry at the top level of the file structure
· The database initialization never finished. It hung when it got around to updating the last file present on the file system. The database debug info told that the process was at -1% by then.
· My computer (Linux 2.6.31-gentoo-r5) would not recognize the player when it was plugged in via USB. Dmesg told me "sdb: unknown partition table". Only thing that helped was to reboot back into the original firmware.
·  After unplugging the USB cable I got a panic: "mount: 0". When I rebooted after that, I got a panic with FTL error about trying to read an out-of-bounds page.

Over at IRC, mc2739 kindly directed me to this bug. The latest patch paniced on boot with "nand_power_up:nand_reset:2".

This patch, however, fixed all the aforementioned issues:

liar commented on 2010-01-04 10:48

please try this patch and tell me which panic it throws

jho commented on 2010-01-04 11:04


Hope this helps. If there's anything else I can do, just give me a shout. :-)

liar commented on 2010-01-04 11:40

that means the TheSeven way of waiting for the chips to be ready does not work for you(it did not panic in previous patches because TheSeven did not check the return value of nand_reset)

nand_wait_status_ready fails for you too - as we found out while talking in IRC - so the sleep is the best solution as there is no other bit which is toggeling we could wait for.

liar commented on 2010-01-05 11:20

this is another thing you could try(i only do nand_wait_staus_ready once instead of 4 times)
if that works we can drop that annoying sleep again

jho commented on 2010-01-05 15:09


That patch works fine. Thanks.

liar commented on 2010-01-05 16:55

so.. that should be working for everybody now.

jho commented on 2010-01-08 05:39

Sratch that—

Actually I only yesterday really used my player with the new patch and found out there still are big issues with it. I'm still getting FTL errors with it, while the patch with sleep actually works (tested throughly this time, I promise! ;))

liar commented on 2010-01-08 23:48

hm. cant think of anything else we could do then except the sleep

liar commented on 2010-01-15 01:57

.. another update. hopefully the last.
jho: your nano2g has only 2 banks right?
that was the problem. my patch was waiting for bank 0-3 but you only have 0 and 1.
the current svn calls nand_wait_chip_ready for all banks too but it doesnt panic because the return value of nand_reset isnt checked.

jho commented on 2010-01-18 07:26

Hi, and sorry for the late reply. I managed to get my Nano into the "use iTunes to restore" state, and only today got access to a Windows box so I could restore it.

That patch seems to work alright, so I guess my Nano only has two banks.

I've applied the patch to my 8GB 2nd.gen. Nano and get the PANIC nand_reset:nand_wait_chip_ready:0 message if I do some quick track skips, or other heavy file usage. In general running however, its fine. Occasionally, it has been PANIC nand_reset:nand_wait_chip_ready:2 - but much more often the code is 0. Is there anything I can do to help debug?

Does the last patch included in r24284???

I have installed r24284 on my nano 2g (8 Gb) - the problem is steel - cant open any app or file…

liar commented on 2010-01-19 20:19

MoSPDude: remove the nand_wait_chip_ready call in nand_reset. nand_wait_status_ready should be enough
brother_fox: no it is no included in the current svn

It's actually failing on the nand_wait_status_ready call. With the nand_wait_chip_ready call removed its a lot more unstable.

The panic message in the patch above shows the wrong call name for panic nand_wait_status_ready - it prints "nand_wait_chip_ready" for both lines in nand_reset.

timn commented on 2010-01-24 13:50

@Craig: Same here. After deleting nand_wait_chip_ready, at least Rockbox booted properly without the panic message.

Sometimes, though, I've got a nand_wait_status_ready panic. I can remember this happening while playing a song and clicking on another one in the file browser.

The nand_wait_status_ready(bank) call seems to be necessary: I tried to leave it out once and then wasn't able to browse the file hierarchy anymore.

Just change the panicf(…) call to "return 1" and it won't crash anymore.

I've been using the above patch with these two minor changes for a few days and would consider it stable. Are there any reasons not to include in SVN yet?

timn commented on 2010-01-24 14:06

I just got a "nand_power_up:nand_reset:3" panic. What does it mean? Can I safely delete this line?

liar commented on 2010-01-24 15:43

that means nand_reset failed for bank 3(you got that message because you replaced the panicf in nand_reset with return 1).
use this patch:

liar commented on 2010-01-26 22:43

update: dont ask the bank for its chip type before we reset that one.

liar commented on 2010-01-26 23:24

final(!?) patch.
please test this one and report any problems regarding it.

jho commented on 2010-01-26 23:55

Seems to work fine for me.

Please, can anyone send me the last release for nano 2g with this patch applied (or post a link to download it). I'd be very pleased. thanks in advance

Liar. It does not work for me. In fact I had to restore my Ipod after installing the firm you sent to me. Thank you for your fast answer anyway.
My nand ID is: A585D598.
It's strange, because this afternoon in the IRC channel #rockbox a guy there (nick Strife89) has compiled me a version of last nano 2g source applying this patch (the one in your last post) and it worked for me.
If you want me to send to you the compiled release send me an email please. It's 3.0Mb and I can't post it here…

sorry, the revision patched by Strife89 is 24364

liar commented on 2010-01-29 06:22

uhh my mistake - i did something wrong the binary i sent to you, sorry… thanks for your test results

this patch didnt work for me , i got the error

btw i am new :D

liar commented on 2010-01-30 13:32

you are using an old version of the patch… please use the lastest one :)

cheers it worked on one of my nano's on the other nano i just get
nand_power_up :nand_reset (bank = 2) failed.

can you help me on this error as well cheers

liar commented on 2010-01-30 22:20

in firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c
seek for the function: nand_power_up, replace that if(nand_reset(i)) panicf… with nand_reset(i);
this is what the current svn does… but the rest of the patch should still avoid the file system problems

thanks for the help

Patch committed as r24414. If there is any further trouble that could be related, please report it here.

Another related bug was caught and fixed in r24431.


Available keyboard shortcuts


Task Details

Task Editing