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.

Legacy SPI bus -- RX/TX, DAT0, DAT1, DAT3 ,DAT4

Other Parts Discussed in Thread: TM4C129ENCZAD

I have the follwing SPI lines in HW (MCU is TM4C129ENCZAD)

SPI_CLK          PA2
SPI_CS            PA3
SPI_MOSI        PA4
SPI_MISO        PA5

So far the code is completely untested since we do not have the HW yet.
I need to set up a legacy SPI connection, I want to use SSIDataPut and SSIDataGet for data transfer. No need for DMA or interrupts.

	SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_12MHZ);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);	
	SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
	SysCtlPeripheralReset(SYSCTL_PERIPH_SSI0);

	GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4); // TX, CS, CLK are set as output
	GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_5); 	                      // RX is set as input (SSI0_MISO)


        /****** start of the trouble ******/
        // Error line:    // GPIOPinConfigure(GPIO_PA4_SSI0TX); // define does not exist in pin_map.h
        // Error line:	// GPIOPinConfigure(GPIO_PA5_SSI0RX); // define does not exist in pin_map.h
	GPIOPinConfigure(GPIO_PA4_SSI0DAT0);	// MOSI/TX line <--- check this solution!!!
	GPIOPinConfigure(GPIO_PA5_SSI0DAT1);	// MISO/RX line <--- check this solution!!!
        /****** end of the trouble ******/

	GPIOPinConfigure(GPIO_PA3_SSI0FSS);  // Chip select
	GPIOPinConfigure(GPIO_PA2_SSI0CLK);  // Clock

	GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 );

	SSIClockSourceSet(SSI0_BASE, SSI_CLOCK_SYSTEM); // sets the system clock as the source of clock (redundant?)
	SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, SysCtlClockGet()/8, 16);
	SSIEnable(SSI0_BASE);

	// empty FIFO, flush unwanted junk
	while(SSIDataGetNonBlocking(SSI0_BASE, &flushfifo));

An issue is, that I see a discrepancy between the file 'pin_map.h' in TivaWare_C_Series-2.1.0.12573 and the datasheet SPMS442B, Table 20-1. SSI Signals (212BGA) on page1361 .

Table 20-1 in the datasheet claims that pin PA4 is SSI0XDAT0, SSI0TX in Legacy SSI Mode <-- TX type
'pin_map.h' defines only GPIO_PA4_SSI0RX and GPIO_PA4_SSI0XDAT0 types for pin PA4 <-- RX type?

Naturally not all pins can be defined as the type one wants. Since RX and TX types are not available (see datasheet vs. 'pin_map.h' issue above), I must use the DAT lines. But should DAT0, DAT1 be in MISO or MOSI roles?

--

The question is;
Why is there RX and TX options (Legacy SPI?) and DAT0,1,2,3 (SSI extension?) option for the GPIOPinConfigure pin type?
Can DAT0 be used for MISO/RX pin and DAT1 for MOSI/TX pin? Or with DAT0 and DAT1 in swapped roles?
Should DAT0/DAT1 or RX/TX type be used for MISO/MOSI pins in LEGACY SPI/SSI mode?
Why is there a conflict between 'pin_map.h' and the datasheet?

The answer is urgent because we need to verify that our board layout is correct !!!

  • Kim Sandström said:
    The answer is urgent because we need to verify that our board layout is correct !!!

    Might such "urgency" have (really) resulted from your (very) late observance of this (rather) well noted issue?       Search of this forum should reveal.      (I cannot recall specifics to aid - just that such has landed here - often)

  • Hello Kim

    Problems already detected. SysCtlClockSet and SysCtlClockGet are for TM4C123. They must be updated. Please have a look at the Application Note on differences b.w TM4C123 and TM4C129 and you would get the changes for the Software.

    In the pin_map.h file the two defines are defined for different devices. Use of RX is in TM4C123 class of device and XDAT0 is for TM4C129 class of device.

    Regards
    Amit