Hi,
I'm using a nRF52 DK (nRF52832) and nRF5 SDK 17.0.1. to read data from an external ADC via I2S. I can read some data from the I2S bus, but I'm confused about the bit alignment.
The ADC is configured to provide 24 bit samples. The Product Specification of the nRF52832 states (on page 453):
Since I need to send the data via BLE, I want to get rid of the sign extension and only send the 24 bit samples (or 3 x 8 bits). So my strategy was the following:
1. the data handler which is called on a new interrupt by the i2s driver, writes the data to mp_block_to_check (see also the i2s example of the SDK):
2. a custom function (similar to the check_samples function of the SDK's i2s example), iterates over all 32-bit samples in mp_block to check and discards the first 8 bits (because each sample should be right-aligned and sign extended to 32-bits):
3. As you can see, the 3 x 8 bits samples are added to a queue from where they are sent via BLE.
The problem is, that the data on the receiver's side (nrf connect for desktop with nRF42840 dongle) does not match the expected data. I also saw that the sdk_config.h specifies:
So I'm confused. Is the data now right-aligned and sign-extended like stated in the Product Specs or is it aligned as I specify in the sdk_config.h?
Am I handling the bytes in the correct way or am I doing something wrong? Could my problem (received data does not match the exptected data) could have other problems?
Thanks a lot for any hints.