Other Parts Discussed in Thread: EK-TM4C123GXL
hi everyone,
I just started working with micro-controllers. I'm using the TM4C123GH6PM.
I haven't used ssi communication so far, so i wrote the attached code, in which the controller sends messages to itself via two ssi ports.
I simplified the program by allowng only OT interrupts, for now.
When I run this code, the receiving port calls the ISR and saves the data sent, than it is called one more time, but writes no data, and no longer calls the ISR.
Am I missing something?
#include <stdint.h> #include <stdbool.h> #include "inc/hw_memmap.h" #include "inc/hw_ints.h" #include "driverlib/debug.h" #include "driverlib/ssi.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #define BUFFER_SIZE 256 uint8_t message_Index = 0 ; uint32_t dataReceived[BUFFER_SIZE] = {0} ; void SSI2ReceiveISR (void) { SSIIntClear(SSI2_BASE, SSI_RXTO) ; SSIDataGetNonBlocking(SSI2_BASE, &dataReceived[message_Index++]) ; } int main(void) { volatile uint32_t cyclic_Counter = 0 ; // enable ssi1 peripheral: SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI1); while(!SysCtlPeripheralReady(SYSCTL_PERIPH_SSI1)) { } // enable ssi2 peripheral: SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2); while(!SysCtlPeripheralReady(SYSCTL_PERIPH_SSI2)) { } // // For this example SSI0 is used with PortA[5:2]. The actual port and // pins used may be different on your part, consult the data sheet for // more information. GPIO port A needs to be enabled so these pins can // be used. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB) ; SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD) ; // // Configure the pin for SSI's GPIOPinConfigure(GPIO_PD0_SSI1CLK); GPIOPinConfigure(GPIO_PD1_SSI1FSS); GPIOPinConfigure(GPIO_PD2_SSI1RX); GPIOPinConfigure(GPIO_PD3_SSI1TX); GPIOPinConfigure(GPIO_PB4_SSI2CLK); GPIOPinConfigure(GPIO_PB5_SSI2FSS); GPIOPinConfigure(GPIO_PB6_SSI2RX); GPIOPinConfigure(GPIO_PB7_SSI2TX); // // Configure the GPIO settings for the SSI pins. // see which functions are allocated per pin. // The pins are assigned as follows: // PB4 - SSI2CLK // PB5 - SSI2FSS // PB6 - SSI2RX // PB7 - SSI2TX // PD0 - SSI1CLK // PD1 - SSI1FSS // PD2 - SSI1RX // PD3 - SSI1TX // GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 ); GPIOPinTypeSSI(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 ); //configuring the two ssi's, 1 as a master and 2 as a slave SSIConfigSetExpClk(SSI1_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 500000, 8) ; SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_SLAVE, 500000, 8) ; // enabling the two ssi's SSIEnable(SSI1_BASE) ; SSIEnable(SSI2_BASE) ; // for the receiver port, we allow only time out interrupts, or full\half-full FIFO interrupts SSIIntEnable(SSI2_BASE, SSI_RXTO) ; // //IntEnable(INT_SSI1); IntEnable(INT_SSI2); IntMasterEnable(); // done with configuring stuff, now the main program starts while (1) { SSIDataPut(SSI1_BASE, ++cyclic_Counter) ; SysCtlDelay(SysCtlClockGet()/300) ; } return 0; }