I am attempting to upgrade a previous project, which is using the Arduino Due to convert an analog compass to a digital one. The updated version will instead use the Teensy 3.5 and both versions are using the ADS7871 as their analog to digital converters. To do this some parts of the code had to be changed as they were using the extended Due library. These changes should be as simple as removing the pin select and SPI_CONTINUE arguments from the SPI.transfer command and replacing them with 2 digitalWrite commands first setting the chip select pin LOW before the transfer and HIGH after. However, doing this causes the output to get stuck on 45 degrees, which in binary is simply an output of all 1's.
I have tried using the SPI.begintransaction command to no success as well as a multitude of other changes. Strangely, when I change only a single, specific transfer command (the one dealing with the short "ref") from the due specific code to the general SPI library it still works perfectly. However, if I change the transfer command directly below it (the one dealing with the short "adc") which has the exact same supplemental code it breaks the code just as previously described (outputting all 1's). Attached is the code in its current state which works as designed, with the only deviation from the original code being to the single transfer command dealing with the short "ref". I have also attached 2 extremely simplified version of my code one of which uses the Due specific library and appears to work correctly and the other using the general SPI library which once again outputs all 1's.
Does anyone have any idea what could be wrong with this? I've been tearing my hair out for days trying to figure this out.
I have tried using the SPI.begintransaction command to no success as well as a multitude of other changes. Strangely, when I change only a single, specific transfer command (the one dealing with the short "ref") from the due specific code to the general SPI library it still works perfectly. However, if I change the transfer command directly below it (the one dealing with the short "adc") which has the exact same supplemental code it breaks the code just as previously described (outputting all 1's). Attached is the code in its current state which works as designed, with the only deviation from the original code being to the single transfer command dealing with the short "ref". I have also attached 2 extremely simplified version of my code one of which uses the Due specific library and appears to work correctly and the other using the general SPI library which once again outputs all 1's.
Does anyone have any idea what could be wrong with this? I've been tearing my hair out for days trying to figure this out.