Home arrow Support arrow Forums

Luminary Micro Forums

ChristopherNeufelt

Senior Boarder

2008/11/03 08:24

Problem: configuring SSI direct register access

Hello to everyone
The Peripheral driver library defines two methodologies for accessing the microcontroller, these are the direct register access model (using the lm3sXXXX.h file)and the software driver model.
By implementing the register access model (and using as main template the blinky.c program) I did not succeed to send data. Notice: during the debugging, the respective registers except the data register are working fine. If anyone has a suggestion, then my code is here:

#include "lm3s1968.h"

int main(void)
{
/*Configure Clock configuration for 50MHz*/
SYSCTL_RCC_R = 0x01C00380;

/*0. Enable port A (SPI)
*/
SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOA;
/*1. Configure input/output
*/
GPIO_PORTA_DIR_R = 0x2C;
/*2. Enable P(in)A SPI pins
*/
GPIO_PORTA_DEN_R = 0x3C;
/*3. Enable the peripheral clock of SSI
*/
SYSCTL_RCGC1_R = SYSCTL_RCGC1_SSI0;
/*4. Configure role as master
*/
SSI0_CR1_R = 0x00000000;
/*5. SSI Clock prescale register: Will run at 2MHz
*/
SSI0_CPSR_R = 0x00000005;
/*6. Configure protocol and clock: 4 is SRC, 1100 = C means mode 3, SPI, F means 16 bit
*/
SSI0_CR0_R = 0x000004CF;
/*7. Enable SSI
*/
SSI0_CR1_R = 0x00000002;

while(1)
{
/*8. Send message to FIFO Tx continuasly until
judgement day or if you unplug the hardware
*/
SSI0_DR_R = 0x183F;
}
return 0;
}

@LMI guys: It is a little bit of a pity that there is only the blinky example in this methodology (Direct register access). Would be possible some other examples in the future?

login or register to reply

davidm

Fresh Boarder

2008/11/04 17:32

Re:Problem: configuring SSI direct register access

Where have you selected the alternate use of pads for SSI?

eg

// PA5,PA4,PA2 for alternate function (SSI) use
GPIO_PORTA_AFSEL_R |= 0x34;

login or register to reply

ChristopherNeufelt

Senior Boarder

2008/11/06 02:28

Re:Problem: configuring SSI direct register access

Hallo to everyone!
The program was missing the statement of davidm. Now the program is working fine. Thanks David!
I will consider this thread closed, and I also include the full program.

#include "lm3s1968.h"

int main(void)
{
/*Configure Clock configuration for 50MHz*/
SYSCTL_RCC_R = 0x01C00380;

/*0. Enable port A (SPI)
*/
SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOA;
/*1. Configure input/output
*/
GPIO_PORTA_DIR_R = 0x2C;
/*2. Enable P(in)A SPI pins
*/
GPIO_PORTA_DEN_R = 0x3C;

/* The missing statement from David M.
*/
GPIO_PORTA_AFSEL_R |= 0x34;


/*3. Enable the peripheral clock of SSI
*/
SYSCTL_RCGC1_R = SYSCTL_RCGC1_SSI0;
/*4. Configure role as master
*/
SSI0_CR1_R = 0x00000000;
/*5. SSI Clock prescale register: Will run at 2MHz
*/
SSI0_CPSR_R = 0x00000005;
/*6. Configure protocol and clock: 4 is SRC, 1100 = C means mode 3, SPI, F means 16 bit
*/
SSI0_CR0_R = 0x000004CF;
/*7. Enable SSI
*/
SSI0_CR1_R = 0x00000002;

while(1)
{
/*8. Send message to FIFO Tx continuasly until
judgement day or if you unplug the hardware
*/
SSI0_DR_R = 0x183F;
}
return 0;
}

login or register to reply