AD5940
Recommended for New Designs
The AD5940 and AD5941 are high precision, low power analog front ends (AFEs) designed for portable applications that require high precision, electrochemical...
Datasheet
AD5940 on Analog.com
After writing c code for AD5940 SPI drivers that can read & write to the ad5940 registers, I am now trying to clone the necessary files to implement the full AD5940_BATImpedance system.
However while I can write my own "hardware porting file" code to provide the all the necessary low level SPI functions such as reading and writing to registers there appears a significant issue with integrating the core ad5940.c and ad5940.h files as there is confusion in regards to the functions defined in these files.
For example the ad5940.h file suggests that only these functions need to be implemented for specific hardware controllers ?
Further to my investigation I find that the ad5940.c and ad5940.h files are bloated up with unnecessary complexities/functions with RAW SPI functions that are not required and will not work because they do not follow the ADI SPI protocol requirements. They don’t send SPICMD_SETADDR, SPICMD_READREG, or SPICMD_WRITEREG — which are mandatory protocol requirements for AD5940 register access, so what real function or purpose do they actually perform? Are they required or used by the higher level applications ( AppBATImpedance, etc.) I cannot see how as these APP's should work even with these unnecessary functions, especially working outside the ADuCM355 ecosystem which relies on manually generated SPI CS logic unlike standard SPI control where the CS line is automatically controlled in the SPI transactions.uint32_t ad5940_read_reg32(uint16_t addr) .... read 32 bit data from 16bit address
The AD5940 SDK files (ad5940.c/.h) appear riddled with many abstractions that don’t match the actual ADI SPI protocol requirements? Its difficult to know which functions are actually needed.
Also functions are defined for 32bit writes to registers but the datasheet lists no 32 bit registers at all. They way I see it the only required RAW hardware functions that are needed to be provided are
1) void ad5940_write_reg16(uint16_t addr, uint16_t value) ... write 16bit data to 16bit address since the chip only uses 16bits
2)
3) ad5940_read_fifo() ?
I do not see the need for other functions .. can someone shed a light of these aspects?
Thanks for your help.
Collin