This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AFE4300: SPI Read write issue

Part Number: AFE4300

AFE4300 is used with STM32L0 series. A start up code is generated for stm using stmcubemx.  0x6005 is written onto the DEVICE_CONTROL1 at register address 0x09. But upon reading it is showing the value 0xff. In fact all registers are showing only the values 0x00 or 0xff and no other values upon reading. The screenshot of code is attached. Please let me know the possible debug points to resolve this issue.

  • Hi Deepak,

    Following post might help you.

    e2e.ti.com/.../2658381

    Regards,
    Prabin
  • Hi Prabin,
    I went through the above e2e link. I have few queries.

    1. What is the SPI clock rate supported by AFE4300 i.e. the value of SCLK?
    2. How to make sure that SPI read and write is properly happening?
    3. 24 bit word is used for SPI communication. of that 16 bit lsb is used for sending the data i.e. 0-15, 16 to 20 for address of register, 21 to indicate read or write function. What should be the value of 22 and 23 bit ?
    4. For example DEVICE_CONTROL1 register needs to be read. Is the below process ok;
    a. Send 090000h on SDI pin
    b. wait for rdy pin to go from low to high and back to low
    c. read the value on SDOUT pin for register value
    d. rewrite DEVICE_CONTROL1 register.
    5. Is there any sample code to initialise AFE4300 for weight scale measurement mode? Please guide
  • Hi Deepak,

    Few answers,

    1) SPI clock can be 4MHz.
    2) SPI write can be checked by measuring the VLDO pin after weight scale signal chain is enabled. It should be ~1.7V. SPI read can be verified by reading the value of the known register.
    3) D22 and D23 should be 0
    4)To read DEVICE_CONTROL1 (i.e. 0x09) register do the following steps.
    a) Send 0x29,0x00,0x00 through SDIN pin. Here D21 is set to indicate it is read operation. For write this byte will be 0x09
    b) Read the SDOUT pin while step a is happening. No need to wait for ADC_RDY. ADC_RDY is needed only while reading the ADC output.
    c) Re-write the proper value for DEVICE_CONTROL1.

    Regards,
    Prabin