Skip to content

cache coherency problems for DAC LUT modifications at run time #4

@fanfare-ff

Description

@fanfare-ff

Discussed in #3

Originally posted by erry11 February 5, 2025
Hello,

Thank you for sharing this library. I’ve found it extremely useful for one of my projects. I have a question regarding the "Send_DAC_Burst_Sine" example: is there a way to modify the waveform parameters at runtime or within the setup loop?

I'm not an expert in electronics or data acquisition, but my initial approach was to define a static array of N elements and, as a first test, copy the values from the sine_lut array into that array.

`

#include <SensEdu.h>
uint32_t lib_error = 0;
const uint16_t dac_cycle_num = 1;
const uint16_t sine_lut[] = {
0x0000,0x000a,0x0027,0x0058,0x009c,0x00f2,0x0159,0x01d1,0x0258,0x02ed,0x038e,0x043a,0x04f0,0x05ad,0x0670,0x0737,
0x0800,0x08c8,0x098f,0x0a52,0x0b0f,0x0bc5,0x0c71,0x0d12,0x0da7,0x0e2e,0x0ea6,0x0f0d,0x0f63,0x0fa7,0x0fd8,0x0ff5,
0x0fff,0x0ff5,0x0fd8,0x0fa7,0x0f63,0x0f0d,0x0ea6,0x0e2e,0x0da7,0x0d12,0x0c71,0x0bc5,0x0b0f,0x0a52,0x098f,0x08c8,
0x0800,0x0737,0x0670,0x05ad,0x04f0,0x043a,0x038e,0x02ed,0x0258,0x01d1,0x0159,0x00f2,0x009c,0x0058,0x0027,0x000a
};
static uint16_t custom_wave[64];

void setup() {
Serial.begin(115200);
delay(1000);
for (int i = 0; i < 64; i++)
{
  custom_wave[i] = sine_lut[i];
}
const size_t sine_lut_size = sizeof(custom_wave) / sizeof(custom_wave[0]);

SensEdu_DAC_Settings dac1_settings = {DAC1, 20*64, (uint16_t*)custom_wave, sine_lut_size, 
    SENSEDU_DAC_MODE_BURST_WAVE, dac_cycle_num};

SensEdu_DAC_Init(&dac1_settings);
 }`

The resulting custom_wave looked at the oscilloscope was not the same from sine_lut. Do you have some advice?
Thank you!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions