Go to advanced search

by hldswrth
Thu Nov 29, 2012 1:47 pm
Forum: Bare metal, Assembly language
Topic: EMMC - can't get READ_RDY
Replies: 22
Views: 8139

Re: EMMC - can't get READ_RDY

Pass a block address of 0 to the read command?
There's a lot of information on wikipedia on the FAT file system and format of the information in the boot sector
by hldswrth
Tue Nov 13, 2012 12:58 am
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 4905

Re: SD card second write produces timeout

Looking at my code: // Address passed in is byte offset from start of the card. // Address is different depending on the card type. // HC pass address as block # which is address/512. // SC pass address straight through. int blockAddress = sdCard.type == SD_TYPE_2_HC ? (int)(address>>9) : (int)addre...
by hldswrth
Sun Nov 04, 2012 7:20 pm
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 4905

Re: SD card second write produces timeout

Philippe, thanks for that info. It looks like setting the timeout value in the control register was the bit I was missing. However using your divider setting does not work for my (2GB non-HC) card. I use a divider setting of 16 for both setup and transfer and that appears to work OK. I would expect ...
by hldswrth
Sun Nov 04, 2012 2:35 pm
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 4905

Re: SD card second write produces timeout

OK... but whatever means I use to check for when I can write, and when the write has finished, I'm still successfully writing all 512 bytes to the card, but then getting a data timeout in the interrupt and the data busy/inhibit flags in status never clear. Final thing to check, what value of CONTROL...
by hldswrth
Sun Nov 04, 2012 1:00 am
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 4905

Re: SD card second write produces timeout

OK, looks like I spoke too soon. Once I removed all the debug console output and removed the get_status command I was sending after the write, I'm back to getting a data timeout in the interrupt register after the write has completed. Another question about working implementations - do you sent a ca...
by hldswrth
Sat Nov 03, 2012 11:40 pm
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 4905

Re: SD card second write produces timeout

Thanks! that's one thing I had not tried. When I use that value (i.e. 48 bit response with busy) I don't get the data timeout interrupt any more. However now what I'm finding is that the first byte written in the second block is being written with an incorrect value for some reason, so I need to che...
by hldswrth
Fri Nov 02, 2012 4:22 pm
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 4905

Re: SD card second write produces timeout

Still failing to get this to work. I've tried all different variants of the command code and even sending extra bytes and still get a data timeout and the DAT_INHIBIT flag never clears from the status register after I do a single block write, although it does successfully write the 512 bytes I do se...
by hldswrth
Fri Nov 02, 2012 1:28 pm
Forum: Bare metal, Assembly language
Topic: unable to blink status LED
Replies: 4
Views: 1874

Re: unable to blink status LED

Glad to hear it is working.
No idea about loader.bin. The README on the firmware page has not been updated to remove mention of it so I don't know what's happened there. The version I have included it as a separate file but all this stuff seems to change every time I look at it.
by hldswrth
Fri Nov 02, 2012 11:47 am
Forum: Bare metal, Assembly language
Topic: unable to blink status LED
Replies: 4
Views: 1874

Re: unable to blink status LED

You should not need to use a disk imager to make the bare metal programs work, although its also possible to take a card that's got a linux distribution on it and overwrite the kernel.img file. Any blank FAT-formatted SD card (the default) should work fine, you need to copy the boot files and your k...
by hldswrth
Fri Nov 02, 2012 11:34 am
Forum: Bare metal, Assembly language
Topic: EMMC - can't get READ_RDY
Replies: 22
Views: 8139

Re: EMMC - can't get READ_RDY

Most common problem here seems to be that the ACMD41 typically takes a significant time - 100's of milliseconds. From what you list above, you are getting the response for the ACMD41 after the next command - the 00ff8000 response is the card agreeing on the voltage levels which you sent in the ACMD4...
by hldswrth
Wed Oct 31, 2012 10:33 pm
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 4905

Re: SD card second write produces timeout

Yes, should have said the buffer is cast to int* so its 128 writes of 4 bytes at a time - and I've checked that the full 512 bytes are written correctly to the card.
by hldswrth
Wed Oct 31, 2012 1:46 pm
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 4905

Re: SD card second write produces timeout

With a bit more investigation, I added a 500ms wait after writing the last word. I verified that all 512 bytes were correctly written to the card. However after the 500ms wait, registers are: status = 0x01ff0006 - indicating data still busy interrupt = 0x00108010 - indicating data timeout So simply ...
by hldswrth
Wed Oct 31, 2012 12:47 am
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 4905

SD card second write produces timeout

Making some progress with SD card access after some diversions around FAT, ELF and UART :) I'm trying to get SD writing working, with some limited success. It appears I can write one block successfully, but when I try to write a second block, after sending the second WRITE_SINGLE command I don't see...
by hldswrth
Wed Oct 31, 2012 12:16 am
Forum: Bare metal, Assembly language
Topic: SD card access
Replies: 26
Views: 7471

Re: SD card access

