Hi.
I am just starting to learn and introduce myself in ARM world.
I have an Olimex OKI H5003 and a KEIL ULINK-ME, and i am working with Keil MDK 4.20
I have started from a blinky project which i had to modify because it was made for a 7 segmetns display, and this board has only an status led.
Any way, i did it, and it works perfectly if i supply it with the USB cable in my laptop.
The problem exists when i want to debug it, just to work a bit with the functionality.
I disconnect the USB supply cable, and connect the Ulink Me, it energices the device too, but doesnt allow free running, it is stoped. I start the debugging mode, and select Run. Then the status led never blinks, contrary to the normal behavior.
I click stop then and it stops in an exception: Undef_Handler B Undef_Handler
If i try to go there step by step, i can never reach it, and sometimes after doing this and run it stops in : DAbt_Handler B DAbt_Handler
A different exception. Which is too wear.
I am using the system counter. and an external interrupt for a button which does nothing yet. And again. It works if i leave the ulink-me disconnected.
Does somebody have a clue ?
Thanks for the try. I double checked the pinout, but the status pin is not connected to the JTAG interface, actually JTAG have dedicated pins.
www.olimex.com/.../oki-h5003-sch.gif See ST_LED_H line on PIOC7 pin 60.
Also the unused EXINT are in PIOE pins 98 to 101.
Debugging step by step works if i set or unsed the status line, until i have to wait for a delay to be able to see a blinking led.
Next is the source code, based on the Blinky example, but not the same.
-------------------------------------------------------------------------
#include <ML675001.H> /* ML67500X definitions */ #include "Blinky.h" #include "IRQ.h" #define CCLK 60000000 /* CCLK [Hz] */ #define CYCLE 500 /* Count Cycle Time [ms] */ #define BASE8 0x100 #define BASE16 0x10000 #define BASE32 0x100000000 #define TMRVAL (BASE16 - (CCLK/16/1000)) /* System Timer Reload Value */ volatile unsigned long Tick1ms; /* 1ms Time Tick */ volatile unsigned long Counter; /* Counter Value */ volatile unsigned long Direction; /* Count Direction */ /* 0 - Up, 1 - Down */ void extint0_isr (void); void systimer_isr (void); //======================================================== //==================== System Timer ====================== //======================================================== void systimer_init (void) { IRQ_ISR[INT_SYSTEM_TIMER] = &systimer_isr; /* nIRQ[0]: ISR */ REG(ILC0) |= ILC0_ILR0 & ILC0_INT_LV1; /* nIRQ[0]: Level 1 */ REG(TMRLR) = TMRVAL; /* Set Reload Value */ REG(TMEN) = TMEN_TCEN; /* Start Timer */ } // Interrupt Service Routine --------- executed every 1 ms void systimer_isr (void) { if (REG(TMOVF) & TMOVF_OVF) { /* Check for Timer Overflow */ Tick1ms++; /* Increment 1ms Tick */ REG(TMOVF) = TMOVF_OVF; /* Clear Timer Overflow */ } } //======================================================== //================== Delay - time[ms] ==================== //======================================================== void wait (unsigned long time) { unsigned long tick; tick = Tick1ms; /* Initial 1ms Tick */ while ((Tick1ms - tick) < time); /* Wait for specified Time */ } //======================================================== //================ External Interrupt 0 ================== //======================================================== void exint0_init (void) { IRQ_ISR[INT_EX0] = &extint0_isr; /* nIRQ[22]: ISR */ REG(IDM) |= IDM_INT_E_F & IDM_IDM22; /* nIRQ[22]: Falling Edge */ REG(IRQA) = IRQA_IRQ22; /* nIRQ[22]: Clear Interrupt */ REG(ILC) |= ILC_ILC22 & ILC_INT_LV1; /* nIRQ[22]: Level 1 */ } // Service Routine ------ executed on EXINT0 Falling Edge void extint0_isr (void) { Direction ^= 1; /* Change Direction */ REG(IRQA) = IRQA_IRQ22; /* nIRQ[22]: Clear Interrupt */ } //======================================================== //================= LED Initialization =================== //======================================================== void LED_Init (void) { REG(GPPMC) = REG(GPPMC) | (1 << 7); REG(GPPOC) = REG(GPPOC) | (1 << 7); } void LED_Display (unsigned long num) { if (num&0x0001) REG(GPPOC) = REG(GPPOC) | (1 << 7); // Set bit 7 else REG(GPPOC) = REG(GPPOC) & ~(1 << 7); // Clear bit 7 } //======================================================== //==================== Main Program ====================== //======================================================== int main (void) { systimer_init(); /* System Timer Initialization */ //exint0_init(); /* Ext. Int. 0 Initialization */ LED_Init(); /* LED Initialization */ for (;;) { /* Loop forever */ LED_Display(Counter); /* Display Counter */ wait(CYCLE); /* Wait */ if (Direction == 0) { /* Check Direction */ Counter++; /* Count Up */ } else { Counter--; /* Count Down */ } } }