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.
Hi, so I have a RTC on SPI1 and on Port F. I am using an EK-tm4c123gxl. However I was only recieving 0x00 back. I looked on an oscilloscope and found that some of the pins weren't even firing.
I have already tried unlocking F0.
How I initialise the SPI
void initTivaForRTC() { UARTprintf("Setup RTC"); SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI1); // LCD SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); //LCD // unlock HWREG(GPIO_PORTF_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTF_BASE+GPIO_O_CR) |= GPIO_PIN_0; GPIOPinTypeGPIOOutput (GPIO_PORTE_BASE, | GPIO_PORTE_BASE); GPIOPinConfigure(GPIO_PF2_SSI1CLK); GPIOPinConfigure(GPIO_PF0_SSI1RX); GPIOPinConfigure(GPIO_PF1_SSI1TX); GPIOPinTypeSSI(GPIO_PORT_F_BASE, RTC_SCLK_PIN | RTC_MOSI_PIN | RTC_MISO_PIN); ROM_SSIConfigSetExpClk (SSI1_BASE, ROM_SysCtlClockGet (), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 4000000, 8); ROM_SSIEnable (SSI1_BASE); while(SSIDataGetNonBlocking(SSI1_BASE, &ui32RcvDat)) { } UARTprintf(".\n"); }
And then I toggle CS
#define RTC_SELECT GPIO_PORTE_DATA_R = ~RTC_CS_PIN #define RTC_DESELECT GPIO_PORTE_DATA_R |= RTC_CS_PIN
And then I communicate to it using:
void rtc_setup(void) // This function to setup { RTC_SELECT; rtc_spi(0x04); RTC_DESELECT; } static uint32_t rtc_spi(u_char data) { uint8_t j = rtcIndex; UARTprintf("0x%02x ", data); SSIDataPut(SSI1_BASE, data); while(SSIBusy(SSI1_BASE)) { } SSIDataGet(SSI1_BASE, &rtcRecBuf[j]); rtcIndex++; return rtcRecBuf[j]; }
Any ideas why this could not be working? Thanks in advance.
My Bad , I am using this and it still does not work.
void initTivaForRTC() { UARTprintf("Setup RTC"); SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI1); // LCD SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); //LCD // unlock HWREG(GPIO_PORTF_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTF_BASE+GPIO_O_CR) |= GPIO_PIN_0; GPIOPinTypeGPIOOutput (GPIO_PORTE_BASE, GPIO_PIN_2); // This is ok GPIOPinConfigure(GPIO_PF2_SSI1CLK); GPIOPinConfigure(GPIO_PF0_SSI1RX); GPIOPinConfigure(GPIO_PF1_SSI1TX); GPIOPinTypeSSI(GPIO_PORTF_BASE, RTC_SCLK_PIN | RTC_MOSI_PIN | RTC_MISO_PIN); // This is ok ROM_SSIConfigSetExpClk (SSI1_BASE, ROM_SysCtlClockGet (), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 4000000, 8); ROM_SSIEnable (SSI1_BASE); while(SSIDataGetNonBlocking(SSI1_BASE, &ui32RcvDat)) { } UARTprintf(".\n"); }
I look on the logic analyser and it seems like nothing is happening..
Yes the full stop does print. I moved the code to another project to try it. And it still doesn't seem to work correctly.project1.zip