Other Parts Discussed in Thread: TMS320F28069,
Tool/software: Code Composer Studio
Dear colleagues,
I tried to use TMS320F28069 to control AFE031, in order to output the sine wave signal.
I used these modules of AFE031: SPI, DAC, PGA, FILTER and PA.
But I couldn't get any signal at the output of AFE031.
When I send configuration commands to AFE031, I found that F28069 received the data returned by AFE031 from time to time, is this right?
I also tried to get the value of the registers in AFE031.
For example, I try to read the 0x02 register that by default is set to 0x32, if I send two 0x8200 instructions, should the returned data be 0x8232?
In addition, whether the DAC register of AFE031 can be read or not?
Could you help me find out if there are any problems with my configuration?
Here is the configuration code:
void HAL_afe031Init(void) { HAL_afe031_cfgGpio(); HAL_spi_fifoInit(); HAL_spi_init(); HAL_afe031_regWrite(HAL_AFE031_RESET_REG,0x14); //0001 0100 DELAY_US(2); HAL_afe031_regWrite(HAL_AFE031_ENABLE2_REG, 0x06); //0000 0110 DELAY_US(2000); HAL_afe031_regWrite(HAL_AFE031_CTRL_REG, 0x08); //0000 1000 DELAY_US(2); HAL_afe031_regWrite(HAL_AFE031_CTRL2_REG, 0x00); DELAY_US(2); HAL_afe031_regWrite(HAL_AFE031_CTRL2_REG, 0x20); //0010 0000 DELAY_US(2); HAL_afe031_regWrite(HAL_AFE031_ENABLE2_REG, 0x07); //0000 0111 DELAY_US(2); HAL_afe031_regWrite(HAL_AFE031_GAINSEL_REG, 0x30); //0011 0000 DELAY_US(2); HAL_afe031_regWrite(HAL_AFE031_ENABLE_REG, 0x03); //0000 0011 DELAY_US(2); HAL_afe031_regWrite(HAL_AFE031_ENABLE2_REG, 0x0F); //0000 1111 HAL_afe031_regWrite(HAL_AFE031_ENABLE_REG, 0x23); //0010 0011 DELAY_US(2); SpiaRegs.SPICCR.bit.SPICHAR = 9; EALLOW; GpioDataRegs.GPADAT.bit.GPIO7 = 1; EDIS; } void HAL_afe031_cfgGpio(void) { EALLOW; //SD PIN GpioCtrlRegs.GPAPUD.bit.GPIO12 = 1; // Disable Pullup GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 0; // General Purpose GpioCtrlRegs.GPADIR.bit.GPIO12 = 1; // Output // SD=0 GpioDataRegs.GPADAT.bit.GPIO12 = 0; // 0 //DAC Pin Enable GpioCtrlRegs.GPAPUD.bit.GPIO7 = 1; // Disable Pullup GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 0; // General Purpose GpioCtrlRegs.GPADIR.bit.GPIO7 = 1; // Output // DAC=0 GpioDataRegs.GPADAT.bit.GPIO7 = 0; // 0 // INT Pin GpioCtrlRegs.GPAPUD.bit.GPIO6 = 1; // Disable Pullup GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 0; // General Purpose GpioCtrlRegs.GPADIR.bit.GPIO6 = 1; // Output EDIS; } void HAL_spi_fifoInit(void) { // // Initialize SPI FIFO registers // SpiaRegs.SPIFFTX.all = 0xE040; //1110 0000 0100 0000 SpiaRegs.SPIFFRX.all = 0x204F; //0010 0000 0100 1111 SpiaRegs.SPIFFCT.all = 0x0; } void HAL_spi_init(void) { SpiaRegs.SPICCR.all =0x000F; //0000 0000 0000 1111 SpiaRegs.SPICTL.all =0x0006; //0000 0000 0000 0110 SpiaRegs.SPIBRR = 1; //SPICLK = LSPCLK/4 = SYSCLK/4/4 SpiaRegs.SPICCR.bit.SPISWRESET = 1; // Ready to transmit SpiaRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb xmission } void HAL_afe031_regWrite(Uint16 addr, Uint16 data) { addr = addr & 0x7F; cmd = (addr << 8) | (data & 0xFF); SpiaRegs.SPITXBUF = cmd; DELAY_US(1); }
Best regards.