I can certainly try to help with specific questions, although I'm not the expert in this stuff. I've managed to get as far as basic reading and writing to the SD card, although not without my own unresolved issues.
by hldswrth
Mon Oct 22, 2012 8:52 am
Forum: Bare metal, Assembly language
Topic: UART read not working (sometimes)
Replies: 2
Views: 1528

UART read not working (sometimes)

I've been struggling with getting serial comms working for a couple of days and so far has not come up with an explanation of the behaviour I'm seeing. I'm hoping someone has a suggestion which can explain the behaviour and also reliably fix it. I can get my serial transmit and receive code to work ...
by hldswrth
Mon Sep 24, 2012 11:19 pm
Forum: Bare metal, Assembly language
Topic: Bare metal OS, linking a program to kernel functions
Replies: 4
Views: 2381

Re: Bare metal OS, linking a program to kernel functions

Well I'm coding in C so I guess I have some additional issues, unless I do something like you have with a table of function pointers at a known place in memory, but that won't help the linker unless I use a static library which is then a thin wrapper around the function table. Really just want the l...
by hldswrth
Mon Sep 24, 2012 4:26 pm
Forum: Bare metal, Assembly language
Topic: Bare metal OS, linking a program to kernel functions
Replies: 4
Views: 2381

Bare metal OS, linking a program to kernel functions

I've got to the stage with my OS that I can load a file from the SD card. What I now want to be able to do is to load .elf format files, resolve references to kernel functions, and pass control to that file. That would then allow me to implement commands as separate files. I've not gone as far as VM...
by hldswrth
Mon Sep 24, 2012 4:17 pm
Forum: Bare metal, Assembly language
Topic: SD driver problems
Replies: 22
Views: 4510

Re: SD driver problems

According to the simplified spec, you need to repeat APP_SEND_OP_COND for up to 1 second, checking the high bit of the R3 response for completion, and checking that the rest of R3 indicates a compatible voltage. I'd leave 200ms between each one. The bit I have yet to get working is sending the switc...
by hldswrth
Sun Sep 23, 2012 11:22 pm
Forum: Bare metal, Assembly language
Topic: SD driver problems
Replies: 22
Views: 4510

Re: SD driver problems

You may need to code a small wait after you get the command complete interrupt back. There's a delay before any response from the card appears. I found without a delay I was seeing the response to the previous command arrive around the time I executed the next one. 000001AA is the card's response to...
by hldswrth
Wed Sep 19, 2012 9:59 pm
Forum: Bare metal, Assembly language
Topic: SD card access
Replies: 26
Views: 7471

Re: SD card access

Well not entirely sure what I changed ^^ I added longer delays between the ACMD41 calls and now I'm getting the top bit set (hooray!). Getting a successful response to CMD2 now so hopefully I can make some progress.
Thanks for your responses :)
by hldswrth
Wed Sep 19, 2012 9:02 pm
Forum: Bare metal, Assembly language
Topic: SD card access
Replies: 26
Views: 7471

Re: SD card access

I was putting 0x50000000. I tried 0x50FF0000 but get the same response, no complete bit gets set. btw the code I write for ACMD41 is 0x29020000 ... 0x2f is not a valid command index is it (would be ACMD47..?). I tried continuing past this to do a CMD2 but that returns with a timeout interrupt, I ass...
by hldswrth
Wed Sep 19, 2012 8:13 pm
Forum: Bare metal, Assembly language
Topic: SD card access
Replies: 26
Views: 7471

Re: SD card access

Well with some fiddling around I've made a bit of progress; with both an old card and new I've got as far as ACMD41 (HCS 1 for the new card, 0 for the old one). I'm using CONTROL1 = 0x000F0F25 (although only 0x00000F05 are relevant this far through init). If I set CONTROL0 = 0x00100000 I don't get s...
by hldswrth
Wed Sep 19, 2012 4:28 pm
Forum: Bare metal, Assembly language
Topic: SD card access
Replies: 26
Views: 7471

Re: SD card access

Yes I read that thread, was trying to execute the command sequence (or similar). Looking at that SDIO asm code, it seems mostly about setting GPIO (which people claim is already set up), and calculating the clock divider. I don't see any actual SD commands in there. Right now I've tried my code out ...
by hldswrth
Wed Sep 19, 2012 12:34 pm
Forum: Bare metal, Assembly language
Topic: SD card access
Replies: 26
Views: 7471

Re: SD card access

Following your sequence of commands exactly, I get stuck on CMD0... the status register gets bit 0 set to indicate command in progress, but that never resets and the interrupt bit indicating complete never gets set. If I remove the CONTROL0 SPI_EN bit then I at least get the interrupt from CMD0 but ...
by hldswrth
Wed Sep 19, 2012 9:57 am
Forum: Bare metal, Assembly language
Topic: SD card access
Replies: 26
Views: 7471

Re: SD card access

So reading the simplified spec (section 7.3.1.3) it shows that if CMD0 enters SPI mode then the expected resp type is R1 (and not no response). I'm confused as to whether SPI mode is necessary/expected and from the point of view of accessing the card whether it actually makes any significant differe...

Go to advanced search