ADC data transfer (V2.02)

I am trying to understand how the data is transferred from the device to the software.

As far as I could deduce the data is put into the Samples_Buffer_t struct (Hardware/DeviceV2_02/Firmware/Main.c · master · Zred / openZmeter · GitLab) by the function DMA_CH1_ISR() (Hardware/DeviceV2_02/Firmware/Main.c · master · Zred / openZmeter · GitLab).

There is some pointer magic happening which I do not understand. Why there is the Offset variable? To reduce the size? How does Ptr look like?

After the buffer is filled it can be send once a send command comes from the control software. This seems to happen in USB_HandleEP1_TX (Hardware/DeviceV2_02/Firmware/Main.c · master · Zred / openZmeter · GitLab)

Why is there a 32 counter? BUFF_LEN seems to be a much larger value? How is it actually transmitted?

The device is set up in DeviceV2.cpp. The data is received by DeviceV2::ReadCallback and cast back into its original form. Then it is added to the buffer of the Analyser. Is that correct? How are the other non waveform channels extracted?

Thanks in advance!


Offset is a value readed from other adc input connected to midpoint voltage reference, and is used to reduce noise and zero offset in samples.

USB_HandleEP1_TX is triggered each time USB can read data from device, however USB can send only 64bytes transfer OR 32 samples of 16 bits, thats why you see 32.

Mainly we have a big buffer where DMA can write and USB can read. DMA write 7 samples on each interrupt, and USB can write up to 32 samples on each interrupt.

I do not understant your last question. Device only send waveform, all other parameters, ffts etc are computed by analyzersoft.