Hi! Sorry for writing in this forum, but Stellaris one became read-only...
I'm having a problem with the following code:
#include "inc/hw_memmap.h" #include "inc/hw_ssi.h" #include "inc/hw_types.h" #include "driverlib/ssi.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/sysctl.h" #include "utils/ustdlib.h" #include "driverlib/uart.h" #include "LCD/ST7565.h" #include "grlib/grlib.h" #define MS SysCtlClockGet()/(1000*3) #define US SysCtlClockGet()/(1000000*3) int main(void) { tContext sContext; tRectangle sRect; tDisplay sLCD; unsigned char LCDBuffer[LCD_WIDTH*LCD_HEIGHT/8];
// HANGS HERE SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinConfigure(GPIO_PB4_SSI2CLK); // SCK pin GPIOPinConfigure(GPIO_PB7_SSI2TX); // MOSI pin GPIOPinTypeSSI(GPIO_PORTB_BASE,GPIO_PIN_4|GPIO_PIN_7); GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_4); // A0 and LCD NCS pin configuration GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_4, 0xFF); // Set NCS high GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_5); // NRESET pin configuration GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_5, 0xFF); // Set NRESET high GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); // Set LED output pin SSIConfigSetExpClk(SSI2_BASE,SysCtlClockGet(),SSI_FRF_MOTO_MODE_3,SSI_MODE_MASTER,1000000,8); SSIEnable(SSI2_BASE); GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0xFF); /* ************************************************************************************************ * * GRAPHICS * * ************************************************************************************************ */
// When I comment out also this line works fine! // st7565r_InitDriver(&sLCD, LCDBuffer); // // return; // // // // // Initialize the graphics context. // // // GrContextInit(&sContext, &sLCD); // // // // // Fill the top 15 rows of the screen with blue to create the banner. // // // sRect.sXMin = 0; // sRect.sYMin = 0; // sRect.sXMax = GrContextDpyWidthGet(&sContext) - 1; // sRect.sYMax = 14; // GrContextForegroundSet(&sContext, ClrBlack); // GrRectFill(&sContext, &sRect); // // // // // Put the application name in the middle of the banner. // // // GrContextFontSet(&sContext, g_pFontFixed6x8); // GrStringDrawCentered(&sContext, "hello", -1, // GrContextDpyWidthGet(&sContext) / 2, 7, 0); // // // // // Say hello using the Computer Modern 20 point font. // // // GrContextFontSet(&sContext, g_pFontCm20); // GrStringDrawCentered(&sContext, "Hello World!", -1, // GrContextDpyWidthGet(&sContext) / 2, // ((GrContextDpyHeightGet(&sContext) - 16) / 2) + 16, // 0); // // // // // Flush any cached drawing operations. // // // GrFlush(&sContext); }
When lines in the bottom of main function are not commented debugging process hangs on SysCtlClockSet command. When I comment out st7565r_InitDriver(&sLCD, LCDBuffer); it works fine. What is strange - I am running it in step by step mode and the program is not even coming close to the commented lines. It always hangs on SysCtlClockSet.