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

AT91SAM7X-EK LED Swing...

I have just received an evaluation board (AT91SAM7X256).

As usual, there are a few teething problems...

I am trying to get the LED swing demo to work, but it don't. When I load the project '\AT91SAM7X-BasicTools-KEIL_u3V3_20A-1\AT91SAM7X-BasicTools\compil\BasicSAM7_Keil.Uv2' and then enter DEBUG mode (as instructed) I get the following messages in the 'COMMAND' window...

*** Error: 'C:\Keil\ARM\BIN\AGDIRDI.DLL' not found
Include "C:\\AT91SAM7X-EK\\AT91SAM7X256-BasicTools-KEIL_u3V3_20A-1_2\\AT91SAM7X-BasicTools\\compil\\resource\\SAM7_KEIL_RAM.ini"
//
//  File: SAM7_KEIL_RAM.ini
//  User setup file for KEIL debugger
//  1.0 09/Seo/05 JPP    : Creation
// ---------------------------------------------------------
//-----------------------------------------------------------------------------
// Remap
//---------
FUNC void  CheckAndNoRemap(void) {
 int First,i,pt;
    First =_RDWORD(0x00000000);   //* Read the value at 0x0
    i=First+1;
    _WDWORD(0x00000000,i);
    pt=_RDWORD(0x00000000);
    if (i == pt) {
      printf( "------------------------------- The Remap is done ----------------------------------------\n");
     _WDWORD(0x00000000,First);

    } else {
      printf( "------------------------------- The Remap is NOT -----------------------------------------\n");
      _WDWORD(0xFFFFFF00,0x00000001);//*   Toggel RESET The remap
    }
    pt=_RDWORD(0x00100000);
    printf( " ---------------------------------------- 0x00100000:0x%08X\n",pt);
    pt=_RDWORD(0x00200000);
    printf( " ---------------------------------------- 0x00200000:0x%08X\n",pt);
    pt=_RDWORD(0x00000000);
    printf( " ---------------------------------------- 0x00000000:0x%08X\n",pt);
 }

//-----------------------------------------------------------------------------
// Watchdog
//-------------
// Normally, the Watchdog is enable at the reset for load it's preferable to
// Disable.
//-----------------------------------------------------------------------------
FUNC void  Watchdog(void) {
//* Watchdog Disable
   _WDWORD(0xFFFFFD44,0x00008000); //      AT91C_BASE_WDTC->WDTC_WDMR= AT91C_SYSC_WDDIS;
   printf( "------------------------------- Watchdog Disable ----------------------------------------\n");
}

