cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to SD card with Simulink Embedded Coder Support for STM32 Microcontrollers

escott01
Associate II

Has anyone successfully used this Simulink STM32 guide to write to an SD card? I am trying to run a simulink model on a Nucleo-F767ZI and write the output to an SD card. I have tried to follow the directions, but it is not working. The model can compile and run on the board, but when I check the SD card, it is still empty. I have tried different clock speeds, 1-bit and 4-bit modes, but nothing seems to work. I scoped the clock signal, and it seems to be at 400 kHz, which is indicative of it being in the initialization stage. Does anyone know what may be wrong? Thanks!

 

 

1 ACCEPTED SOLUTION
4 REPLIES 4
Andrew Neil
Super User

@escott01 wrote:

 I have tried to follow the directions, but it is not working. 


It's a Mathworks document - nothing to do with ST - so you need to take that up with Mathworks

https://uk.mathworks.com/support/contact_us.html?s_tid=hc_resources

https://uk.mathworks.com/matlabcentral/?s_tid=hc_resources

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Well MicroSD cards can work on a NUCLEO-F767ZI

I've used them with FATFS, make sure cards are in FAT32, perhaps up to 32 GB to be safe / less complicated

You might want to look at the WaveShare sockets with the 33K or 47K type pull-ups on the DATA, CMD and CARD-DETECT lines

Check what GPIO you've used for the CD / CARD-DETECT, and it's polarity. Normally switch to GND when card inserted.

Perhaps rather than point at this document you could describe exactly what you've wired up and what it looks like.

MicroSD should be usable 4-bit at 24 MHz, but you'd want short leads of uniform lengths. Perhaps not DuPont wires.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

4-bit can be fussy with respect to commands / sequences, also sensitive to wiring and skewing of data arrival.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..