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
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.
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.
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.
Thanks for the answer!I found examples for STM32 but for a different ADC.wiki.analog.com/.../ad7124-stm32But 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.
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.