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.

Tiva C, SSI with AS5048 in "Framed Mode"

Hello Everyone

I am completely new to this Forum and to ARM processors. My name is Chris and I am working as an electrical engineer in Switzerland. I nearly finished a product with a PI32 device but now I have to change to ARM. It would be great if I can get some help here due to a very short time to market, product lunch will be around Christmas. 

The Problem:
I am using a TIVA C (TM4C1294) with CCS 6 and TI-RTOS (Bios 6.40.03.36, NDK 2.23.01.01, UIA 2.00.01.34)

I would like to read data over SPI from a AS5048 rotary magnetic sensor. To enhance the speed I want to use the Read  only, 3 wire mode of the Sensor (P. 13 on the AMS datasheet). In this mode only the CS pin has to be toggled to read the sensor data.

The Question:
What SSI mode is that on my ARM Processor? Is there a Frame Format that toggles the CS line hardware based and fills automatically a buffer through DMA for me?

Thanks in advance,

Chris

  • Hi,

    You must configure your SSI peripheral for Motorola/Freescale protocol with word length 16 bits, as you must send only one word at a time. What really version of this protocol is better to discover by yourself by reading the user manual - is clear explained and is not difficult to understand. This is better than giving you the right answer now, since you will use this module in other projects - and this way you get experience with the micro and peripheral.

    If any other problem(s) in implementing the software, many helpers are here to assist.

    Petrei

  • Chris Henschel said:
    be great if I can get some help here due to a very short time to market, product lunch will be around Christmas. 

    While that's unfortunate - none here caused/contributed to your short-fuse application.  Shouldn't your protest land at the feet of those requesting - not blameless/innocents here?

    Best help results when requesters have proved that they've made (some) effort to understand and attack their unique application.  No such evidence surfaces w/in your post.

    MCU manual is beyond 1k pages - SSI/SPI chapter is thick - well detailed.  And - there are multiple SW examples sprinkled w/in the API SW and this forum.

    Your "question" is likely answered quickly/convincingly by your read/review of the MCU manual.  Suspect that's just what you did in your past PIC design - is it not?  MCU Manual greatly details (via timing diagrams) the various means of SPI data flows, signal timings & signal edges.  Your job then reduces to simply choosing the best "mated" MCU mode for your slave IC application.  Again - it appears that you've not made this effort - and it very much is required.

  • Hello,

    Thanks for your answers. I am sorry for my late reply. I have had some hardware problems that were causing also problems with the SPI. My first post was not written well; of course I had made investments before bothering you and you are absolutely right that the time to market is not the problem for this forum. Anyway, meanwhile I studied the SPI chapter in the datasheet :).

    To fill the SPI RX FIFO a dummy writes to the SPI modules is mandatory. That’s actually one thing what I wanted to know, if this is possible by hardware.

    The SPI is working fine, either in TI-RTOS or Driver mode (the ones from the ssi.h header). I used the Freescale Frame Format with polarity 0 and phase 1. Currently I am transmitting only one 16 bit value at once; this is to slow for my application. I would like now to fasten the reading, and then I could increase my filter to increase the angular position accuracy.

    I think I have not understood the uDMA right: Will the uDMA give me any speed advantages than using the interrupt when the RX-FIFO is half full (SSI_RXFF) and copy four 16-Bit values at once (the FIFO is 8 values deep)? Are there any SPI uDMA examples in TI-RTOS?

    I am also confused what functions I should use. I found out that mixing the TI-RTOS ones with the native driver functions is not a good idea e.g. linker error when using SSIIntRegister. Currently I am using the TI-RTOS only because of the nice Task environment and the Webserver Example :).

    I am looking forward to your replys

    Chris

     

  • Hello Again

    I cant find any example or documentation about the SPI configuration for uDMA in TI-RTOS. So I put the SSI Module from the peripheral library.

    When I send a 0xFFFF to the SPI my Sensor is answering with the current measurement. Now I thought I request data by sending the 0xFFFF as long as the RX FIFO is full and then copy the 8 Values from the FIFO at once but the RXFIFO seams not getting filled up and the Flag is never set.

    I setup the SSI Module as followed:

    	// The SSI0 peripheral must be enabled for use.
    	SysCtlPeripheralEnable (SYSCTL_PERIPH_SSI2);
    	SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOD);
    
    	// Disable SSI function before configuring module
    	SSIDisable (SSI2_BASE);
    
    	//Set IO clock as SSI clock source
    	SSIClockSourceSet(SSI2_BASE, SSI_CLOCK_SYSTEM); //    SSIClockSourceSet(SSI0_BASE, SSI_CLOCK_PIOSC);
    
    	// Configure the pin muxing for SSI2 functions
    	GPIOPinConfigure (GPIO_PD0_SSI2XDAT1);
    	GPIOPinConfigure (GPIO_PD1_SSI2XDAT0);
    	GPIOPinConfigure (GPIO_PD2_SSI2FSS);
    	GPIOPinConfigure (GPIO_PD3_SSI2CLK);
    
    	// Configure the GPIO settings for the SSI pins.
    	GPIOPinTypeSSI(GPIO_PORTD_BASE,
    			(GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3));
    
    	// Configure and enable the SSI port for SPI master mode.
    	SSIConfigSetExpClk(SSI2_BASE, 80000000, SSI_FRF_MOTO_MODE_1,
    			SSI_MODE_MASTER, 10000000, 16);
    
    	//Enable the SSI0 module.
    	SSIEnable(SSI2_BASE);

    My idle function looks as followed:
    	if (HWREG(0x4000A00C) & (1 << 4)) { //checking the SSI_SR-RFF Bit from SSI2 (recieve FIFO full)
    		int rawSum = 0;
    		uint32_t data;
    		uint8_t ii;
    		for (ii = 0; ii < 8; ++ii) {
    			SSIDataGetNonBlocking(SSI2_BASE, &data);
    			rawSum += data & 16383;
    		}
    		int16_t pos = divRoundClosest(rawSum, 8);
    		ReadAngle(pos, time);
    	}
    
    	SSIDataPutNonBlocking(SSI2_BASE, 0xFFFF);

    Can you help me?

    Cheers,

    Chris