Part Number: TM4C1294NCPDT
Tool/software: Code Composer Studio
hi,
I need help with my write functions for SSI.
I was able to read but then I couldn't write over my spi.
and i don't know what im doing wrong.
below is my read and write function.
voidft_Wr8(unsignedlong ftAddress, unsignedchar ftData8)
{
unsignedchar cTempAddr[3]; // FT800 Memory Address
cTempAddr[2] = (char) (ftAddress >> 16) | MEM_WRITE; // Compose the command and address to send
cTempAddr[1] = (char) (ftAddress >> 8); // middle byte
cTempAddr[0] = (char) (ftAddress); // low byte
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_CS, 0); // Set chip select low
while (SSIDataGetNonBlocking(SSI0_BASE, &pui32DataRx) != 0)
;
SSIDataPut(SSI0_BASE, &cTempAddr[2]); // Send Memory Write plus high address byte
SSIDataPut(SSI0_BASE, &cTempAddr[1]);
SSIDataPut(SSI0_BASE, &cTempAddr[0]);
SSIDataPut(SSI0_BASE, &ftData8); // Send data byte
while (SSIBusy(SSI0_BASE))
;
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_CS, GPIO_PIN_CS); // Set chip select high
}
unsignedcharft_Rd8(unsignedlong ftAddress)
{
unsignedchar ftData8; // Place-holder for 8-bits being read
unsignedchar cTempAddr[3]; // FT800 Memory Address
unsignedchar cZeroFill = ZERO;
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_CS, 0); // Set chip select low
while (SSIDataGetNonBlocking(SSI0_BASE, &pui32DataRx))
;
cTempAddr[2] = (char) (ftAddress >> 16) | MEM_READ; // Compose the command and address to send
cTempAddr[1] = (char) (ftAddress >> 8); // middle byte
cTempAddr[0] = (char) (ftAddress); // low byte
SSIDataPut(SSI0_BASE, cTempAddr[2]); // Send Memory Write plus high address byte
SSIDataPut(SSI0_BASE, cTempAddr[1]);
SSIDataPut(SSI0_BASE, cTempAddr[0]);
// SSIAdvDataPutFrameEnd(SSI0_BASE, cZeroFill); // Send dummy byte
SSIAdvDataPutFrameEnd(SSI0_BASE, cZeroFill); // Send dummy byte
SSIDataGet(SSI0_BASE, &ftData8); // Receive data byte
while (SSIBusy(SSI0_BASE))
;
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_CS, GPIO_PIN_CS); // Set chip select high
return ftData8; // Return 8-bits