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.

Problem with TM4C123 and SSI response

Other Parts Discussed in Thread: LAUNCHXL-CC1310

Hei!

I have got a school project where I am supposed to create first a RF source at 868 Mhz. For this purpose, I am using the RF-module DRF4463F based on a Si4463 chip commanded by a TM4C123GXL micro-controller. I can actually start the project itself after I got the source working.

I got the SSI connected the following way:

CLK -> SCLK
FSS -> nSEL
TX -> SDI
 RX -> SDO

The transmission part works fine with a 8-bit serial-parallel shift register SN74HC595N where are connected 8 LEDs to its outputs. So, when i send a word like 0x01 I see the same with the LEDs. I can say the transmission works. The problem appears in the response of the RF module which is always 0xFF whatever the sent command. The code I wrote so far is the following:

void main(void)
{
	spi_init();      // initialize SSI ports and 2 general GPIOs
	uint8_t response[] = {0x00,0x00,0x00,0x00};
	uint8_t data[] = {0x01,0x00};    // data to be sent to the RF-module
	send_data(data,2);             // send the 2 value of the data
	SSIDataGet(SSI3_BASE, &response);     // receive the response
}
void spi_init(void)
{
	// Initialize the ports
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

	GPIOPinConfigure(GPIO_PD0_SSI3CLK);
	GPIOPinConfigure(GPIO_PD1_SSI3FSS);
	GPIOPinConfigure(GPIO_PD2_SSI3RX);
	GPIOPinConfigure(GPIO_PD3_SSI3TX);

	GPIOPinTypeSSI(GPIO_PORTD_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
	GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5);  // for later use
	// Set the frequency of the SSI communication. Here 1MHz with 8 bits-words set on mode 0.
        SSIConfigSetExpClk(SSI3_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
	SSIEnable(SSI3_BASE);
}

void send_data(uint8_t *data, unsigned char data_length) // use to send multiple words
{
	unsigned char i;
	for (i = 0; i < data_length; i++)
		{
			SSIDataPut(SSI3_BASE, *(data+i));
			while(SSIBusy(SSI3_BASE)){}
			//SysCtlDelay(10000000);
		}
}

unsigned char * read_response(unsigned char size_response) // I am not sure if that one works. It is meant to read the response.
{
	unsigned char i;
	uint8_t response[size_response];
	for (i = 0;i<size_response;++i)
	{
		SSIDataGet(SSI3_BASE, &response[i]);
		while(SSIBusy(SSI3_BASE)){}
	}
	return response;
}

The code is written with CCS using Tivaware. I use the port D (SS3), set at 1MHz with mode 0 (rising edge of clock and FSS set to low to send values). I tried the other mode and it doesn't work. I don't use yet the read_response() function since the SSIDataGet() alone doesn't get the right answer. It is said in the data sheet of the chip of the module (here, page 16) that the maximum communication frequency is 10 MHz.

I have been trying for almost a month and I'm starting to be short of ideas. I forgot to mention that I'm not an expert in µC nor in C programming. I just have the basics. If someone got any idea why it doesn't work, I would be thankful. Thank you in advance.

-John-

  • Hello John,

    When sending data over SSI, the receive FIFO must be flushed. Otherwise what you may read is the the byte that was shifted in when the command was being sent

    uint32_t dummydata;

    SSIDataPut(SSI3_BASE, *(data+i));
    SSIDataGet(SSI3_BASE, &dummydata);

    Regards
    Amit
  • Hello Amit!
    Thank you very much for your fast answer! I Tried like you suggested but I only get 0xFF each time I get an answer from the RF-module. I used 0x00 as dummy data since it's a NOP for the module.
    So all I did was: I sent the module info command value 0x01, read the value (I get 0xFF), I send a dummy data (0x00), I also get 0xFF, send again a dummy data, I read 0xFF, etc.. It seems that the output SDO of the module is just giving the value 0xFF. Would you have an idea why the value is always 0xFF? Thank you in advance!
  • Hello John,

    Check if the slave has a certain power up or reset requirement!!!

    Regards
    Amit
  • Hi Amit!

    Thank again for your fast answer. I tried to reset the Rf-module by first shut it down (power down pin SDN = 1), then restart it (SDN = 0) and power it up with the command 0x02 with the required option values. I checked with a ammeter and it looked like that the reset worked. By that, I mean that SDN = 1 gives a 0A consumption and SDO = 0 + power_up gives a value of 26mA. But unfortunately, it didn't help. The SDO value remains at 0xFF. The SDN pin is connected to general GPIO.

    I also try to set the input RX of the MCU with pull-down like read in a forum but still the same problem. I used the following code in the SPI_Init():

    GPIOPinConfigure(GPIO_PD0_SSI3CLK);
    GPIOPinConfigure(GPIO_PD1_SSI3FSS);
    GPIOPinConfigure(GPIO_PD2_SSI3RX);
    GPIOPadConfigSet(GPIO_PORTD_BASE,GPIO_PIN_2,GPIO_STRENGTH_6MA,GPIO_PIN_TYPE_STD_WPD);
    GPIOPinConfigure(GPIO_PD3_SSI3TX);

    Difficult to think anything else since the power up command seems to work so other command should work to. But the MCU can't read any answer. I also found out that to read the buffer the values 0x44 has to be sent. It didn't help either. I wish I had better equipment to check the values. Have you got any idea of what could be wrong? Thank you very much for your time!


    John

  • Hello John

    GPIOPinConfigure(GPIO_PD2_SSI3RX); and GPIOPinTypeSSI are sufficient to configure the pin. Can you check with a scope if the slave device sees the CS, CLK and TX pin correctly and that the RX pin does not toggle? That will help isolate the issue to the slave or the master

    Regards
    Amit
  • Hi Amit!
    Unfortunately, I don't have access to a scope because the school is now mostly close. That would have surely helped. Is there any other way to check those things?
    Sincerely,
    John
  • Hello John,

    You may order a LA from Saleae Logic. Rather inexpensive and very versatile.

    Regards
    Amit
  • Hello Amit! I can't afford that kind of piece of equipment. Maybe one day when I'll get a better job. I think I have spent enough time on that module.  Would you know a cheap and easy-to-configure breakout board working at 868MHz that I could use for making a simple RF-source. I just need to transmit not to receive. Thank you very much.

    Sincerely,

    John

  • Hello John,

    There is a TI reference design which may be useful.

    www.ti.com/.../TIDM-TM4C123XSUB1GHZ

    Regards
    Amit
  • Thank you very much for your link. I decided to buy one launchpad LAUNCHXL-CC1310. I hope it's not going be too much struggle to make it work. Thank you for your help.

    regards,
    Johnny