//-----------------------------------------------------------------------------
// PllSetting
//-------------------------------
FUNC void  PllSetting(void) {
// -1- Enabling the Main Oscillator:
//*#define AT91C_PMC_MOR   ((AT91_REG *)  0xFFFFFC20) // (PMC) Main Oscillator Register
//*#define AT91C_PMC_PLLR  ((AT91_REG *)  0xFFFFFC2C) // (PMC) PLL Register
//*#define AT91C_PMC_MCKR  ((AT91_REG *)  0xFFFFFC30) // (PMC) Master Clock Register

//*pPMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x06 <<8) |    //0x0000 0600
//                          AT91C_CKGR_MOSCEN ));          //0x0000 0001
_WDWORD(0xFFFFFC20,0x00000601);

// -3- Setting PLL and divider:
// - div by 5 Fin = 3,6864 =(18,432 / 5) : Mul 25+1: Fout = 95,8464 =(3,6864 *26)
// for 96 MHz the erroe is 0.16% Field out NOT USED = 0
// PLLCOUNT pll startup time esrtimate at : 0.844 ms
// PLLCOUNT 28 = 0.000844 /(1/32768)
//       pPMC->PMC_PLLR = ((AT91C_CKGR_DIV & 0x05) |       //0x0000 0005
//                         (AT91C_CKGR_PLLCOUNT & (28<<8)) //0x0000 1C00
//                         (AT91C_CKGR_MUL & (25<<16)));   //0x0019 0000
_WDWORD(0xFFFFFC2C,0x00191C05);
// -5- Selection of Master Clock and Processor Clock
// select the PLL clock divided by 2
//     pPMC->PMC_MCKR = AT91C_PMC_CSS_PLL_CLK |     //0x0000 0003
//                           AT91C_PMC_PRES_CLK_2 ;      //0x0000 0004
_WDWORD(0xFFFFFC30,0x00000007);
//* #define AT91C_MC_FMR    ((AT91_REG *)  0xFFFFFF60) // (MC) MC Flash Mode Register
    _WDWORD(0xFFFFFF60,0x00000100);

   printf( "------------------------------- PLL  Enable ----------------------------------------\n");
}
//-----------------------------------------------------------------------------
// Reset the Interrupt Controller
//-------------------------------
FUNC void  AIC(void) {
 int i,pt;
    _WDWORD(0xFFFFF124,0xFFFFFFFF); // Mask All interrupt pAic->AIC_IDCR = 0xFFFFFFFF;
    _WDWORD(0xFFFFF128,0xFFFFFFFF); // Mask All interrupt pAic->AIC_IDCR = 0xFFFFFFFF;
// Acknownledge timer interrupt
    _RDWORD(0xFFFA0020);  // #define AT91C_TC0_SR    ((AT91_REG *)  0xFFFA0020) // (TC0) Status Register
    _RDWORD(0xFFFA0060);  // #define AT91C_TC1_SR    ((AT91_REG *)  0xFFFA0060) // (TC1) Status Register
    _RDWORD(0xFFFA00A0);  // #define AT91C_TC2_SR    ((AT91_REG *)  0xFFFA00A0) // (TC2) Status Register

// disable peripheral clock  Peripheral Clock Disable Register
    _WDWORD( 0xFFFFFC14,0xFFFFFFFF);

    for (i=0;i < 8; i++)
    {
      pt =  _RDWORD(0xFFFFF130); // AT91C_BASE_AIC->AIC_EOICR
    }
   printf( "------------------------------- AIC 2 INIT ---------------------------------------------\n");
}
//-----------------------------------------------------------------------------
// Init all register
//-------------------------------
FUNC void  Init(void) {
// Standard register
 R0 =0;
 R1 =0;
 R2 =0;
 R3 =0;
 R4 =0;
 R5 =0;
 R6 =0;
 R7=0;
 R8=0;
 R9=0;
 R10 =0;
 R11 =0;
 R12 =0;
 R13 =0;
 R14 =0;
 R15 =0;
 CPSR =0xd3;
 SPSR =0xd3;
}

FUNC void Setup (void) {
 int i;
     PllSetting();
//* Init AIC
    AIC();
//*  Get the Chip ID (AT91C_DBGU_C1R & AT91C_DBGU_C2R
    i= _RDWORD(0xFFFFF240);
    printf( " ---------------------------------------- Chip ID   0x%08X\n",i);
    i=_RDWORD(0xFFFFF244);
    printf( " ---------------------------------------- Extention 0x%08X\n",i);
    i=_RDWORD(0xFFFFFF6C);
    printf( " ------------------------------------ Flash Version 0x%08X\n",i);
//*  Watchdog Disable
    Watchdog();
//*  Set the RAM memory at 0x0020 0000 for code AT 0 flash area
     CheckAndNoRemap();
//* Init register
//     Init();

}

printf( " ---------------------------------------- Start\n");
 ---------------------------------------- Start
Setup();                             // Setup for Ram Area
*** function 'PllSetting', error 65, line 67: access violation at 0xFFFFFC20 : no 'write' permission
*** function 'Setup', error 65, line 77: access violation at 0xFFFFFC2C : no 'write' permission
LOAD Obj_KEIL\BasicSAM7_KEIL INCREMENTAL   // Download

My current setup is uVision v3.12a (compiler v2.20a) with the wonderful uLink.

Any ideas/suggestions/comments would be gratefully received.

Regards
Marcus.

0