AFE4403: Multiple Data Reads

Part Number: AFE4403


Hi , 

We want to read registers 0x2A to 0x2F in a single SPI transmission. The datasheet said it support "Multiple data reads and writes"(ch8.5.2.3). So we attempted an SPI transfer (address set to 0x2A, read length 18 bytes), but the result was that only the 0x2A register could successfully read the correct value, while all the other registers were incorrect. Do you have the any suggestions for us?

Thanks.

BR

Trevor

  • Hi Trevor,

    What is the exact sequential process you are using to conduct the multiple data read/writes? Additionally, have you verified (with individual reads) that the contents of registers 0x2B-0x2F were written correctly?

    Regards,

    Payton

  • Hi Payton, 

    We can read one register at a time using the code below, And using the code below, we can correctly read back 0x2a~0x2f, 

    AFE44xx_Reg_Read(42);

    AFE44xx_Reg_Read(43);

    AFE44xx_Reg_Read(44);

    AFE44xx_Reg_Read(45);

    AFE44xx_Reg_Read(46);

    AFE44xx_Reg_Read(47);

    unsigned long AFE44xx_Reg_Read(unsigned char Reg_address)
    {
    	HAL_StatusTypeDef ret;
    	uint8_t recv_char[4] = { 0};
    	unsigned long retVal;
    
    	//Enable_AFE44xx_SPI_Read();
    
    	HAL_GPIO_WritePin(AFE_CS_GPIO_Port, AFE_CS_Pin, GPIO_PIN_RESET);
    
    	ret = HAL_SPI_TransmitReceive(&hspi1, (uint8_t*)&Reg_address, (uint8_t*)recv_char, sizeof(recv_char), 1000);
    	if (ret != HAL_OK) {
    		printf("There is a problem with the SPI HAL_SPI_Transmit %d\r\n", ret);
    	}
    
    	HAL_GPIO_WritePin(AFE_CS_GPIO_Port, AFE_CS_Pin, GPIO_PIN_SET);
    
    }

    Regarding multiple data reads, we modified the above function by simply increasing the size of the receive buffer and only calling the AFE44xx_Reg_Read(42) function; however, only the value of register 0x2a is correct.

    from uint8_t recv_char[4] = {0};

    to uint8_t recv_char[4 + 4 + 4 + 4 + 4 + 4] = {0};

    BR

    Trevor

  • Hello Trevor,

    Apologies for the delay. Due to a high volume of requests, I'll be able to get you a response by end-of-this-week.

    Regards,

    Payton

  • Hello Trevor,

    I've double-checked the "Multiple Data Reads and Writes" functionality, and can confirm that the intended use case for that feature is to allow writing data to a register and then automatically reading from the same register. It does not support continuously reading from consecutive AFE4403 registers without sending the register address.

    Regards,

    Payton