Dear Support Team,
I'm currently working with the AD9269 (ad9269bcpz-80) and I'm encountering a series of difficulties in programming. It seems like I'm not sampling the data as I expect, and I'm not sure if it's due to how I'm programming the registers (both local and global).
Specifically, I'm trying to obtain sampling via SPI (as seen in datasheet's Figure 3) through multiplexing and in two's complement. I understand that in this mode, I'll find CHA-CHB on one output and CHB-CHA on the other (unless I activate the Output invert bit). Am I correct?
First, I'll attach how I'm doing it to provide context:
A completed register map is defined by default (including the values given by the datasheet).
void Ad9269::setDefaultRegMap(void) { this->setReg(Reg000::INDEX, Reg000::ADDRESS, Reg000::DEFAULT_VALUE); // SPI port this->setReg(Reg001::INDEX, Reg001::ADDRESS, Reg001::DEFAULT_VALUE); // Chip ID this->setReg(Reg002::INDEX, Reg002::ADDRESS, Reg002::DEFAULT_VALUE); // Chip grade this->setReg(Reg005::INDEX, Reg005::ADDRESS, Reg005::DEFAULT_VALUE); // Channel index this->setReg(Reg008::INDEX, Reg008::ADDRESS, Reg008::DEFAULT_VALUE); // Modes //etc }
This is how each register instantiation is depicted. It entails the address, index, and the respective masks for each relevant bit. The presented instance corresponds to register 0x05 (Channel index).
class Reg005 { public: static constexpr uint16_t ADDRESS = 0x0005; static constexpr uint32_t INDEX = 3; static constexpr uint8_t CHANNEL_A_BIT_MASK = (1 << 0); static constexpr uint8_t CHANNEL_B_BIT_MASK = (1 << 1); static constexpr uint8_t DEFAULT_VALUE = 0x03; };
As follows configuration of the previously mentioned multiplexed acquisition.The configuration of channels 1 and 2, respectively, are shown down below.
- ADC A/B is selected (Reg 0x05)
- OUTPUT MUX and the TWO COMPLEMENT are added. (Reg 0x14)
- OUTPUT A/B is assigned. (Reg 0x2E)
- TRANSFER bit set to 1 (autoclear). (Reg 0xFF)
// channel 1 to ADC A output tmp_index = Ad9269::Reg005::INDEX; tmp_value = Ad9269::Reg005::CHANNEL_A_BIT_MASK; StrInfoLog << "Channel 1 ADC config, data format is: " << StrLib::toStr(p_adc_int_format); this->m_adc_.setValue(tmp_index, tmp_value); this->m_axi_spi_ptr_->programSlaveReg(this->m_adc_, tmp_index); tmp_index = Ad9269::Reg014::INDEX; tmp_value = Ad9269::Reg014::OUTPUT_MUX_EN_BIT_MASK; if (p_adc_int_format) tmp_value |= Ad9269::Reg014::TWO_COMPLEMENT_BIT_MASK; this->m_adc_.setValue(tmp_index, tmp_value); this->m_axi_spi_ptr_->programSlaveReg(this->m_adc_, tmp_index); tmp_index = Ad9269::Reg02E::INDEX; tmp_value = Ad9269::Reg02E::OUTPUT_ASSIGN_ADC_A_VALUE; this->m_adc_.setValue(tmp_index, tmp_value); this->m_axi_spi_ptr_->programSlaveReg(this->m_adc_, tmp_index); tmp_index = Ad9269::Reg0FF::INDEX; tmp_value = Ad9269::Reg0FF::TRANSFER_BIT_BASK; this->m_adc_.setValue(tmp_index, tmp_value); this->m_axi_spi_ptr_->programSlaveReg(this->m_adc_, tmp_index); std::this_thread::sleep_for(std::chrono::microseconds(100)); // channel 2 to ADC B output tmp_index = Ad9269::Reg005::INDEX; tmp_value = Ad9269::Reg005::CHANNEL_B_BIT_MASK; StrInfoLog << "Channel 2 ADC config, data format is: " << StrLib::toStr(p_adc_int_format); this->m_adc_.setValue(tmp_index, tmp_value); // this->m_adc_.programReg(tmp_index, this->getAxiSpi()); this->m_axi_spi_ptr_->programSlaveReg(this->m_adc_, tmp_index); tmp_index = Ad9269::Reg014::INDEX; tmp_value = Ad9269::Reg014::OUTPUT_MUX_EN_BIT_MASK; if (p_adc_int_format) tmp_value |= Ad9269::Reg014::TWO_COMPLEMENT_BIT_MASK; this->m_adc_.setValue(tmp_index, tmp_value); // this->m_adc_.programReg(tmp_index, this->getAxiSpi()); this->m_axi_spi_ptr_->programSlaveReg(this->m_adc_, tmp_index); tmp_index = Ad9269::Reg02E::INDEX; tmp_value = Ad9269::Reg02E::OUTPUT_ASSIGN_ADC_B_VALUE; this->m_adc_.setValue(tmp_index, tmp_value); // this->m_adc_.programReg(tmp_index, this->getAxiSpi()); this->m_axi_spi_ptr_->programSlaveReg(this->m_adc_, tmp_index); tmp_index = Ad9269::Reg0FF::INDEX; tmp_value = Ad9269::Reg0FF::TRANSFER_BIT_BASK; this->m_adc_.setValue(tmp_index, tmp_value); // this->m_adc_.programReg(tmp_index, this->getAxiSpi()); this->m_axi_spi_ptr_->programSlaveReg(this->m_adc_, tmp_index); std::this_thread::sleep_for(std::chrono::microseconds(100));
When I review the data obtained from both channels, I find exactly the same result in CH_A and CH_B.
- Could it be that the transfer bit is being used incorrectly?
- Could it be overwriting the data?
- Do I need to apply the transfer bit every time I change a register?
- Do I need to change different registers than the presented ones?
A small example (pseudocode) of the programming's workflow would also be greatly helpful.
*Adding that the SPI is working correctly, I've already verified with the oscilloscope that all data was written correctly to the registers; theoretically, that's not the source of the issue.*
Your assistance in resolving this matter would be greatly appreciated.
Thank you for your attention to this request.
Best regards,
agf,