Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: AS6 - pio_configure_pin function error?
PostPosted: Thu Jun 21, 2012 2:04 pm 
Offline

Joined: Tue May 30, 2006 4:22 pm
Posts: 14
Location: The Netherlands
Maybe I discoverd an error in the pio_configure_pin function for the SAM3U4.

When you set the output (ul_flags) to PIO_TYPE_PIO_OUTPUT_0, it is going wrong.

PIO_TYPE_PIO_OUTPUT_0 is defined as 0x6
PIO_TYPE_PIO_OUTPUT_1 is defined as 0x7

Nearly at the end in this function, there is the call:
Code:
   pio_set_output(p_pio, (1 << (ul_pin & 0x1F)),
      (ul_flags & PIO_TYPE_PIO_OUTPUT_1),
      ((ul_flags & PIO_OPENDRAIN)         == PIO_OPENDRAIN)         ? 1 : 0,
      ((ul_flags & PIO_PULLUP)            == PIO_PULLUP)            ? 1 : 0);


That goes wrong, since 0x6 & 0x7 still is a boolean true.

The next modified call results always in a 1 for the initial pio level test, but who can tell me wy:
Code:
   pio_set_output(p_pio, (1 << (ul_pin & 0x1F)),
      (((ul_flags & PIO_TYPE_PIO_OUTPUT_1) == PIO_TYPE_PIO_OUTPUT_1) ? 1 : 0),
      ((ul_flags & PIO_OPENDRAIN)         == PIO_OPENDRAIN)         ? 1 : 0,
      ((ul_flags & PIO_PULLUP)            == PIO_PULLUP)            ? 1 : 0);


Only the next call works fine:
Code:
       int test = 0;
   ((ul_flags & PIO_TYPE_PIO_OUTPUT_1) == PIO_TYPE_PIO_OUTPUT_1) ? test=1 : 0;
   pio_set_output(p_pio, (1 << (ul_pin & 0x1F)),
      test,
      ((ul_flags & PIO_OPENDRAIN)         == PIO_OPENDRAIN)         ? 1 : 0,
      ((ul_flags & PIO_PULLUP)            == PIO_PULLUP)            ? 1 : 0);

_________________
Marien


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: