RNO-G / radiantBoardManager

RADIANT board manager Arduino sketch (in development)
0 stars 1 forks source link

DAC Readbacks #1

Open cozzyd opened 3 years ago

cozzyd commented 3 years ago

Some DAC values (e.g. the digitizer pedestal) can take a while to settle. It would be useful to have readbacks so that these don't have to be set every time to be in a well-defined state.

It might even be ok to just cache the values on the MCU rather than actually implementing readback of the chips, which looks slightly annoying (since it makes you read back all channels at once), although getting that to survive an MCU reset is a bit more annoying (may require some linker map magic to avoid zeroing on startup).

barawn commented 3 years ago

Eh, I'll just add readback. It's not that big of a deal.

The ones you actually care about (the pedestal) are actually on MCP4725s which are only single-channel DACs, so really not a big deal.

I'm splitting up the reads into two registers (at the DAC address and at 128+the DAC address) since they're too big for 32-bits. Splitting them at the boundary between DAC register and EEPROM values, so if you care about the DAC bits you read the DAC address, if you care about the EEPROM you read 128+the DAC address.

If that readback works I'll similarly add "write to EEPROM" registers at 128+ the DAC address. Might enforce the DAC EEPROM wait there too (might mean an "ack timeout" might have to be increased, wait time is ~50 ms).