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.

CCS/TMS320F280049C: Enabling Peripherals on LaunchXL-F280049C

Part Number: TMS320F280049C


Tool/software: Code Composer Studio

Hi all! I am a beginner in programming with TI's microcontrollers and have been assigned the use of the LaunchXL F280049C.

My project aim is to decode data coming from a SPI slave and transmit it out via SCI/UART.

I watched Gautam Iyer's Get Started video and did the necessary configuring of the XDS110 port from normal JTAG to 2-pin cJTAG, and thus can enter debug mode.

I was able to set up pins for GPIO use and verified this using external LEDs and an oscilloscope, using GPIO_setPinConfig and GPIO_setPadConfig.

To this end I have been looking at the example code from CCS Resource Explorer for both SCI and SPI, using the driverlibs. However, even in running example code, I am unable to see any output on my pins with an oscilloscope - they are at 0V.

I have not changed any of the Launchpad's external switches or jumpers.

Is there anything I might have missed out on adding in the code?

For instance, to enable SPIA's pins, I do this

    // Pin definitions from pin_map.h

    // PIN 15 (GPIO 16) -> MOSI pin
    GPIO_setPinConfig(GPIO_16_SPISIMOA);
    GPIO_setPadConfig(16, GPIO_PIN_TYPE_PULLUP);        // push-pull output
    GPIO_setQualificationMode(16, GPIO_QUAL_ASYNC);     // as per SPI user manual.

    // PIN 7 (GPIO 56) -> SCLK pin
    GPIO_setPinConfig(GPIO_56_SPICLKA);
    GPIO_setPadConfig(56, GPIO_PIN_TYPE_PULLUP);        // push-pull output
    GPIO_setQualificationMode(56, GPIO_QUAL_ASYNC);     // as per SPI user manual.

    // PIN 14 (GPIO 17) -> MISO pin
    GPIO_setPinConfig(GPIO_17_SPISOMIA);
    GPIO_setPadConfig(17, GPIO_PIN_TYPE_PULLUP);        // pullup input
    GPIO_setQualificationMode(17, GPIO_QUAL_ASYNC);     // as per SPI user manual.
    // end experimental hwconfig.

    // PIN 39 (GPIO 11)
    GPIO_setPinConfig(GPIO_11_GPIO11); 		        //GPIO_11_SPISTEA;
    GPIO_setPadConfig(11, GPIO_PIN_TYPE_PULLUP);
    GPIO_setDirectionMode(11, GPIO_DIR_MODE_OUT);
    GPIO_setQualificationMode(11, GPIO_QUAL_ASYNC);

    // LED (Flash as a status output)
    GPIO_setPadConfig(DEVICE_GPIO_PIN_LED2, GPIO_PIN_TYPE_STD);
    GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED2, GPIO_DIR_MODE_OUT);

And to enable SCIA, I do this

    // GPIO28 is the SCI Rx pin.
    GPIO_setPinConfig(GPIO_28_SCIRXDA);
    GPIO_setPadConfig(28, GPIO_PIN_TYPE_PULLUP);
    GPIO_setQualificationMode(28, GPIO_QUAL_ASYNC);

    // GPIO29 is the SCI Tx pin.
    GPIO_setPinConfig(GPIO_29_SCITXDA);
    GPIO_setPadConfig(29, GPIO_PIN_TYPE_PULLUP);

Have I missed out on anything? Thank you for your help, in advance!

  • Hi,

    The GPIO configuration you have done looks fine. You would be seeing the data on the pins only during a SPI transfer. Are you continuously sending data across SPI?

    Could you also share the SPI module configuration code?

    Regards,

    Veena

  • Dear Veena,

    SPI Module Config code is as follows.

    // begin configuring SPI
        SPI_disableModule(SPIA_BASE);
    
        SPI_setConfig(SPIA_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA0, SPI_MODE_MASTER, 1000000, 8);
        // SPI Config: SPI base, SPI clock rate (Hz)
        // data transfer protocol (now is mode 0)
        // master/slave mode
        // SCLK (clock rate in Hz)
        // 8 data bits transferred per frame
    
        SPI_disableFIFO(SPIA_BASE); 
        SPI_disableLoopback(SPIA_BASE);
        SPI_disableTriWire(SPIA_BASE);
        SPI_disableHighSpeedMode(SPIA_BASE);
        // disable FIFO/Loopback/3-wire/High-Speed
        // we dont want to use these.
    
        SPI_setEmulationMode(SPIA_BASE, SPI_EMULATION_FREE_RUN);
        // Setting the behavior of SPI when emulation suspend occurs.
    
        SPI_enableTalk(SPIA_BASE); 
        // Changed this from today (1/8). Perhaps talk mode is disabled and that's
        // why the module is silent.
    
        SPI_enableModule(SPIA_BASE);
        // enable the settings to ensure they take effect

    I attempted to follow the User Guide for using driverlib files.

    I am continuously sending over SPI as follows:

    if(sData == 100){
        		sData = 50;
        	} else {
        		sData = 100;
        	}
        	
        	sent = sData << 8;
        	sent |= 0xFF;
        	
        	GPIO_writePin(DEVICE_GPIO_PIN_LED2, 0);
        	GPIO_writePin(11, 0);
        	// CS LOW
            // Blink Status LED
    
        	SPI_writeDataBlockingNonFIFO(SPIA_BASE, sent);
        	/* write data to TX buffer of SPI Module
        	Data is left-justified as the lower 16-n (in this case, 8)
        	bits are discarded, because a bit width of 8 was selected in
        	SPI_setConfig earlier.
        	*/
    
        	rData = SPI_readDataBlockingNonFIFO(SPIA_BASE);
        	// dummy read, check if there is anything at all?
        	
        	DEVICE_DELAY_US(10000);
        	// for testing, so the LED flash is visible
    
        	GPIO_writePin(DEVICE_GPIO_PIN_LED2, 1);
        	GPIO_writePin(11, 1);
        	// CS HIGH
        	
        	DEVICE_DELAY_US(2000000);

    I was using _BlockingNonFIFO as I wanted to get the module working before FIFO.

    Oddly, the program continues to loop even though I used the ReadDataBlockingNonFIFO function, and I leave the MISO pin floating.

  • TianYi,

    Also, you might be interested in the F280049 Workshop, which can be found at:

    https://training.ti.com/c2000-f28004x-microcontroller-workshop?cu=1137791

    In regards to the SCI pin signals on the Booster Pack header, please see the following related thread: 

    https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/825163

    I hope this helps.

    - Ken