Hi All,
I actually created some work with an Arduino Due. I try to read external 16 bit AD converters which require a CS, conversion signal, SPI clock and MISO.
The CS here is a bit special, because I need tons of them I generate them with digitalWrite.
The plot attached shows on CH1 how the CS looks like (good).
The conversion signal shall be set low by digitalWrite(41, LOW) but the plot CH2 shows that it does not! Instead it decays very slowly!
By the way it does not matter what I connect to it. I can disconnect it, put a 1k resistor to GND or whatever, it always looks like this.
I then tried as well to do the same independently from the SPI communication on another pin (8). When I use for example ShiftOut and put the data line to 8, then it works fine, but if I use digitalWrite alone in the 100ms loop then it decays slowly again.
I do not really have an explanation to this, but what I do not really understand is what the firmware does:
extern void digitalWrite( uint32_t ulPin, uint32_t ulVal )
{
/* Handle */
if ( g_APinDescription[ulPin].ulPinType == PIO_NOT_A_PIN )
{
return ;
}
if ( PIO_GetOutputDataStatus( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin ) == 0 )
{
[b]PIO_PullUp( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin, ulVal ) ;[/b]
}
else
{
[b] PIO_SetOutput( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin, ulVal, 0, PIO_PULLUP [/b]) ;
}
}
Once it uses PIO_PullUp and once PIO_SetOutput and I cannot figure out why and when.
Any ideas?
Thanks.
Cheers
Felix