Post Go back to editing

AD74413 and STM32

Hello.
I am trying to connect AD74413 to STM32F405 and am having trouble writing my code correctly in the function - spi_write_and_read () No-OS Software Drivers.

Maybe somewhere there are examples of using these drivers in conjunction with STM32.

Best regards, Dmitry

Parents
  • Hello,
    unfortunately we don't have any example code written for STM32 microcontrollers.

    But we have some internal examples written for ADuCM4050, but we are not licensed to share the whole project.
    Is there any specific function in the online AD74413.x files that you are interested in? I could possibly share snippets of those functions usage.

    Regards,
    Arnost

  • Thanks for the answer!
    We are only interested in the sections of code for configuring and retrieving data.
    We ourselves are electronics engineers and it is rather difficult for us to port such a driver. There is especially a danger that after transferring the code to a microcontroller with a cheaper price, there may not be enough memory ...

    Best regards, Dimtri.

Reply
  • Thanks for the answer!
    We are only interested in the sections of code for configuring and retrieving data.
    We ourselves are electronics engineers and it is rather difficult for us to port such a driver. There is especially a danger that after transferring the code to a microcontroller with a cheaper price, there may not be enough memory ...

    Best regards, Dimtri.

Children
  • Hi,

    sections about configuring and retrieving data can be found at our drivers (74413 Evaluation software https://www.analog.com/media/en/evaluation-boards-kits/evaluation-software/ad74413r.zip). You can take same steps as in driver to configure or arrange your data.

    Let me especially highlight following functions, it is good place where to start:

    static bool_t BA_Validate(uint8_t *pFrameBA, uint8_t nAdr)

    static void BA_Create(uint8_t *pFrameBA, uint8_t nAdr, uint16_t nData)

    tad74413Result ad74413API_ReceivedSPIPacket(ad74413_API_REF anAPI_Ref, tSPITransactionInfo *pExChng)

    static void SPI_AddWriteFrame32(  ad74413_API_Ptr API_Ptr,  tSPITransactionInfo *pExChng, uint8_t Adr, uint16_t Data)

     

    I am not sure, if this answers your question, if not, let me know what else I can help you with.

     

    Regards,

    Arnost

  • Thanks for the answer!
    I found examples for STM32 but for a different ADC.
    wiki.analog.com/.../ad7124-stm32
    But as I did not try to connect the AD74413 and get the answer, everything does not work ...
    For testing, I connected a flash memory to this SPI and wrote and read data perfectly into it. But AD74413 doesn't want to work ...
    Prompt the correct package so that I can test the AD74413. For example "SILICON REVISION REGISTER". Maybe I'm counting the checksum incorrectly or doing something wrong.
    Thank you in advance!
    With respect, Dmitry.

  • Hi Dmitry,

    based on the information you told me, I can suggest you, that you need to consider following:

    From datasheet is obvious that SPI read process of AD7124 is completely different from AD74413.

    Key differences are how SPI access, especially during read process.

     

    Please compare following two timing diagrams:

    AD74413R reading is performed as two stage process. (See datasheet of AD74413R Page 52, figure 57 https://www.analog.com/media/en/technical-documentation/data-sheets/AD74413R.pdf )

    Please note AD7124 will have to be modified to suit the registers access requirements of AD74413R. (See datasheet of AD7124 page 12, figure 3 https://www.analog.com/media/en/technical-documentation/data-sheets/AD7124-4.pdf )

     

    AD74413 SPI transaction is 32 bits long , the lower 8 LSBs are assigned to CRC, which are calculated at based on 24 upper bits. That might be compatible.

    We suspect that using AD7124 firmware for AD74413 is problematic.

     

    Regards,

    Arnost

  • Hi. i have the same issue. i'm trying to communicate the AD74413 with an stm32l4. 
    have you any example code to start reading data of AD74413

    thanks in advance.

    Mauricio.

  • Hi. me again . 

    I finally could communicate the AD74413 (AD-SWIO 2 Click) with my mcu (STM34L series + CubeIDE + HAL stm32).
    I'm configuring the AD in voltage input mode (0-10V) and my read mode its READBACK.

    But when i try to convert the ADC data to voltage the applying the equation [VDC = VMIN + (ADC CODE/65,535) × Voltage Range] I dont get the expected result

    for example when apply 2VDC in Channel 0 i Get 0x1AB7 = DEC 6823


    VDC = 0 + (6823/65535)x10 = 1,04Vdc

    When apply 3.2V --> 0x2A0D -->DEC 10765.

    VDC = 0 + (10765/65535)x10 = 1,64Vdc


    if i chance the Voltage Range to 20. the VDC result ist Ok.

    VDC = 0 + (6823/65535)x20 = 2,08Vdc

    VDC = 0 + (10765/65535)x20 = 3,28Vdc

    ist that normal?

  • Hello,
    I'm trying to connect the AD-SWIO 2 click to an STM32F4, I'm trying to configure one of the channels as input voltage mode and read the data as you did, can you help me with your code? Thank you.