Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TS_DISCO_F746NG mbed Servo LCD_DISCO_F746NG BSP_DISCO_F746NG QSPI_DISCO_F746NG AsyncSerial FastPWM
Revision 3:33086de19b14, committed 2017-06-09
- Comitter:
- adustm
- Date:
- Fri Jun 09 08:35:40 2017 +0000
- Parent:
- 2:522456118ea2
- Child:
- 4:67478861c670
- Commit message:
- Align the main.cpp with BSP_DISCO_F746NG and SD_DISCO_F746NG library updates
Changed in this revision
--- a/BSP_DISCO_F746NG.lib Mon Dec 12 13:28:59 2016 +0000 +++ b/BSP_DISCO_F746NG.lib Fri Jun 09 08:35:40 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#fe313c53cdb5 +https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#56384bddaba5
--- a/SD_DISCO_F746NG.lib Mon Dec 12 13:28:59 2016 +0000 +++ b/SD_DISCO_F746NG.lib Fri Jun 09 08:35:40 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST/code/SD_DISCO_F746NG/#9f8c87fd3af5 +https://developer.mbed.org/teams/ST/code/SD_DISCO_F746NG/#cf12f3d37081
--- a/main.cpp Mon Dec 12 13:28:59 2016 +0000
+++ b/main.cpp Fri Jun 09 08:35:40 2017 +0000
@@ -9,7 +9,6 @@
Serial pc(USBTX, USBRX);
#define BLOCK_START_ADDR 0 /* Block start address */
-#define BLOCKSIZE 512 /* Block Size in Bytes */
#define NUM_OF_BLOCKS 5 /* Total number of blocks */
#define BUFFER_WORDS_SIZE ((BLOCKSIZE * NUM_OF_BLOCKS) >> 2) /* Total data size in bytes */
@@ -24,12 +23,12 @@
int main()
{
- uint8_t SD_state = SD_OK;
+ uint8_t SD_state = MSD_OK;
pc.printf("\n\nuSD example start:\n");
led_red = 0;
SD_state = sd.Init();
- if(SD_state != SD_OK){
+ if(SD_state != MSD_OK){
if(SD_state == MSD_ERROR_SD_NOT_PRESENT){
pc.printf("SD shall be inserted before running test\n");
} else {
@@ -39,22 +38,37 @@
} else {
pc.printf("SD Initialization : OK.\n");
- if(sd.Erase(BLOCK_START_ADDR, (BLOCKSIZE * NUM_OF_BLOCKS)) != SD_OK){
+ SD_state = sd.Erase(BLOCK_START_ADDR, (BLOCK_START_ADDR + NUM_OF_BLOCKS - 1));
+
+ /* Wait until SD card is ready to use for new operation */
+ while(sd.GetCardState() != SD_TRANSFER_OK){
+ }
+ if (SD_state != MSD_OK){
pc.printf("SD ERASE : FAILED.\n");
pc.printf("SD Test Aborted.\n");
} else {
pc.printf("SD ERASE : OK.\n");
/* Fill the buffer to write */
- Fill_Buffer(aTxBuffer, BUFFER_WORDS_SIZE, 0x22FF);
+ Fill_Buffer(aTxBuffer, BUFFER_WORDS_SIZE, 0x2300);
- if(sd.WriteBlocks(aTxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS) != SD_OK){
+ SD_state = sd.WriteBlocks(aTxBuffer, BLOCK_START_ADDR, NUM_OF_BLOCKS, 10000);
+ /* Wait until SD card is ready to use for new operation */
+ while(sd.GetCardState() != SD_TRANSFER_OK){
+ }
+
+ if (SD_state != MSD_OK){
pc.printf("SD WRITE : FAILED.\n");
pc.printf("SD Test Aborted.\n");
} else {
pc.printf("SD WRITE : OK.\n");
- if(sd.ReadBlocks(aRxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS)!= SD_OK){
+ SD_state = sd.ReadBlocks(aRxBuffer, BLOCK_START_ADDR, NUM_OF_BLOCKS, 10000);
+ /* Wait until SD card is ready to use for new operation */
+ while(sd.GetCardState() != SD_TRANSFER_OK){
+ }
+
+ if (SD_state != MSD_OK){
pc.printf("SD READ : FAILED.\n");
pc.printf("SD Test Aborted.\n");
} else {
--- a/mbed.bld Mon Dec 12 13:28:59 2016 +0000 +++ b/mbed.bld Fri Jun 09 08:35:40 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb \ No newline at end of file +https://mbed.org/users/mbed_official/code/mbed/builds/0f02307a0877 \ No newline at end of file