Quantcast
Channel: Data converters
Viewing all articles
Browse latest Browse all 27392

Forum Post: ADS1256: ADS1256 and TM4C129 SSI communication issue

$
0
0
Part Number: ADS1256 Hi, I am new to ADS1256 and testing it out for a project. I am trying to communicate ADS1256 with my TM4C129exl launchpad. I am facing a peculiar problem of getting the same repeated value of 0x003e regardless of the commands I give. I am using a Wingoneer ADS1256 module. I have included the code below: /* pdwn -> 3.3 cs ->PN4 drdy ->Not connected dout -> pdo din -> pd1 sclk -> pd3 gnd 5v */ #include #include #include "inc/hw_memmap.h" #include "inc/hw_ssi.h" #include "inc/hw_types.h" #include "driverlib/ssi.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/sysctl.h" #include "UART.h" #include "driverlib/uart.h" uint32_t ui32SysClkFreq; int i; uint8_t k,j=0; char buffer [sizeof(long)*8+1]; int main(void) { uint32_t ui32Index; uint32_t ui32Data[4] =1; ui32SysClkFreq = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); /*Uart initialization*/ SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // Port A for Uart GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTConfigSetExpClk(UART0_BASE, ui32SysClkFreq, 9600,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); /*SPI initialization*/ SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION); GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_4); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); GPIOPinConfigure(GPIO_PD3_SSI2CLK); SSIAdvModeSet(SSI2_BASE,SSI_ADV_MODE_LEGACY); GPIOPinConfigure(GPIO_PD1_SSI2XDAT0); GPIOPinConfigure(GPIO_PD0_SSI2XDAT1); GPIOPinTypeSSI(GPIO_PORTD_BASE,GPIO_PIN_3|GPIO_PIN_2|GPIO_PIN_1|GPIO_PIN_0); SSIConfigSetExpClk(SSI2_BASE, ui32SysClkFreq, SSI_FRF_MOTO_MODE_1, SSI_MODE_MASTER, 250000, 8); SSIEnable(SSI2_BASE); GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_4,16); while(1) { GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_4,0); // deasserting CS /*read status register*/ SSIDataPut(SSI2_BASE, 0x10); // send 1st command byte -0b00010000 SSIDataPut(SSI2_BASE, 0x01); // send 2nd command byte -0b00000000 while(SSIBusy(SSI2_BASE)) { } SSIDataGet(SSI2_BASE, &ui32Data[0]); GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_4,16); // asserting CS /*Uart communication*/ ltoa(ui32Data[0],&buffer[0]); while(buffer[j]!=0) { UARTCharPut(UART0_BASE, buffer[j]); j++; } j=0; UARTCharPut(UART0_BASE, '\n'); SysCtlDelay(100000); } } Any help regarding this matter is welcome. TIA

Viewing all articles
Browse latest Browse all 27392

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>