first

Dependencies:   SDFileSystemDMA mbed

Issue: SDFileSystemDMA-test and the L152RE

Hi Mi,

I tried your SDFileSystemDAM-test on a L152RE. I added the following to spi_device.h

#if defined(TARGET_NUCLEO_L152RE)
#define CS          D10    /* PB_6 or etc. */
#define MOSI        D11 /* PA_7 */
#define MISO        D12 /* PA_6 */
#define SCLK        D13 /* PA_5 */
#endif

I ran into a runtime "read error!". The program would only work if the buffer size is 512 bytes. Any other buffer size will cause a "read error!".

char buffer[512*1]  __attribute__ ((aligned (4))) ;    /*   512 byte */

As a result of changing the buffer size to something other than 512 bytes, I had to comment out the following in the read routine in order NOT to get a read error. However, in doing so, the wrong KBps value is displayed:

//if (iterations != (X_MEGA_BYTE / sizeof(buffer))){
	//	pc.printf("read error! a: %d   i: %d\n", X_MEGA_BYTE / sizeof(buffer), iterations);
	//}
	/*else*/ if (file->close()){
	pc.printf("failed to close file!\n");

...kevin

1 comment:

01 Sep 2016

Hi Kevin,
I've tried SPI1 ports(D11,D12,D13) you mentioned with my NUCLEO-L152RE.
After that the issue occured a few times,
it couldn't reproduce any more.
So I can't analyze the root cause at this moment.
I have some proposal,
(1) Would you change to other SD card different manufacture and different size ?
(2) Would you change to another SPI1 ports(D4,D5,D3) ?

There might be possibility of the effect that D13 port(SCK) is shared with LED1.