2012-09-15 12:58 AM
Can anyone please provide me with a link to some basic, low level, 4-bit SDIO interface code compatible with the STM32F4VGT? I'm not looking for it to support a file system(yet), I just want to be able to read bytes from a uSD card. I've seen a few examples out there but I don't understand enough about C to understand all the high level stuff, let alone figuring out how to get TrueSTUDIO to compile it.
#metoo2012-10-04 11:41 PM
''Without an oscilloscope I have no way of knowing...''
That should be written on a sticky note and posted on every microcontroller developer's screen!! An oscilloscope really is a fundamental requirement for microcontroller development! Trying to do microcontroller development without a 'scope is like trying to do carpentry without a saw.2012-10-05 12:55 AM
Well, I do what I can with what I have. Maybe instead of building a new computer I'll have to get myself a scope for new years! I seem to need it more and more for every project I work on.
2012-10-05 09:51 AM
Maybe instead of building a new computer I'll have to get myself a scope for new years!
If you seriously want to get into embedded development (or electronics in general), you going to need it. Perhaps you can try to go cheap and get a used scope. Or something like the ARM DSO Nano. And RIGOL, a chinese supplier, is pressing into the market with rather competitive (and cheap) scopes. God beware the chinese one day decide to flood the western market with ARM Cortex controllers and boards ...2013-01-05 11:24 PM
Alright, time to bring this thread back to life. I got an oscilloscope (DS1052E) and I've been playing around with it, looking at SDIO data lines and what not. So far I've confir
med tha
t
the
wrong data is bein
g sent from the SD card to the MCU as opposed to from the MCU to the LCD. To prove this I
modifie
d the first 5 bytes of an image to
0xFF00 FF 01 B4 and
probed data line
0
, which would give the LSB of each nybble
, which is as fol
lows: 11
00 11 01
10. When
the data is trans
fer
red correctly (the image on the LCD looks right) I get
the
above data on my scope (I was going to attach an image but this bloody forum software keeps giving me an
error
). And when the imagelooks corrupte
d, the data on the scop
e looks wrong too. Keep in mind that all of this testing was done at a ~300
kHz SDIO clock. I don't really k
now what to make of this. Obviously the waveform is very clean so it can't be that the MCU is reading the data wrong
.Curiousl
y, the LCD somet
imes just stops drawing part way through the transfer, yet the SD card continues to send data. If I
set the SDIO clock to a v
ery low va
lue,
then the
card stops sending data part way through.
2013-01-06 10:36 PM
After a bunch of experimentation, using coax and a 10k pulldown on the clock line seems to have solved the problem for good! No idea why, but that's besides the point. It still looks like a sine wave on the scope though, maybe that's because it's only a 50 MHz scope.
2013-01-07 11:25 AM
My signal wires between boards are in the order 20-30 mm, which was about a short as I could do practically.
The code snippet you posted earlier is for the polling code, others seem to have had issues with that, I'm using the DMA code path.2013-01-12 10:47 PM
I assume using the DMA is faster? How much code would I have to change to implement it?
Also, did I mention I hate this forum software... 5'th time trying to post this2013-01-13 05:44 AM
stm32f4_discovery_sdio_sd.h
.. /* Uncomment the following line to select the SDIO Data transfer mode */ #if !defined (SD_DMA_MODE) && !defined (SD_POLLING_MODE) #define SD_DMA_MODE ((uint32_t)0x00000000) /*#define SD_POLLING_MODE ((uint32_t)0x00000002)*/ #endif2013-01-13 07:02 PM
I don't know where you found the Discovery header file, I sure went through hell trying to find an SDIO example for the Discovery and ended up using stm324xg_eval_sdio_sd.h instead. Either way, I just check and SD_DMA_MODE is defined, while SD_POLLING_MODE isn't. So I guess I am using DMA? Speaking of the DMA, I think I might have toastedpart of mine. I'm experimenting with the ADC DMA example for the Discovery and until recently it worked fine. Now however, the ADC gives me a value from 0-65520, whereas is used to give me 0-4095 as it should. It seems as if the data is being left-aligned (shifted 4 bytes left) even though I'm telling it to right-align. I didn't change any code either. It just randomly started doing this. I've tried a different ADC channel and a different DMA steam too.
2013-01-15 08:57 AM
I don't know where you found the Discovery header file, I sure went through hell trying to find an SDIO example for the Discovery and ended up using stm324xg_eval_sdio_sd.h instead.
I created it when I ported, and posted examples for the platform.