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.

CC2538 SPI "SLAVE" mode

Other Parts Discussed in Thread: CC2538, CC2538-SW

Hello,

Did someone succeded to work with CC2538 in "SLAVE" mode.

The question concerns mostly IO issue.

So, CLK, MOSI and SS must be configured as inputs and MISO as output.

Unfortunately CC2358 UG is quite complex to understand.

What registers should I setup to satisfy IO requirements.

Thanks in advance.

Pavel.

P.S. Is there any e-mail of webmaster ... the "mail body" becomes uncontrollable. 

  • Hi,

    please note TI released a CC2538 foundation SW, which includes drivers for on-chip modules (driverlib component) as well as for the SmartRF06 motherboard (bsplib component).

    http://www.ti.com/tool/cc2538-sw

    In driverlib component, you will find implementation of SPI driver and application examples that explain how to use the SPI driverlib API in master mode.

    Changing from master to slave is pretty straightforward and a help is available in the user's guide of the foundation firmware package.

    Please check the docs folder of the install and look up the driverlib user's guide

    Thanks,

    TheDarkSide

  • Thanks TheDarkSide,

    I try to explore spi_master.c, for wich I've created a project in CCS.

    Immediately I've met a problem: in contiki projects I used frequently printf function. Its output is captured by hyperterminal.

    In CCS project there is another function for diagnostic purposes: UARTprintf. As opposed to printf (contiki), I can't capture UARTprintf output in hyperteminal.

    What could be the reason of the problem

    Cordially

    Pavel

  • I've been mistaken: it's code itself that doesn't work.

    Probably the CCS flash file wasn't created properly: its size is only 4Kb.

    The corresponding IAR .bin has 512Kb.

    Something wrong in my project settings.

    Has anybody an idea what settings should I check ?

    Cordially

    Pavel

  • The problem resolved: when creating project one need to select CC2538 template.

    Regards

    Pavel.

  • I've succeed to get working SPI SLAVE ISR routine, but unfortunately it can read only 1st symbol.

    Master send to symbols. 1st reading - Ok, but when I try to read 2nd symbol, ISR "hangs".

    Where is the problem ?

    How to check that Receive FIFO does conatain 2 symbols ?

    Thanks

    Pavel.

  • It's Ok - reception works properly.

    Another problem came ... Slave ISR routine is armed, when Slave answer.

    Here is ISR code:

    static void SSI0_ISR(void)
    {
    	uint32_t DataRX[2];
    	// uint32_t n_data;
    	static uint8_t i = 0;
    
        SSIDataGet(SSI0_BASE, &DataRX[i]);
        SSIIntClear(SSI0_BASE, SSI_RXTO | SSI_RXOR);
    	//n_data = SSIDataGetNonBlocking(SSI0_BASE, &DataRX[i]);
    	UARTprintf("Symbol_%d: 0x%04x\n", i, DataRX[i]);
    	if (DataRX[i] == 0x33)
    	{
    		i = 0;
    		SSIDataPut(SSI0_BASE, 0x87);
    		SSIDataPut(SSI0_BASE, 0x86);
    		SSIDataPut(SSI0_BASE, 0x85);
    	}
    	else
    		i++;
    }

    As you can state after reading there are 3 send instructions and ISR is executed each time "Master" read "Slave".

    How to avoid it ? In SPI configuration I authorized only RX FIFO time-out interrupt:

    SSIIntEnable(SSI0_BASE, SSI_RXTO);

    Why ISR is armed also when "Slave" is read by "Master" ?

    Thanks in advance

    Pavel.