Rev 865 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 865 | Rev 869 | ||
---|---|---|---|
Line 310... | Line 310... | ||
310 | // Returnvalue: the function returns nothing |
310 | // Returnvalue: the function returns nothing |
311 | //________________________________________________________________________________________________________________________________________ |
311 | //________________________________________________________________________________________________________________________________________ |
Line 312... | Line 312... | ||
312 | 312 | ||
313 | void SDC_PrintCID(u8 * pCID) |
313 | void SDC_PrintCID(u8 * pCID) |
314 | { |
- | |
315 | // u8 pn[6]; |
314 | { |
316 | u16 temp1, temp2; |
315 | u16 temp1, temp2; |
- | 316 | /* |
|
317 | /* |
317 | u8 pn[6]; |
318 | sprintf(text, "\r\n Manufacturer ID: %i\r\n", pCID[0]); |
318 | sprintf(text, "\r\n Manufacturer ID: %i\r\n", pCID[0]); |
319 | UART1_PutString(text); |
319 | UART1_PutString(text); |
320 | memcpy(pn, &pCID[1], 2); |
320 | memcpy(pn, &pCID[1], 2); |
321 | pn[2] = '\0'; // terminate string |
321 | pn[2] = '\0'; // terminate string |
Line 541... | Line 541... | ||
541 | 541 | ||
542 | // read CID register |
542 | // read CID register |
543 | result = SDC_GetCID((u8 *)&SDCardInfo.CID); |
543 | result = SDC_GetCID((u8 *)&SDCardInfo.CID); |
544 | if(result != SD_SUCCESS) |
544 | if(result != SD_SUCCESS) |
545 | { |
- | |
- | 545 | { |
|
546 | 546 | SD_Result_t tmp = SD_ERROR_UNKNOWN; |
|
547 | if(print) UART1_PutString(" failed - Set interface to low speed..."); |
547 | if(print) UART1_PutString(" failed - Set interface to low speed..."); |
548 | SSC_Disable(); // set SD_CS high |
548 | SSC_Disable(); // set SD_CS high |
- | 549 | // here is the right place to inrease the SPI baud rate to maximum |
|
549 | // here is the right place to inrease the SPI baud rate to maximum |
550 | SSC_Speed(300); |
- | 551 | SSC_Enable(); // set SD_CS high |
|
- | 552 | tmp = SDC_GetCID((u8 *)&SDCardInfo.CID); |
|
- | 553 | ||
550 | SPI_Speed = 1000; |
554 | SPI_Speed = 1000; // teste mit dieser Geschwindigkeit |
551 | SSC_Speed(SPI_Speed); |
555 | SSC_Speed(SPI_Speed); |
552 | SSC_Enable(); // set SD_CS high |
556 | SSC_Enable(); // set SD_CS high |
- | 557 | result = SDC_GetCID((u8 *)&SDCardInfo.CID); |
|
- | 558 | ||
- | 559 | SPI_Speed -= 100; // setze Geschwindigkeit etwas runter |
|
- | 560 | SSC_Speed(SPI_Speed); |
|
553 | result = SDC_GetCID((u8 *)&SDCardInfo.CID); |
561 | if(print) { if((tmp == SD_SUCCESS) && (tmp != result)) { UART1_PutString("\r\nERROR: SD-Card too slow for Logging !\r\n"); print = 0;} } |
Line 554... | Line 562... | ||
554 | } |
562 | } |
555 | 563 | ||
556 | if(result != SD_SUCCESS) |
564 | if(result != SD_SUCCESS) |
557 | { |
565 | { |
558 | UART1_PutString("Error reading CID.\r\n"); |
566 | if(print) UART1_PutString("Error reading CID.\r\n"); |
Line 559... | Line 567... | ||
559 | goto end; |
567 | goto end; |
560 | } |
568 | } |
561 | 569 | ||
562 | 570 | ||
563 | // read CSD register |
571 | // read CSD register |
564 | result = SDC_GetCSD((u8 *)&SDCardInfo.CSD); |
572 | result = SDC_GetCSD((u8 *)&SDCardInfo.CSD); |
565 | if(result != SD_SUCCESS) |
573 | if(result != SD_SUCCESS) |
Line 566... | Line 574... | ||
566 | { |
574 | { |
Line 567... | Line 575... | ||
567 | UART1_PutString("Error reading CSD."); |
575 | if(print) UART1_PutString("Error reading CSD."); |
568 | goto end; |
576 | goto end; |
569 | } |
- | |
570 | 577 | } |
|
571 | if(print) UART1_PutString("ok\r\n"); |
578 | |
572 | 579 | if(print) UART1_PutString("ok\r\n"); |
|
Line 573... | Line 580... | ||
573 | u8 c_size_mult, read_bl_len; |
580 |