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


