Created
March 23, 2026 22:58
-
-
Save philipturner/c9c765db7b832701914b487738be2847 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "DAC.h" | |
| void transferDAC2(uint8_t byte0, uint8_t byte1, uint8_t byte2) { | |
| uint8_t bytes[3]; | |
| bytes[0] = byte0; | |
| bytes[1] = byte1; | |
| bytes[2] = byte2; | |
| // TODO: When done with this investigation, archive the valuable | |
| // data in a GitHub Gist. | |
| // SPI_MODE0, FSDO = 1 | |
| // | |
| // 5 Mbps - output works, input does | |
| // 15 Mbps - output works, input does, undefined behavior one time | |
| // 16 Mbps - undefined behavior all times | |
| // 34 Mbps - output works, input does not | |
| // SPI_MODE1, FSDO = 0 | |
| // | |
| // 15 Mbps - output works, input does | |
| // 16 Mbps - output works, input does | |
| // 17 Mbps - output works, input does | |
| // 18 Mbps - output works, input does not | |
| // 20 Mbps - output works, input does not | |
| // 34 Mbps - output works, input does not | |
| // SPI_MODE1, FSDO = 1 | |
| // | |
| // 15 Mbps - output works, input does | |
| // 30 Mbps - output works, input does | |
| // 34 Mbps - output works, input does | |
| // 35 Mbps - output works, input does not | |
| // SPI_MODE2, FSDO = 0 | |
| // | |
| // 5 Mbps - output works, input does | |
| // 14 Mbps - output works, input does | |
| // 15 Mbps - output works, input does | |
| // 16 Mbps - output works, input does not | |
| // 18 Mbps - output works, input does not | |
| // 19 Mbps - output works, input does not | |
| // 20 Mbps - output works, input does not | |
| // 40 Mbps - output works, input does not | |
| // | |
| // SPI_MODE2, FSDO = 1 | |
| // | |
| // 5 Mbps - output works, input does | |
| // 14 Mbps - output works, input does | |
| // 16 Mbps - output works, input does | |
| // 20 Mbps - output works, input does | |
| // 30 Mbps - output works, input does | |
| // 32 Mbps - output works, input does | |
| // 33 Mbps - output works, input does | |
| // 34 Mbps - output works, input does | |
| // 35 Mbps - output works, input does not | |
| // 36 Mbps - output works, input does not | |
| // 40 Mbps - output works, input does not | |
| SPI.beginTransaction(SPISettings(34 * 1000000, MSBFIRST, SPI_MODE1)); | |
| digitalWrite(CS_DAC2, 0); | |
| SPI.transfer(bytes, 3); | |
| digitalWrite(CS_DAC2, 1); | |
| SPI.endTransaction(); | |
| uint32_t deviceID = 0; | |
| deviceID |= uint32_t(bytes[1]) << 8; | |
| deviceID |= uint32_t(bytes[2]); | |
| Serial.print(deviceID); | |
| Serial.print(" "); | |
| Serial.print(deviceID >> 2); | |
| Serial.println(); | |
| } | |
| // Investigate DAC1 next, find its SPI limits. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment