[En-Nut-Discussion] Olimex SAM9-L9260 board

af_80 a_funk80 at yahoo.de
Tue Jun 10 14:20:23 CEST 2008


I hold the button for few seconds so that pressed button shout be registered
by for-loop. I tried this now with MPC_PCER but also without a positive
result. Further i tried this arm7 example to use on my olimex arm9 board:
http://www.ethernut.de/nutwiki/AT91SAM7X-EK_Port_I/O (of course)

I can compile it without any errors and warnings, but i never want run...
Do you have the same board so you can check my example?


best regards

artur



Lars Tore Skau wrote:
> 
> Hello again..
> 
> forgot to mention that you need to enable the peripheral clock!
> 
> try to add(before your for loop):
> outr(PMC_PCER, _BV(PIOC_ID)); //enable peripheral clock
> 
> that said, if you really want to read button presses to perform actions,
> you
> should try the pio level change interrupt, or use a timer to scan the
> buttons..
> 
> 
> - Lars Tore
> 
> 
> On Tue, Jun 10, 2008 at 1:18 PM, af_80 <a_funk80 at yahoo.de> wrote:
> 
>>
>> I doesn' works. Here is the complete code for this example:
>> #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>
>>
>> void Led1Off(void)
>> {
>>    outr(PIOA_OER, _BV(6));
>>    outr(PIOA_SODR, _BV(6));
>>    NutSleep(500);
>> }
>>
>> void Led1On(void)
>> {
>>    outr(PIOA_OER, _BV(6));
>>    outr(PIOA_CODR, _BV(6));
>>    NutSleep(500);
>> }
>>
>> int main(void)
>> {
>>    u_long baud = 115200;
>>
>>    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(PIOC_PER, _BV(15)); //enable pio control
>>    outr(PIOC_ODR, _BV(15)); //set pin as input
>>
>>    for(;;)
>>    {
>>        if((inr(PIOC_PDSR) & _BV(15)) ? 1 : 0)
>>        {
>>                 Led1Off();
>>        }
>>        else
>>        {
>>                puts("\n Button pressed");
>>        }
>>
>>       Led1On();
>>       Led1Off();
>>    }
>> }
>>
>>
>> The LED's are blinking all the time but the reading from pin produce no
>> action.  I tried thes sample also with ext-header connector on port_pin
>> pb22
>> also not successful :(
>>
>> I don't know about this problem, maybe Ethernut requires that peripheral
>> should be explicit disabled before using of gpio ?
>> --
>> View this message in context:
>> http://www.nabble.com/Olimex-SAM9-L9260-board-tp17717279p17752980.html
>>  Sent from the MicroControllers - Ethernut mailing list archive at
>> Nabble.com.
>>
>> _______________________________________________
>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
> 
> 

-- 
View this message in context: http://www.nabble.com/Olimex-SAM9-L9260-board-tp17717279p17754040.html
Sent from the MicroControllers - Ethernut mailing list archive at Nabble.com.




More information about the En-Nut-Discussion mailing list