Hi Akila, and others in you team.
I am trying to integrate the BAT Impedance application code examples with my Linux based system (no ADICUP3029 CPU)
I have written working SPI drivers for the following functions and integrated (linking to my own hardware port driver) them into the ad5940.c and ad5940.h
1. AD5940_RstClr(void);
2. AD5940_RstSet(void);
3. AD5940_HWReset(void); ...modified existing ad5940.c function
4. AD5940_Initialize(void); ... modified existing ad5940.c function
5. static void AD5940_SPIWriteReg(uint16_t RegAddr, uint32_t RegData); ... modified existing ad5940.c function (these appear to be the only truly needed SPI functions required)
6. static uint32_t AD5940_SPIReadReg(uint16_t RegAddr); ... modified existing ad5940.c function (these appear to be the only truly needed SPI functions required)
7. uint32_t AD5940_ClrMCUIntFlag(void); ... unsure if working 100% unable to confirm readback
8. uint32_t AD5940_GetMCUIntFlag(void); ... unsure if working 100%
I cannot see the need/function for any of the defined functions below ..... please enlighten me?
1. static unsigned char AD5940_ReadWrite8B(unsigned char data); .... does not support/conform to ad5941 data sheet requirements for SPI communications
2. static uint16_t AD5940_ReadWrite16B(uint16_t data) .... does not support/conform to ad5941 data sheet requirements for SPI communications
3. static uint32_t AD5940_ReadWrite32B(uint32_t data) .... does not support/conform to ad5941 data sheet requirements for SPI communications
4. void AD5940_ReadWriteNBytes(unsigned char *pSendBuffer,unsigned char *pRecvBuff,unsigned long length); ... same as above ..no conforming function.
5. Maybe the original code memory mapped the ad5940 registers etc .. but there is no information about these and how they work.
The original code examples (with ADICUP3029) use hardware controlled SPI_CS whereas my Linux code these are built-into the SPI transactions.
My SPI code can reliably read all the basic ad5940 registers including valid AD5940LIB Version: v0.2.1, ADIID: 0x4144 and CHIPID: 0x5502
1. Some functions like .. AD5940_Initialize(void); appear to work ... but for some reason I cannot seem to read-back was was written to the initialization registers, is this a common issue?
2. Running the ad5950Main.c is not retrieving and valid data as yet, not sure exactly why?
3. I have modified the BATImpedance function "static void PreCharge(unsigned char channel) " to work with my code but the EVAL-BATZ board, does not even have the jumpers JP8 or JMP9 so I wonder why this code will even work.
4. Can you please confirm all the necessary functions that are needed to make the EVAL_BATZ system work, unnecessary code and built-in connections with the ADI CPU (ADICUP3029) make it difficult to know precisely what code and functions are needed to make this work.
5. Also the ad5940 data sheet is sadly lacking in details, do you have a detailed Map or table listing all the ad5941 registers and their functions, that also state which registers are defined as 32 or 16 bit registers, Why I cannot read the initialization registers etc.
6. The ad5940 only shows 10 x 16bit registers that need to be initialized after reset by the ADI code functions (for BATZ) show many more registers that include both 16bit and 32bit reigisters.
7. The ad5940 data sheet does not list any 32 bit registers .. so what's going on?
Any help would be much appreciated.
Thanks for you help on these matters.
Collin.