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: Write read operation issue

Part Number: AFE4300

Hello,

I am using AFE4300 with STM32L0. I read the datasheet and tried to turn on AFE4300 and its weight chain by writing to device control register and weight control register so that i can get a voltage at the VLDO pin and hence get weight values after connecting the load cell. But the values i write onto the registers are not coming the same when i read them. The AFE is not responding in a desirable way. Can i get suggestions as to how to overcome this problem? I am sending the bits to be written in 3 parts since its a 24 bit data frame and reading it in 2 parts since 16 bits of data are read. Any help will be appreciated. 

Thanks

Abhinav Nagaraj  

  • Hi Abhinav,

    Assuming you are successful in SPI write operation, following are the possible cause of SPI read failure.
    1) D21 of the SPI data is set to 0: For reading the register you have to set D21=1 of the data. Section 7.5.1 of the datasheet can be referred for further details.

    Regards,
    Prabin

  • stmspi.pdfhello Prabin Yadav,

    Thanks for yoursuggestion. Yes i have set D21 as 1 for read operation. But since i am using STM32L0 with AFE4300, Both have very different data frames. The opcode in AFE4300 is D21 which determines the read or write and D22 and D23 are to be 0. But in STM32L0 the opcode is determined by D22 and D23. I have attached the technical documentation for stm32. Referring to section 2.2 in the attached file. I am concerned if this is causing any problems as I have tried all possible ways of transmitting data in multiple parts and none of them seem to work. The register reads the same random value everytime I read it. Any suggestions will be appreciated. 

    Thanks and Regards

    Abhinav Nagaraj

  • Hi Abhinav,

    I am no expert in STM's programming, so my response will be limited.
    One way to solve your problem is to put the STM in write mode so that D22 and D23 are set to 0.
    Then you can set D21 to 1 as a part of your register address and send the complete packet to AFE, such that AFE thinks it is read operation.
    For example, if you want to read 0x00 register from the AFE, then program the MCU to write all 0's to register 0x20. This makes AFE to think that it is read operation for register 0x00.

    To read the data you have to sample SDOUT while writing register 0x20.

    Hope this solves your issue.

    Regards,
    Prabin