Hi,
I am having a problem transmitting data via the SSI using the bootloader code. The processor I am using is the LM4F232H5QD and my debugger is the Blackhawk USB560 JTAG Emulator. The processor is set up in slave mode with SSIData Size set to 8. The slave processor generates a one millisecond interrupt to the master processor to indicate that the slave has data to transmit. I am trying to transmit 128 bytes and it stops after transmitting 8 bytes. It hangs in the while loop waiting for SSI_SR_TNF to indicate that the transmit FIFO is not full. I have checked the TNF bit and the TFE bit in the status register and they are both zero indicating that the transmit FIFO is full and not empty per the data sheet. The code I am using is from the Stellaris/boot_loader directory.
SSI setup code:
//
// Enable the clocks to the SSI and GPIO modules.
//
HWREG(SYSCTL_RCGC2) |= SYSCTL_RCGC2_GPIOA;
HWREG(SYSCTL_RCGC1) |= SYSCTL_RCGC1_SSI0;
//
// Make the pin be peripheral controlled.
//
HWREG(GPIO_PORTA_BASE + GPIO_O_AFSEL) |= SSI_PINS;
HWREG(GPIO_PORTA_BASE + GPIO_O_DEN) |= SSI_PINS;
//
// Set the SSI protocol to Motorola with default clock high and data
// valid on the rising edge.
//
HWREG(SSI0_BASE + SSI_O_CR0) = (SSI_CR0_SPH | SSI_CR0_SPO |
(DATA_BITS_SSI - 1));
//
// Enable the SSI interface in slave mode.
//
HWREG(SSI0_BASE + SSI_O_CR1) = SSI_CR1_MS | SSI_CR1_SSE;
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3);
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0);
Send function:
/*
* This function sends data through the SSI port in slave mode. This function
* will not return until all bytes are sent.
*/
void blSSISend(const unsigned char *pucData, unsigned long ulSize)
{
unsigned long i = 0;
// Cause interrupt to master so the data will be clocked out.
HWREG(GPIO_PORTF_BASE + (GPIO_O_DATA + (GPIO_PIN_3 << 2))) = GPIO_PIN_3;
// Delay for approximately 1 msec
for(i = 0; i < 5500; i++)
{
}
HWREG(GPIO_PORTF_BASE + (GPIO_O_DATA + (GPIO_PIN_3 << 2))) = 0;
//
// Send the requested number of bytes over the SSI port.
//
while(ulSize--)
{
//
// Wait until there is space in the SSI FIFO.
//
while(!(HWREG(SSI0_BASE + SSI_O_SR) & SSI_SR_TNF))
{
}
//
// Write the next byte to the SSI port.
//
HWREG(SSI0_BASE + SSI_O_DR) = *pucData++;
}
//
// Empty the receive FIFO.
//
while(HWREG(SSI0_BASE + SSI_O_SR) & SSI_SR_RNE)
{
HWREG(SSI0_BASE + SSI_O_DR);
}
}
Call to blSSISend:
blSSISend(testBuffer, 128);
Buffer to transmit:
uint8 testBuffer[128] = {0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x10,0x11,0x12,0x13,0x14,0x15,0x16,
0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,
0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,
0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44};
Buffer that the master receives:
11 12 13 14 15 16 17 18 11 11 11 11 11 11 11 11
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11


