2024-06-13 03:46 AM - edited 2024-06-13 04:24 AM
Hi,
I am trying to generate waveforms using the STM32H563 microcontroller and several AD5791 DAC ICs. I am using the ADG732 Multiplexer with 5 select lines to connect my CS line to the required DAC IC. A simplified image of the hardware is provided below:
I have to generate triangle waveforms on two channels simultaneously. Generating the waveform on one channel at a time works perfectly. However, when I attempt to generate two waveforms on two channels, I get the following output:
The two triangle waves have amplitudes of 1.5V and 2.5V, but the output of both channels appears on a single channel, while the second channel remains unchanged. The SPI frequency is 10MHz. I have configured two timers to trigger interrupts based on the frequency and sampling rate of the waveform. I am storing the amplitude values (100 samples) in two different lookup tables. Every time a timer interrupt is triggered, the select value of the multiplexer is changed, and a value from the LUT is transmitted to the DAC over SPI. A few of my code snippets are provided below:
Timer IRQ Handlers:
SPI TxCpltCallback:
The select lines of the MUX (A0 - A4) are connected to the microcontroller on pins PC0 - PC4, and the output on the GPIO pins has to be inverted due to hardware limitations. It is important to note that when only one of the timers is started, the waveform is generated on the correct channel. However, things go wrong only when both timers are started together.
Solved! Go to Solution.
2024-06-13 05:02 AM
I moved the NVIC_EnableIRQ() functions to the HAL_SPI_TxCpltCallback() function and everything works fine now.
2024-06-13 05:02 AM
I moved the NVIC_EnableIRQ() functions to the HAL_SPI_TxCpltCallback() function and everything works fine now.