I tried implementing ADC code and SPI code in the TMS570LS1224 device. The SPI code is running but the ADC doesn't give data when I try looking at the expressions window in CCS debug.
But if I run the ADC code or SPI code separately I don't face any issue at all.
Please let me know if I need to change anything while combine the SPI and ADC code together.
CODE:
/* USER CODE BEGIN (0) */
/* USER CODE END */
/* Include Files */
#include "sys_common.h"
/* USER CODE BEGIN (1) */
#include "mibspi.h"
#include "adc.h"
#include "sci.h"
#include "gio.h"
#include "system.h"
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
/* USER CODE END */
//uint16 count = 3;
adcData_t adc_data[12];
int main(void)
{
/* USER CODE BEGIN (3) */
uint32 ch_count=0;
uint32 id =0;
uint32 value =0;
uint16_t reset[] = { 0XD000, 0XD000, 0XD000, 0XD000 }; // reset all status registers
hetInit();
gioInit();
mibspiInit(); /*initialize the spi */
// command execution flow
// reset --> start --> write c5 --> data for c5 --> write for c3 -->data for c3 --> stop --> read c5 --> read c3 --> read c3
mibspiSetData(mibspiREG1, 0, reset); // set the data into mibspiREG1 register
mibspiTransfer(mibspiREG1,0); // Start the data transfer from the mibspiREG1 register
while(!(mibspiIsTransferComplete(mibspiREG1,0))); // Check if the transfer is completed, only then send the next set of data
while(1)
{
/* ... wait and read the conversion count */
while((adcIsConversionComplete(adcREG1,adcGROUP1))==0);
ch_count = adcGetData(adcREG1, adcGROUP1,&adc_data[2]);
ch_count = ch_count;
/* conversion results : */
/* adc_data[0] -> should have conversions for Group1 channel1 */
/* adc_data[1] -> should have conversions for Group1 channel2 */
id = adc_data[2].id;
value = adc_data[2].value;
};