Other Parts Discussed in Thread: DAC81404
Tool/software:
Hello, we have just implemented the DAC81402 converter in our assembly, driven by our STM32G431CBU processor.
Of course, we were inspired by the assembly of your DAC81404 Evaluation Module and BP-DAC81404EVM, BP-DAC61402EVM test boards.
We want to use it in bipolar + or - 10VDC mode. For the moment, we have validated its power supply and started programming (initialization and control), but we are unable to generate output voltages.
Although we have verified and measured it, could you please confirm our schematic?
Also, here are our lines of code
void DAC81402_Init(void) {
// CLR bas puis haut (reset logiciel)
HAL_GPIO_WritePin(DAC_CLR_GPIO_Port, DAC_CLR_Pin, GPIO_PIN_RESET);
HAL_Delay(1);
HAL_GPIO_WritePin(DAC_CLR_GPIO_Port, DAC_CLR_Pin, GPIO_PIN_SET);
// RST haut (actif à 0 normalement, donc on relâche à 1)
HAL_GPIO_WritePin(DAC_RST_GPIO_Port, DAC_RST_Pin, GPIO_PIN_SET);
HAL_Delay(10);
// GAIN = 0x0000 → tous les DACs en ±10.8 V
DAC81402_WriteRegister(0x04, 0x0000);
// Activer toutes les sorties (0 = activé)
DAC81402_WriteRegister(0x02, 0x0000);
// Optionnel : forcer une impulsion LDAC
HAL_GPIO_WritePin(DAC_LDA_GPIO_Port, DAC_LDA_Pin, GPIO_PIN_RESET);
HAL_Delay(1);
HAL_GPIO_WritePin(DAC_LDA_GPIO_Port, DAC_LDA_Pin, GPIO_PIN_SET);
}
void DAC81402_WriteRegister(uint8_t regAddr, uint16_t value)
{
uint8_t txBuffer[3];
// Trame 24 bits : 8 bits adresse + 16 bits data
txBuffer[0] = regAddr & 0x7F; // MSB: adresse du registre (bit 7 = 0 pour écriture)
txBuffer[1] = (value >> 8) & 0xFF; // Données, MSB
txBuffer[2] = value & 0xFF; // Données, LSB
// Baisser SYNC (actif bas)
HAL_GPIO_WritePin(DAC_SYNC_GPIO_Port, DAC_SYNC_Pin, GPIO_PIN_RESET);
// Transmission SPI
HAL_SPI_Transmit(&hspi1, txBuffer, 3, HAL_MAX_DELAY);
// Remonter SYNC (fin de trame)
HAL_GPIO_WritePin(DAC_SYNC_GPIO_Port, DAC_SYNC_Pin, GPIO_PIN_SET);
}
void DAC81402_SetOutput(uint8_t dac_channel, uint16_t value) {
// dac_channel = 0 → DAC A, 1 → DAC B, etc.
if (dac_channel > 3) return;
uint8_t reg = 0x08 + dac_channel; // 0x08 = DAC A, 0x09 = DAC B, etc.
DAC81402_WriteRegister(reg, value);
}
And We launch in main
// Sortie A → +10V, Sortie B → -10V
DAC81402_SetOutput(0, 0xFFFF); // DAC A → +10V
//DAC81402_SetOutput(0, 61867); // ≈ +10 V
DAC81402_SetOutput(1, 0x0000); // DAC B → -10V
//DAC81402_SetOutput(1, 1700); // ≈ -10 V
Do you have any recommendations to help us move forward?
Thank you for your help.
Have a nice day.