[En-Nut-Discussion] PIO ports invested

Allister Mannion allister at nowatt.com
Fri Jul 31 08:54:45 CEST 2009


I'm assuming NutOS does not initialize/enable the alternate functions of
many of the IO pins on an AVR (ethernut13h) system unless you register
the device. Is this correct?

I seem to be getting the opposite out on most/all the IO pins (i.e. if I
set something high, it's actually low?). E.g.

    GpioPinSetHigh(SBBI0_CS0_PORT, SBBI0_CS0_BIT);
    GpioPinConfigSet(SBBI0_CS0_PORT, SBBI0_CS0_BIT, GPIO_CFG_OUTPUT);
    GpioPinSetHigh(SBBI0_CS1_PORT, SBBI0_CS1_BIT);
    GpioPinConfigSet(SBBI0_CS1_PORT, SBBI0_CS1_BIT, GPIO_CFG_OUTPUT);
    GpioPinSetHigh(SBBI0_CS2_PORT, SBBI0_CS2_BIT);
    GpioPinConfigSet(SBBI0_CS2_PORT, SBBI0_CS2_BIT, GPIO_CFG_OUTPUT);
    NutSleep(10000);

with avrpio.h (in *bld/include/cfg/arch) as:


        #ifndef SBBI0_CS0_PORT
        #define SBBI0_CS0_PORT AVRPORTD
        #endif
        
        #ifndef SBBI0_CS0_BIT
        #define SBBI0_CS0_BIT 7
        #endif
        
        #ifndef SBBI0_CS1_PORT
        #define SBBI0_CS1_PORT AVRPORTD
        #endif
        
        #ifndef SBBI0_CS1_BIT
        #define SBBI0_CS1_BIT 6
        #endif
        
        #ifndef SBBI0_CS2_PORT
        #define SBBI0_CS2_PORT AVRPORTD
        #endif
        
        #ifndef SBBI0_CS2_BIT
        #define SBBI0_CS2_BIT 5
        #endif


You'd expect the above to set the defined pins high, but they're low?

Any ideas?

Allister Mannion

ΠΟωaττ - saving more than you think
+41 (0) 79 - 7591554
www.nowatt.com




More information about the En-Nut-Discussion mailing list