I'm new in LM4F family
I want to receive data from SPI using interrupt. Suppose there is any slave module that transmit to us packets of data. The size of packets are different e.g. 5-20 bytes long.
It's not a real problem, I'm just interesting how could I create something like this and I want to ask you for some things.
1. System clock:
// Setup the system clock to run at 50 Mhz from PLL with crystal reference
2. SPI configuration:
// SSI0 enable
// GPIOA pins for SSI0 enable
// SPI pins config
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 |
// SSI0 config
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
SSI_MODE_MASTER, 8000000, 8);
// SSI0 enable
while(SSIDataGetNonBlocking(SSI0_BASE, &ulDataRx)); // ulDataRx - declared data table
// SPI_inter_handler function will be an interrupt handler
// SPI interrupt enable
// SPI interrupt from receiving data
// Interrupt enable
My questions are:
1. If I receive a byte will I have an interrupt? In DS we can read: "Receive FIFO service (when the receive FIFO is half full or more)". Since a Receive FIFO is 8x16 byte memory will the interrupt occur after 8 received bytes?
2. I've received the byte (or a few bytes) of data. How can I access to it?
3. Need I clear any flag in the interrupt?
4. If I configure a SPI interrupt also for data transmitting, how data transmission looks like?
I will grateful for a help.
In regard to 2nd question, I've found in DS description of the SSIDR register where 16-bit data is stored. Additionally there is a
function in Stellaris Peripheral Driver Library. Should it be used in the interrupt?