SAM7X256 ISR problem in RTX-RTOS

This forum is for users of Atmel's SAM Series and who are interested in using µC/OS-II, The Real-Time Kernel.

Moderator: nferre

Mohammads
Posts: 14
Joined: Tue Jun 14, 2011 7:08 am

SAM7X256 ISR problem in RTX-RTOS

Sat Oct 05, 2013 9:43 am

Hello
I have same problem like described in this post:
http://www.keil.com/forum/18555/
didn't helped!?

The PWM ISR works correctly without using RTX, but in RTX mode, after the first ISR, a run-time error occur :

Code: Select all

#include "AT91SAM7X256.H"
#include "RTX_Conf_SAM7X.c"

unsigned long int c;
float a;
OS_TID T1,T2,T3;


 __irq void PWMI()
 {
         isr_evt_set(0x25,T2);
         AT91C_BASE_PWMC -> PWMC_ISR=4;
         AT91C_BASE_AIC -> AIC_EOICR =0;
 }


__task void Task1(void)
{
        unsigned long int cnt;
        while(1)
                {
                        AT91C_BASE_PIOA -> PIO_SODR = 1 <<8;
                        for(cnt=0;cnt<1000000;cnt++);
                        AT91C_BASE_PIOA -> PIO_CODR = 1 <<8;
                        for(cnt=0;cnt<1000000;cnt++);
                }
}
__task void Task2(void)
{
        os_evt_wait_or(0x25,0xffff);
        os_dly_wait(150);
}


__task void Starter_Task(void)
{
        T1=os_tsk_create(Task1,1);
        T2=os_tsk_create(Task2,1);
        os_tsk_delete_self();
}

int main()
{
        AT91C_BASE_PMC -> PMC_PCER=1<<2;       //Enable PIOA Clock
        AT91C_BASE_PIOA->PIO_OER=1<<8;
        AT91C_BASE_PMC -> PMC_PCER=1<<3;       //Enable PIOB Clock
        AT91C_BASE_PMC -> PMC_PCER=0x400;    //Enable PWM Clock
        //////////////Config AIC//////////////
        AT91C_BASE_AIC -> AIC_IDCR=0x400;
        AT91C_BASE_AIC -> AIC_SMR[10]=0x47;
        AT91C_BASE_AIC -> AIC_SVR[10]=(unsigned int)PWMI;
        AT91C_BASE_AIC -> AIC_ICCR=0x400;
        AT91C_BASE_AIC -> AIC_IECR=0x400;
        //////////////////////////////////////
        AT91C_BASE_PIOB -> PIO_PDR=0x200000;
        AT91C_BASE_PIOB -> PIO_ASR=0x200000;//Select Peripheral A
        AT91C_BASE_PWMC_CH2 -> PWMC_CMR=0xA;//Set MCK/8 for clock
        AT91C_BASE_PWMC_CH2 -> PWMC_CPRDR=10240;//Frequency=6.7138554216867469879518072289157 KHz
        AT91C_BASE_PWMC_CH2 -> PWMC_CDTYR=5120;//Set Dutycycle to 50%
        AT91C_BASE_PWMC -> PWMC_IER=4;//Enable PWM2 Interrupt
  AT91C_BASE_PWMC -> PWMC_ENA=4;//Enable PWM2
        os_sys_init(Starter_Task);
}
*Scheduler is in round-robin mode.
I'm using KEIL 4.72a.
what's wrong with these codes ?
Can someone help me?
Thanks
jorgesalarcon
Posts: 1
Joined: Wed Mar 26, 2014 5:35 pm

Re: SAM7X256 ISR problem in RTX-RTOS

Wed Mar 26, 2014 5:39 pm

Do you still have the same problem?

Return to “- µC/OS-II - Real-Time Kernel”

Who is online

Users browsing this forum: No registered users and 1 guest