This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AFE4490 SPI communication and initialization sequences

Other Parts Discussed in Thread: AFE4490, AFE4900

Hello,

On a custom board with AFE4900 I'm able to communicate with AFE4490 using SPI, read and write registers. However, I have problems getting some useful response from the chip. For example I cannot start a LED pulse sequence (code below) or enter diagnostic mode (no response on DIAG_END).

Are there reference initialization sequences available?

Also, assuming that CONTROL0 SPI_READ switches the SPI into read mode - how to switch the device back to write mode? Or any SPI access to CONTROL0 is write access? What other registers are write-only?

/* Configure sampling cycle (1ms cycle with 10us dead time) */
#define CYCLE 4000
#define FRAME (CYCLE/4)
#define DTIME (40)
afe44xx_write(CONTROL0, 0x0);
afe44xx_write(CONTROL1, 0x0);
afe44xx_write(CONTROL2, 0x200); /* Disable crystal, we supply 8MHz directly */
afe44xx_write(PRPCOUNT, CYCLE);

afe44xx_write(LED2STC, 3*FRAME);
afe44xx_write(LED2ENDC, 4*FRAME-1);
afe44xx_write(LED2LEDSTC, 3*FRAME+DTIME);
afe44xx_write(LED2LEDENDC, 4*FRAME-DTIME);
afe44xx_write(ALED2STC, 0*FRAME+DTIME);
afe44xx_write(ALED2ENDC, 1*FRAME-DTIME);
afe44xx_write(LED2CONVST, 0*FRAME);
afe44xx_write(LED2CONVEND, 1*FRAME);
afe44xx_write(ALED2CONVST, 1*FRAME);
afe44xx_write(ALED2CONVEND, 2*FRAME);

afe44xx_write(LED1STC, 1*FRAME);
afe44xx_write(LED1ENDC, 2*FRAME-1);
afe44xx_write(LED1LEDSTC, 1*FRAME+DTIME);
afe44xx_write(LED1LEDENDC, 2*FRAME-DTIME);
afe44xx_write(ALED1STC, 2*FRAME+DTIME);
afe44xx_write(ALED1ENDC, 3*FRAME-DTIME);
afe44xx_write(LED1CONVST, 2*FRAME);
afe44xx_write(LED1CONVEND, 3*FRAME);
afe44xx_write(ALED1CONVST, 3*FRAME);
afe44xx_write(ALED1CONVEND, 4*FRAME);

afe44xx_write(ADCRSTCNT0, 0*FRAME);
afe44xx_write(ADCRSTENDCT0, 0*FRAME);
afe44xx_write(ADCRSTCNT1, 1*FRAME);
afe44xx_write(ADCRSTENDCT1, 1*FRAME);
afe44xx_write(ADCRSTCNT2, 2*FRAME);
afe44xx_write(ADCRSTENDCT2, 2*FRAME);
afe44xx_write(ADCRSTCNT3, 3*FRAME);
afe44xx_write(ADCRSTENDCT3, 3*FRAME);

afe44xx_write(CONTROL1, 0x103); /* Timers ON, average 3 samples */

Kind regards,

Max

  • Max, Since you are using custom board would it be possible for you to send us your schematics? It will be helpful to debug your issues.

  • Max,

    I just tried your software settings and I can get the LED pulse sequence. I'll look at your schematics when you send them to see if it is an issue in the hardware.

    Another note: What is you process for entering diagnostic mode? In order to enter, Control0 Register Bit D2 needs to be set to 1.

    Control0 is the only write only register.

  • Dear Amy,

    Thank you, schematics is attached. Regarding the diagnostic mode - do I need to perform any initialization prior entering it or writing 4 to CONTROL0 can be the very first command while communication with AFE4490?

    Kind regards

    Maxim

  • Hello Max,

    Based on the AFE4490 schematics page you attached, TX_CTRL_SUP and LED_DRV_SUP pins of AFE4490 have not been connected to any supply voltage. The datasheet recommends 3V - 5.25V for the Transmit Controller Supply and max of (3V, 1.4V+ VLED) - 5.25V for the Transmit LED driver supply.

    This is the reason why you do not see the LED pulse sequence or enter diagnostic mode.

    Regarding your question about the diagnostic mode, setting the DIAG_EN bit can be the very first command.

    A possible initialization sequence may be:

    1. Set SW_RST bit                                 –             resets all registers to default values.
    2. Set DIAG_EN bit                               –             Enable diagnostic mode
    3. Set SPI_READ bit                              –             SPI read is enabled
    4. Read DIAG register                         –             Check for fault flags
    5. Reset SPI_READ bit                         –             SPI read is disabled
    6. Configure AFE
      1. Write to Timing Control registers (0x01 – 0x1D)
      2. Write to other control registers (0x1E, 0x20 – 0x23)
    7. Set SPI_READ bit                                              –             SPI read is enable.
    8. Read ADC registers (0x2A – 0x2F)             –             from host controller either polling based or interrupt based (ADC_RDY signal interrupt)

    Update: Read the ADC registers from the host controller based on the ADC_RDY interrupt.

  • Hi Praveen,

    Thanks a lot! You are completely right, I missed this at the latest schematics revision. Now I can get a pulse train (attached). Is it how it should look (signal ramping down slowly looks a bit suspicious)?

    Regards,

    Maxim

  • Hello Maxim,

    As far as the decaying waveform of TXP, TXM is concerned, the tx switches internal to the device are turned off and so no current actually flows through the LED.

    ~Praveen.