This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
dear ,
actually i want to send data to DAC 7731 i have written code for this but i am unable to get the output of DAC. i am using SSI port of TM4C129XNCZAD and i am using PA2 as a SCLK PA3 as a Chip select and PA4 for sending data. DAC output is sitting at mimimum value although SSI output seems correct i am enclosing code please tell me where i am wrong please help me
int main(void)
{
uint32_t pui32DataTx;
ui32Loop = SYSCTL_RCGCGPIO_R;
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
MT_SysTick_Set();
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinConfigure(GPIO_PA3_SSI0FSS);
GPIOPinConfigure(GPIO_PA4_SSI0RX);
GPIOPinConfigure(GPIO_PA5_SSI0TX);
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2);
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_3,
SSI_MODE_MASTER, 1000000, 8);
SSIEnable(SSI0_BASE);
DAC_ldac();
while(1)
{
MAP_GPIOPinWrite(GPIO_PORTS_BASE, GPIO_PIN_7,GPIO_PIN_7);
pui32DataTx=0x5472;
SSIDataPut(SSI0_BASE, pui32DataTx);
while(SSIBusy(SSI0_BASE))
{
}
SSIIntClear(SSI0_BASE,SSI_RXFF);
SysCtlDelay(100);
MAP_GPIOPinWrite(GPIO_PORTS_BASE, GPIO_PIN_7, 0);
SysCtlDelay(100);
MAP_GPIOPinWrite(GPIO_PORTS_BASE, GPIO_PIN_7, GPIO_PIN_7); //LDAC rising edge
}
}
void DAC_ldac()
{
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOS);
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTS_BASE, GPIO_PIN_7);
MAP_GPIOPinWrite(GPIO_PORTS_BASE, GPIO_PIN_7, GPIO_PIN_7);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_1);
MAP_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1, 0);
}
(Actually) - your post's "body" very well describes your objective - while your "all important Subject/Headline" borders upon (pardon) USELESS! (you may easily edit away the nonsensical "part repetition" replacing that "total vagueness" with your "REAL OBJECTIVE" - making your post "far more compelling" to your "US Holiday (still working) helper crüe.
Now you state:
gurpreet singh96 said:using PA2 as a SCLK PA3 as a Chip select and PA4 for sending data.
Yet your code reveals:
GPIOPinConfigure(GPIO_PA4_SSI0RX);
GPIOPinConfigure(GPIO_PA5_SSI0TX); // does not "this pin" provide (your desired) SPI OUTPUT?
That's a rather clear conflict (PA4 usage) - is it not? You cannot realize signal output from the SSIORX (receive) pin! (RX = Receive, TX = Transmit)
Have you confirmed (as always) that power is proper AND always present at your DAC? Is that DAC accepting of 3V3 levels - output by TM4C?
Your code is devoid of delays - and "Checking for Peripheral Readiness" - both (may) prove harmful to your success. (but first - fix the RX/TX mash-up!)
In all such cases - your use of a scope - and presentation of key scope caps - immensely aids remote diagnosis. And a "proper" (i.e. somewhat communicating Subject Line) surely, "Draws more eyes to your post!"
No one "wants" your sorrow - it IS unfortunate that you, "So well describe your goal" - yet that NEVER appears w/in the Subject Line - which "Draws others to your post!"
You may quickly/easily "EDIT Away" your "weak/non enticing" Subject Line - w/"SPI DAC non-responsive!" (such proves far more descriptive - and compelling -does it not?)
You did not respond to my clear identification of your conflicted writing re: PA4.
Is PA4 truly the SPI TX OUTPUT - as seen by your MCU - and "sent" to your DAC? Look again @ my post - which clearly identified (via highlight) your conflicting description. (Re: PA4)
cb1_mobile said:That's a rather clear conflict (PA4 usage) - is it not? You cannot realize signal output from the SSIORX (receive) pin! (RX = Receive, TX = Transmit)
Have you confirmed (as always) that power is proper AND always present at your DAC? Is that DAC accepting of 3V3 levels - output by TM4C?
Both of theses points are worth emphasizing. The latter if only because the part is labeled as a Burr Brown part and so dates back to that illustrious companies acquisition.
Robert
Well noted - it is a "shame" to see those (famed & pioneering) tech firms become "swallowed" - w/many (skilled) staff dispatched. (a la - more recently - "National semi-circle" equally departed - and of course, "Luminary Micro" - responsible for our arrival, here...
Poster's use of 'LS245 w/in SPI realm - defies my imagination. (unless he hopes for "level-shift" via that device...) Appears that "lack of output from the DAC" has inflicted itself upon posting - as well...
And - should BP's Turkey have "escaped his barren yard - slipped across the border - and "find itself (now) upon (your) dinner table" - be sure to "chew around" those "metal bits" (lead I'm told) "gobbled from bird's stay @ the FET burial ground."
Does the Green (SPI Clock) signal trace (only channel set to 10V/Div) not appear "excessive" in level? Is that DAC accepting of such (well beyond) 5V signal levels? (it DOES appear that the '245 is employed as "level shifter" - advanced earlier by this reporter)
Poster Robert (properly) sought (BOTH) input & output waveforms of '245 - yet your caps appear to be (one would hope) "Output only!" (your unadjusted scope probes and/or ground connection - inflict substantial over/under-shoot upon the cap.)
Unstated is the "SPI Data" you were trying to send to the DAC - and "Why you chose - and believe" - that data to be correct & proper. (You've provided NO comment in that regard - forcing extra effort upon your hapless "helpers.")