Go Down

Topic: Arduino due spi problem and ide1.5.3 problem (Read 920 times) previous topic - next topic

MichaelBot

Hi,

there is an other ugly bug in the SPI library.

Working with 3 different slaves on the predefined CS pins works fine, as long as only ONE of them is used in the sketch.
At the moment of the second SPI.begin(dPOTI_nCS) the DAC_nCS goes low !?! and keeps low,
the following writes to the DAC don't happen, MOSI and CLK are not changed any more.
And during the setup the CS lines are going low too, and are just updated when the first SPI.transfer is initiated.

A bugfix would be great :)


#define DAC_nCS 10
#define dPOTI_nCS 52

    // DAC
    SPI.begin(DAC_nCS);
    SPI.setClockDivider(DAC_nCS, 32);
    SPI.setBitOrder(DAC_nCS, MSBFIRST);
    SPI.setDataMode(DAC_nCS, SPI_MODE1);
   
    dacWrite(DAC_cmd_SetupDcenRefRegister, DAC_cannel_ALL, DAC_dcnrefmode_AlloneOn);
    dacWrite(DAC_cmd_PowerDownUp, DAC_cannel_ALL, DAC_powermode_NormalOn);

   
    // Digital Poti
    delay(1);
    SPI.begin(dPOTI_nCS);

Go Up