Pradeep Kotipalli
/
raw_sd_card_hey
nlknlknln
Fork of raw_sd_card_readsaswell by
Revision 6:09923c817679, committed 2015-06-15
- Comitter:
- pradeepvk2208
- Date:
- Mon Jun 15 13:37:24 2015 +0000
- Parent:
- 5:e13062be9e7b
- Commit message:
- sd_card_raw
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e13062be9e7b -r 09923c817679 main.cpp --- a/main.cpp Sat Jun 13 10:30:01 2015 +0000 +++ b/main.cpp Mon Jun 15 13:37:24 2015 +0000 @@ -43,28 +43,38 @@ SPI spi(PTD6, PTD7, PTD5); // mosi, miso, sclk DigitalOut cs(PTD2); int count_bro; -char alpha[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; +char alpha[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y',' '}; int block_number; int main() { + Timer t; initialise_card(); int result= initialise_card(); - printf("initialise card result=%d\n",result); + printf("initialise card result=%d \r\n",result); disk_initialize(); uint8_t buffer[512]; + for(block_number=0;block_number<100;block_number++) { for(count_bro=0;count_bro<512;count_bro++) {buffer[count_bro]= alpha[rand () % 26];} - disk_write(buffer, block_number);} + t.start(); + disk_write(buffer, block_number); + t.stop(); + printf("Time taken to write 1 block is %f \r\n",t.read()); + t.reset();} uint8_t read_data[512]; for(block_number=0;block_number<100;block_number++) - {disk_read(read_data, block_number); + {t.start(); + disk_read(read_data, block_number); + t.stop(); + printf("Time taken to read 1 block is %f \r\n",t.read()); + t.reset(); for(count_bro=0;count_bro<512;count_bro++) {printf("%c",read_data[count_bro]);} - printf("\n");} + printf("\r\n");} @@ -90,11 +100,11 @@ // send CMD8 to determine whther it is ver 2.x int r = cmd8(); if (r == R1_IDLE_STATE) { - printf("Entering v2 bro\n"); + //printf("Entering v2 bro\n"); return initialise_card_v2(); } else if (r == (R1_IDLE_STATE | R1_ILLEGAL_COMMAND)) { - printf("Entering v1 bro\n"); + // printf("Entering v1 bro\n"); return initialise_card_v1(); } else { @@ -346,7 +356,7 @@ } else { - printf("Hey,block init succesful\n"); + // printf("Hey,block init succesful\n"); } spi.frequency(1000000); // Set to 1MHz for data transfer @@ -363,7 +373,6 @@ // send the data block write(buffer, 512); - printf("Written Successfully bro \n"); return 0; }