[En-Nut-Discussion] Create new platform

rutger eng1 at breematic.nl
Sun Oct 24 16:50:38 CEST 2010


Hello,

External Memory Control Register B -- XMCRB
controls the pins of PORT C that will be released for normal use.

I searched in the files and found it in nut\arch\avr\os\nutinit.c

I'm not sure if the pins are released when NUTXMEM_SIZE  is changed to 0
But maybe someone with more experience can tell this.

When the pins are not released, maybe you can add code for it to nutinit.c
(or in the main code) for your board.

By the way the code you wrote will work on a atmega 128 with external memory
and e.g. PORTE

I'm just a beginner with NUT/OS, but maybe it's helpful

kind regards,

Rutger


Op 24-10-2010 12:55, Micha? Gryko schreef:
> Hi, I'm designing own platform as a student project. It's based on
> ATmega 128. I want to use NutOS on it. Hardware is ready and I used
> simple non NutOS app to test it. Here it is:
>
>   #include<avr/io.h>
>
>   // define what pins the LEDs are connected to.
>
>   #define LED PC0
>   #define F_CPU 16000000
>   // Some macros that make the code more readable
>   #define output_low(port,pin) port&= ~(1<<pin)
>   #define output_high(port,pin) port |= (1<<pin)
>   #define set_input(portdir,pin) portdir&= ~(1<<pin)
>   #define set_output(portdir,pin) portdir |= (1<<pin)
>
>   void delay_ms(uint8_t ms) {
>    uint16_t delay_count = F_CPU / 17560;
>    volatile uint16_t i;
>
>    while (ms != 0) {
>       for (i=0; i != delay_count; i++);
>       ms--;
>     }
>   }
>
>   int main(void) {
>     set_output(DDRC, LED);
>
>     while (1) {
>       output_high(PORTC, LED);
>       delay_ms(200);
>       output_low(PORTC, LED);
>       delay_ms(200);
> }
> }
>
> It's working as intended (led blinks), but when I moved to NutOS with this:
>
> #include<sys/timer.h>
>
> int main(void)
> {
> 	sbi(DDRC, 0);
> 	for(;;){
> 		cbi(PORTC, 0);
> 		NutSleep(500);
> 		sbi(PORTC, 0);
> 		NutSleep(500);
> 	}
> 	return 0;
> }
>
> build is ok, target mcu is atmega128, but nothing happens (led is
> dead). Tried on ethernut-4.8.7 and 4.9. Board has no external memory.
> Any ideas what could be wrong?
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>
>
> Geen virus gevonden in het binnenkomende-bericht.
> Gecontroleerd door AVG - www.avg.com
> Versie: 9.0.862 / Virusdatabase: 271.1.1/3216 - datum van uitgifte: 10/24/10 08:34:00
>




More information about the En-Nut-Discussion mailing list