[En-Nut-Discussion] Olimex SAM9-L9260 board
af_80
a_funk80 at yahoo.de
Tue Jun 10 15:09:14 CEST 2008
Wow it works now. I connected both pins of the solder jumper placed near the
user button. Than my program was unable to start. After this i have
disoldered this and tried to run my program again. I now its works! I dont
know why but it runs fine. I have looked at the schematic but i can't
understand the given situation. If some one looking for code and have the
same issues here is the example which runs so as I want. Also attache
http://www.nabble.com/file/p17755037/x-b_icard.zip x-b_icard.zip d project
folder so u can extract it to your "nutapp-sam9260ek" folder and use with
eclipse/yagarto. Thx you all for help!
#include <compiler.h>
#include <cfg/os.h>
#include <stdio.h>
#include <io.h>
#include <dev/board.h>
#include <sys/thread.h>
#include <sys/timer.h>
#include <sys/event.h>
#include <dev/twif.h>
#include <dev/irqreg.h>
#include <arch/arm/at91_pio.h>
void Led1Off(void)
{
outr(PIOA_OER, _BV(6));
outr(PIOA_SODR, _BV(6));
NutSleep(200);
}
void Led1On(void)
{
outr(PIOA_OER, _BV(6));
outr(PIOA_CODR, _BV(6));
NutSleep(200);
}
int main(void)
{
u_long baud = 115200;
unsigned int val;
NutRegisterDevice(&DEV_DEBUG, 0, 0);
freopen(DEV_DEBUG_NAME, "w", stdout);
_ioctl(_fileno(stdout), UART_SETSPEED, &baud);
printf("\nNut/OS Version: %s", NutVersionString());
printf("\nCPU running at %lu MHz", NutGetCpuClock()/1000000);
printf("\nProgram loaded...\n");
outr(PMC_PCER, _BV(PIOC_ID));
outr(PIOC_PER, _BV(15)); //enable pio control
outr(PIOC_ODR, _BV(15)); //set pin as input
for(;;)
{
val = (inr(PIOC_PDSR) & _BV(15));
if(val)
{
Led1Off();
}
else
{
puts("\n Button pressed");
}
Led1On();
Led1Off();
}
}
--
View this message in context: http://www.nabble.com/Olimex-SAM9-L9260-board-tp17717279p17755037.html
Sent from the MicroControllers - Ethernut mailing list archive at Nabble.com.
More information about the En-Nut-Discussion
mailing list