Hi,
I am having an issue with spi read status register at the bootloader. The issue seems to be only when power supply is connected, however the same piece of code works when debugger (MikroeProg) is connected.
I seems a bit strange why it fails. The failure seems to be when it does read status register.
SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOQ); SysCtlPeripheralEnable( SYSCTL_PERIPH_GPION); GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_4); GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_4); GPIOPinTypeGPIOInput(GPIO_PORTQ_BASE, GPIO_PIN_3); spi_deselect(); SysCtlPeripheralReset(SYSCTL_PERIPH_SSI3); SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3); GPIOPinConfigure(GPIO_PQ0_SSI3CLK); GPIOPinConfigure(GPIO_PQ3_SSI3XDAT1); GPIOPinConfigure(GPIO_PQ2_SSI3XDAT0); GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_4 , GPIO_PIN_4); // Disable WP GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_5 , GPIO_PIN_5); // Disable hold GPIOPinTypeSSI(GPIO_PORTQ_BASE, GPIO_PIN_0|GPIO_PIN_2 | GPIO_PIN_3); uint32_t g_ui32SysClock; g_ui32SysClock =SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480),50000000 ); SSIConfigSetExpClk(SSI3_BASE, g_ui32SysClock, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, SST25_FLASH_SPI_RATE, 8); SSIEnable(SSI3_BASE); { unsigned long Temp; while(SSIDataGetNonBlocking(SSI3_BASE, Temp)) { } } spi_write(SST25_CMD_RDSR); uint8_t spi_val = spi_write(0); // dummy spi_deselect(); // while (spi_val != 0x02) ; // Error! Failure at this line.
For the time being i have commented out the check for 0x02.
I went through the data sheet to see if i have missed out any initialization, but could not find anything. If anyone has clues why this fails at bootloader when power supply is connected and same code works when jtag/debugger is used.
Any suggestions / workaround will be great.
Thank you
Kumar