Hi,
I am trying to modify evamomapl138_test_upp example code to drive ADC attached with UI board. I am trying to use only UPP channel A to receive samples from ADC. I am unable to see the proper sine wave at Graph window. Analog signal applied to ADC input is 10 kHz with 1 Vp_p.
Following are the modified code. Please have a look and suggest where I am wrong.
#pragma DATA_ALIGN(recv_buffer,64)
volatile int16_t recv_buffer[64];
//setup UPP
I2CGPIO_init(I2C_ADDR_GPIO_UI); //IO expander on UI board
I2CGPIO_setOutput(I2C_ADDR_GPIO_UI, I2C_GPIO_UI_SELA, OUTPUT_HIGH);
I2CGPIO_setOutput(I2C_ADDR_GPIO_UI, I2C_GPIO_UI_SELB, OUTPUT_LOW);
I2CGPIO_setOutput(I2C_ADDR_GPIO_UI, I2C_GPIO_UI_SELC, OUTPUT_LOW); // only ADC is enable
//Setup ADC Clock
CDCE913_setOutput(cdce913_output_2, 6); //set to 4.5Mhz
uint32_t executeTest(void)
{
upp_config_t config;
UPXS2_t * UPIS2r = (UPXS2_t *)&(UPP->UPIS2);
//UPCTL
config.UPCTL.value=0;
config.UPCTL.bits.DPFA = 0;
config.UPCTL.bits.DPWA = 2;
config.UPCTL.bits.IWA = 1;
config.UPCTL.bits.CHN = 0; //only channel A is active
config.UPCTL.bits.MODE = 0; //All receive mode
//UPIVR
config.UPIVR.value=0;
config.UPIVR.bits.VALA = 0x0000;
//UPTCR
config.UPTCR.value=0; //all values 0 for 64byte DMA bursts read / write
//UPDLB
config.UPDLB.value=0; //no loopback
//UPIES
config.UPIES.value=0; //dont enable any interrupts
//UPPCR
config.UPPCR.value = 0;
config.UPPCR.bits.EN = 1; //enable uPP
config.UPPCR.bits.RTEMU = 1; //allow emulator use
config.UPPCR.bits.SOFT = 1; //allow emulation
UPP_init(&config);
printf("---Collecting 64 samples from ADC---\r\n");
UPP->UPID0 = (uint32_t)&recv_buffer;//add next DMA transfer
UPP->UPID1 = 0x00010080; //1 lines 128 bytes per line ---> How can I set this parameter for example, capturing 1024 Points of data ? What is line and offset here ? Please explain.
UPP->UPID2 = 0x00000080; //no offset between lines
while(UPIS2r->bits.PEND == 1){};
I will appreciate your help.
-Siddiqui
|