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);