Post Go back to editing

CN0510 - reference code issue

Category: Software
Product Number: AD5941


      My customer is developing EIS of battery and using CN0510 reference design now.

      My customer follow the reference code (as following github link) and porting the code on their MCU platform.

     There is a issue, when we call the AppBATCtrl(BATCTRL_MRCAL, 0) ;

     we found the code is blocked by the AppBATMeasureRCAL() ;

     Actually is the interrupt is not active when wait for for INTCFlag1(0x00003014) change from 0x00008061 à to 0x00008067.

     It means the following two flags are not active,  

     1. Sinc2 filter result ready IRQ enable.

     2. DFT result IRQ enable

    So, We have following two questions

     Q1: Is there any condition preventing us from activating both IRQ flags?

     Q2: Can you provide the flow chart of AD5941 on battery EIS?

     Should you need any further information, please do not hesitate to contact me. Thanks very much.

     Have a nice day.


  • hi,

    When  INTCFlag1(0x00003014) changes from 0x00008061 à to 0x00008067,

    it means the interrupts "Sinc2 filter result ready IRQ" and "DFT result IRQ enable" are asserted. That means measured data output from Sinc2 filter and DFT Block is ready.

    AppBATMeasureRCAL() calculates RCALVolt for the range of frequencies set for sweep and prints them on terminal.

    You may run in debug mode to see at which line in AppBATMeasureRCAL() function, the code is stuck at.

  • Hi Akila,

    The logic analyzer record as shown in the figure below, the MCU instruction repeatedly reads the 0x00003014 register, waiting for the interrupt flag to change from 0x00008061 to 0x00008067, but the AD5941 interrupt flag does not change. We don't know why.

    We read the 0x00003014 register on ADI CN0510 EVM, we can read back the data is changed from 0x00008000 to 0x00008061 to 0x00008065 to 0x00008067.

    But in Our PCBA, we found the 0x00003014 register is always  0x00008061. As following picture, the code is stuck at while loop.

    Do you know why the AD5941 interrupt flag does not change ??

    Have a nice day.



  • This interrupt  occurs when FIFO is filled with measured data upto threshold value. 

    FIFO Threshold value must be set to 4 (fifo_cfg.FIFOThresh = 4;/)

    If FIFO source is set as DFT, (fifo_cfg.FIFOSrc = FIFOSRC_DFT;),

    you may ensure that DFT block and other relevent blocks before DFT are turned ON before measurement. (You may check this inside AppBATSeqMeasureGen() function)

  • Hi Aklia,

    Thanks very much for your relpy.

    My customer is traveling abroad for business now, so we will test your solution on next week and feedback the result to you before May 8.

  • Hi Akila,

    We had double check the two settings, 

    FIFOThresh = 4 & FIFOSrc = FIFOSRC_DFT that is correct as default, but the problem is still not solved. What else could cause the interrupt not to occur? (Such as the order of SPI instructions... etc.)

    In addition, we found that the SPI clock on the CN0510 is 12MHz, but the SPI clock of the customer's board is 2MHz, will SPI clock affect the interrupt  occurs ?

    Have a nice day.


  • Hi,

    Apologies. Threshold must be 2.

    pBATCfg->FifoThresh = 2;

    You may reduce BatODR and check.

  • Hi Akili,

    We set the Threshold = 2, but the problem is still not solved. 
    Could you describe "reduce BatODR and check" in detail?

    Have a nice day.


  • You may set BATOdr (outptu data rate )  to a smaller value and check.