Hi,
I have a strange issue.
I am reading values from an accelerometer.
The read values go into an array which is uint8 and 7 bytes long.
The values are read ok and they exist in the array.
When I try to move the individual values to regular uint8 variables - nothing happens. The result is zero, even if the corresponding array index has a value.
I made a test and added a delay between each line.
Now, the values get copied normally from the array to the variables.
Can someone explain why this happens, why the 52832 does not perform these lines normally without delays in between?
This does NOT work:
Accelerometer_X_L = SPI_rx_data[1]; Accelerometer_X_H = SPI_rx_data[2]; Accelerometer_Y_L = SPI_rx_data[3]; Accelerometer_Y_H = SPI_rx_data[4]; Accelerometer_Z_L = SPI_rx_data[5]; Accelerometer_Z_H = SPI_rx_data[6];
All Accelerometer_X/Y/Z variables remain zero when the SPI_rx_data array has values on every byte.
The following DOES work:
Accelerometer_X_L = SPI_rx_data[1]; nrf_delay_us(50); Accelerometer_X_H = SPI_rx_data[2]; nrf_delay_us(50); Accelerometer_Y_L = SPI_rx_data[3]; nrf_delay_us(50); Accelerometer_Y_H = SPI_rx_data[4]; nrf_delay_us(50); Accelerometer_Z_L = SPI_rx_data[5]; nrf_delay_us(50); Accelerometer_Z_H = SPI_rx_data[6]; nrf_delay_us(50);
Now the Accelerometer_,,, variables receive the values from each array index as expected.
How is this even possible?
It cannot be that the processor will not do as the code says.
Thank you!