This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

TWI Switch between easyDMA and normal read

Hi,

I am reading a BMX055 via I2C which consists of three sensors with three addresses. I got the easyDMA running to read 10 times the gyro using the PPI and the data ready interrupt. Now after 10 readings I want to read once the accelerometer and the magnetometer. But if I try to read with

nrf_drv_twi_tx(&m_twi_instance, address, &reg, 1, false); nrf_drv_twi_rx(&m_twi_instance, address, p_data, length);

I get the NRF_ERROR_BUSY which means that the TWIM is still in use. So here is my question how can I switch from easyDMA reading to normal reading.

Thanks and kind regards,

C.

Parents
  • Yes, I see that, but in your original question you write that you call nrf_drv_twi_tx/nrf_drv_twi_rx to do the TWI transfers. The driver can be setup to use both TWIM and TWI peripheral. Have you checked the configuration in sdk_config.h to make sure TWI does not use EasyDMA (set TWI0_USE_EASY_DMA to 0). If you initialize the driver before starting the TWIM transfers, and the driver is configured to use EasyDMA (TWIM peripheral), you might end up in a state where the transfers cannot be started. Since TWIM0 and TWI0 share the same base address, you can also not have both enabled at the same time. If you want to use both, you either have to disable TWIM before initializing the TWI driver (without EasyDMA), or use TWIM1/TWI1 instance for one of the transfers.

Reply
  • Yes, I see that, but in your original question you write that you call nrf_drv_twi_tx/nrf_drv_twi_rx to do the TWI transfers. The driver can be setup to use both TWIM and TWI peripheral. Have you checked the configuration in sdk_config.h to make sure TWI does not use EasyDMA (set TWI0_USE_EASY_DMA to 0). If you initialize the driver before starting the TWIM transfers, and the driver is configured to use EasyDMA (TWIM peripheral), you might end up in a state where the transfers cannot be started. Since TWIM0 and TWI0 share the same base address, you can also not have both enabled at the same time. If you want to use both, you either have to disable TWIM before initializing the TWI driver (without EasyDMA), or use TWIM1/TWI1 instance for one of the transfers.

Children
No Data
Related