Hi,
Thanks for this awesome library and blogpost.
I'm trying to adapt the code to work with another type of SPI slave device and want to do a minimum of 32 bits transfers and up to 32 * 12 bits.
To read 4 Bytes at each sample i changed the samp_size variable to 4 inside adc_dma_init so that DLEN will be set to 4 bytes.
To confirm the results i connected MISO to power so the results should be all 1's if it works and I have connected SCLK, MOSI and CS to a logic analyzer.
I start the program with the following arguments: sudo ./rpi_adc_stream -N 10 -R 2000 -v
The result is only one transfer which is of 4 bytes instead of ten and the received buffer is all zeroes so the received bits in the single transfer is not read either. To confirm that my setup works I have changed back samp_size to 2 and as expected i get 10 transfers and the received buffer is all 1's.
I tried everything I can come up with and read the brcm2711 (RPI 4) datasheet multiple times to understand what could be the issue but I just can't get the SPI to behave differently for any transfer that is above 16 bits. I'm sure there just a setting I'm missing somewhere but cannot figure it out.
Any help is appreciated, thanks!
Hi,
Thanks for this awesome library and blogpost.
I'm trying to adapt the code to work with another type of SPI slave device and want to do a minimum of 32 bits transfers and up to 32 * 12 bits.
To read 4 Bytes at each sample i changed the
samp_sizevariable to 4 insideadc_dma_initso that DLEN will be set to 4 bytes.To confirm the results i connected MISO to power so the results should be all 1's if it works and I have connected SCLK, MOSI and CS to a logic analyzer.
I start the program with the following arguments:
sudo ./rpi_adc_stream -N 10 -R 2000 -vThe result is only one transfer which is of 4 bytes instead of ten and the received buffer is all zeroes so the received bits in the single transfer is not read either. To confirm that my setup works I have changed back
samp_sizeto 2 and as expected i get 10 transfers and the received buffer is all 1's.I tried everything I can come up with and read the brcm2711 (RPI 4) datasheet multiple times to understand what could be the issue but I just can't get the SPI to behave differently for any transfer that is above 16 bits. I'm sure there just a setting I'm missing somewhere but cannot figure it out.
Any help is appreciated, thanks!