This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RL_ARM MMC--->SPI Problem

Hello, All
I am using rl-arm , have problem when using mmc in RTX-OS in a task .
when i debuge with j-link i see MMC task was be in hard loop in SPI_SAM7X.c in below line

-------------------------------SPI_SAM7X.c-------------------------------------
static BOOL SendBuf (U8 *buf, U32 sz) { /* Send buffer to SPI interface. */ U32 i;

for (i = 0; i < sz; i++) { AT91C_BASE_SPI0->SPI_TDR = buf[i]; /* Wait if Tx FIFO is full. */ while (!(AT91C_BASE_SPI0->SPI_SR & AT91C_SPI_TDRE)); AT91C_BASE_SPI0->SPI_RDR; }
hard loop-----> while (!(AT91C_BASE_SPI0->SPI_SR & AT91C_SPI_RDRF));//os_tsk_pass(); AT91C_BASE_SPI0->SPI_RDR; return (__TRUE);
} -------------------------------------------------------------------------------

and task program is in below:

__task void phaseB (void) {
char count,errorflag;
os_dly_wait(200);
count = 3;
while (finit(NULL) != 0) { os_dly_wait(2); if (!(count--)) { errorflag = 1; break;

}
} if (errorflag==1)debug_send("MMC Error\n");
while(1){
os_dly_wait(100);
debug_send("MMC Task\n");

}

}

Please help meeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
King regard
Amir

Parents
  • How well did you read the instructions on how to post source code? Didn't you notice the sentences directly above the message input box?

    Do you feel that your "code" looks readable without indentation and with random line breaks?

    By the way - why this change?

    while (!(AT91C_BASE_SPI0->SPI_SR & AT91C_SPI_RDRF)) os_tsk_pass();
    


    to

    while (!(AT91C_BASE_SPI0->SPI_SR & AT91C_SPI_RDRF)); //os_tsk_pass();
    


    Wouldn't the above result in a significant change in program behaviour?

Reply
  • How well did you read the instructions on how to post source code? Didn't you notice the sentences directly above the message input box?

    Do you feel that your "code" looks readable without indentation and with random line breaks?

    By the way - why this change?

    while (!(AT91C_BASE_SPI0->SPI_SR & AT91C_SPI_RDRF)) os_tsk_pass();
    


    to

    while (!(AT91C_BASE_SPI0->SPI_SR & AT91C_SPI_RDRF)); //os_tsk_pass();
    


    Wouldn't the above result in a significant change in program behaviour?

Children