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
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?
Hello dear per. im so sorry.i didnt read , please accept my sorry. im very beginner and my english isnt so good. by the way,for os_tsk_pass(); isnt in the source file. but when MMC-task go to hard loop on [ while (!(AT91C_BASE_SPI0->SPI_SR & AT91C_SPI_RDRF)); ] the RTX-Task's was very slow. when add this command [os_tsk_pass();] then other task speed is increase.
but my problem is other thing.
when i write your example about RL-MMC in microcontroller flash then all thing ok. but when we placed your example code and configuration file to our project then it doesent work .
i think RL-ARM or a thing need to setting that i dont know.
if you want i send you my complate project, to check it.
warm regard
Amir
Note that this is an end-user forum, and not the official Keil support route.
If the MMC code works standalone, but not together with RTX, then you must take a closer look at what assumptions you have made. Is the same information sent out on the SPI interface? Might a task switch result in a significant timing problem? Is there any critical section in the original code that does not support a task switch?
Here is my main Program:
i say you when MMC isnt plug then dont have problem and all sub program is passed, dont have heavy loop . ======================================================
#include <RTL.h> #include <AT91SAM7X256.H> /* AT91SAM7X256 definitions */ #include <AT91SAM7X-EK.h> #include <stdio.h> /* standard I/O .h-file */ #include <ctype.h> /* character functions */ #include <string.h> /* string and memory functions */ #include "File_Config.h" #include "SD_File.h" //================mmc OS_TID t_phaseA; OS_TID t_phaseB; OS_TID t_buzz; OS_TID t_debug_wr; U8 waiting=20; #define BEEP1 os_evt_set (0x0001, t_buzz) char debug_write,debug_buffer[30]; void debug_send(char *string_input) { strcpy(debug_buffer,string_input); os_evt_set (0x0002, t_debug_wr); } /*---------------------------------------------------------------------------- * Task 1 'phaseA': Phase A output *---------------------------------------------------------------------------*/ __task void phaseA (void) { // char bufer_ser[100]; for (;;) { //os_evt_wait_and (0x0001, 0xffff); /* wait for an event flag 0x0001 */ *AT91C_PIOB_CODR = AT91B_LED1; os_dly_wait (5); /* call common signal function */ *AT91C_PIOB_SODR = AT91B_LED1; os_dly_wait (50); debug_send("Blink Task\n"); } } /*---------------------------------------------------------------------------- * Task 2 'phaseB': PhaseB output *---------------------------------------------------------------------------*/ __task void phaseB (void) { char count,errorflag; os_dly_wait(20); 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"); } } /*---------------------------------------------------------------------------- * Task 1 'phaseA': Phase A output *---------------------------------------------------------------------------*/ __task void buzz (void) { for (;;) { os_evt_wait_and (0x0001, 0xffff); /* wait for an event flag 0x0001 */ *AT91C_PIOB_CODR = (1<<18); os_dly_wait (3); *AT91C_PIOB_SODR = (1<<18); } } //=============================================== __task void debug_wr (void) { int num_byte; for (;;) { os_evt_wait_and (0x0002, 0xffff); num_byte =strlen(debug_buffer); ser_Write (&debug_buffer[0], &num_byte); } } /*---------------------------------------------------------------------------- * Task 5 'init': Initialize *---------------------------------------------------------------------------*/ __task void init (void) { *AT91C_PMC_PCER = (1 << AT91C_ID_PIOB);/* Enable Clock for PIO */ *AT91C_PMC_PCER = (1 << AT91C_ID_PIOA);/* Enable Clock for PIO */ *AT91C_PIOB_PER = AT91B_LED_MASK; /* Enable PIO for LED1..4 */ *AT91C_PIOB_OER = AT91B_LED_MASK; /* LED1..4 are Outputs */ *AT91C_PIOB_SODR = AT91B_LED_MASK; /* Turn off LED's ("1") */ *AT91C_PIOB_PER |= (1<<18); *AT91C_PIOB_OER |= (1<<18); t_phaseA = os_tsk_create (phaseA, 0); /* start task phaseA */ t_phaseB = os_tsk_create (phaseB,0); t_buzz = os_tsk_create (buzz, 0); t_debug_wr = os_tsk_create (debug_wr, 0); //os_evt_set (0x0001, t_phaseA); /* send signal event to task phaseA */ //============== Serial 0 ser_OpenPort (); ser_InitPort (115200, 8, 0, 0); //=============== mmc //spi_init( ); //CDC_DepInEmpty = 1; os_evt_set (0x0001, t_buzz); os_tsk_delete_self (); } int main(void) { int retv25; int asdf; os_sys_init (init); while(1) { } }
Your code contains:
//spi_init( );
Isn't this needed anymore - moved into finit()?
Note that your debug output solution isn't thread safe. What if you get a task switch while one thread is busy inserting a string? Or you get a task switch while the output task is busy emitting a string?
Thank you for your Warning about my debug .
really i dont see spi_init(); in new keil example.
when we use this command in mdk4.2 compiler give error.
all type of arm7 have this heavy problem or because of im beginner i have this problem? do you agree with SAM7X?
Does not workkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk need your help
I think you may have a keyboard problem! I suggest you have it checked out by a qualified technician.
Hey if you can help me , do it,if you cant please left the forum, this place is not for kidding , if you like kidding ,please add me to your messenger az59z@yahoo.com az59z@hotmail.com in this place i can make jock with you very high , and can solved my keyboard problem with you . ok? dont worry kidding with youuuuuuuuuuuuuuuuuuuuu. have nice time Amir
I am not kidding youuuuuuuuuuuuuuu must have a virussssssssss as IIIIIIIIIII seam to haveeeeeeeeee a problemmmmmmmmmm nowwwwwwwwwwww tooooooo contact you technician nowwwwwwwwwwwwwwww pleaseeeeeeeeeeee
my dear i think you have a heavy loop in your daily task, better is use the command os_tsk_delete_self (); in end of your task. seem you are the same as scratched CD in traditional cd player.haha hey creazy please help me,really i have problem with RTX-OS
hey stuart
do you worke with RTX-OS?
if you know a person that who worked with it please guid meeeeeeeeeeeeeeeeeeeeeeeeeeeee to connect he/she.
what is your email?
Have nice day
Hello do you work with RTX-OS and MMC? please help me. regard Amir
Hello guy's
Solvedddddddddddddddddddddddddddddddddddddddddddddddddddddd hura hura only need to select Thumb mode in target option (k)(k)(k)(k)(k)(k)(k)(k)(k)(k)(k)(k)(k)(k)(k)(k) have good time Amir