Hello,
I made a custom board using the stm32f407 microcontroller, a 480x272 tft display with the SSD1963 controller, and an external sram chip IS61WV102416BLL.
Without emWin,
- I confirmed that I can display an image on the display
- Write and read back 32-bit data to and from the sram
The problem is, I am trying to use emWin for the first time with embOS, and I get stuck in an infinite loop after calling GUI_Init(). Using the debugger I found out that I am stuck in an interrupt handler (CAN1_RX1_IRQHandler) after GUIDRV_FlexColor_SetMode16bppC1B16() is called.
I am not really sure which direction to take to debug this issue. Nowhere in my code do I explicitly enable interrupts (so nothing related to the CAN bus).
Any help would be appreciated.
Please let me know if there is any question, thank you.
main.c
Display All
LCDConf.c
Display All
GUIConf.c
Display All
And .GUI_RAM lives in the SRAM.
Project specs:
Environment: Segger Embedded Studio
Microcontroller: stm32f407
Display driver: SSD1963
SRAM: IS61WV102416BLL
Heap Size: 1024 Bytes
Main Stack Size: 1024 Bytes
Process Stack Size: 0 Bytes
I made a custom board using the stm32f407 microcontroller, a 480x272 tft display with the SSD1963 controller, and an external sram chip IS61WV102416BLL.
Without emWin,
- I confirmed that I can display an image on the display
- Write and read back 32-bit data to and from the sram
The problem is, I am trying to use emWin for the first time with embOS, and I get stuck in an infinite loop after calling GUI_Init(). Using the debugger I found out that I am stuck in an interrupt handler (CAN1_RX1_IRQHandler) after GUIDRV_FlexColor_SetMode16bppC1B16() is called.
I am not really sure which direction to take to debug this issue. Nowhere in my code do I explicitly enable interrupts (so nothing related to the CAN bus).
Any help would be appreciated.
Please let me know if there is any question, thank you.
main.c
C Source Code
- static OS_STACKPTR int stack_display[768]; /* Task stack */
- static OS_TASK tcb_display; /* Task-control-block */
- int main(void)
- {
- OS_Init(); // Initialize embOS
- OS_InitHW(); // Initialize required hardware
- BSP_Init(); // Initialize LED ports
- OS_CREATETASK(&tcb_display, "maintask_display", maintask_display, 100, stack_display);
- OS_Start(); // Start embOS
- return 0;
- }
LCDConf.c
C Source Code
- /*********************************************************************
- *
- * LCD_X_Config
- *
- * Function description:
- * Called during the initialization process in order to set up the
- * display driver configuration.
- *
- */
- void LCD_X_Config(void)
- {
- GUI_DEVICE * pDevice;
- CONFIG_FLEXCOLOR pConfig = { 0, 0, 0, 0, -1 };
- GUI_PORT_API PortAPI = {0};
- //
- // Set display driver and color conversion
- //
- pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_565, 0, 0);
- //
- // Configure driver's orientation
- //
- pConfig.Orientation = GUI_MIRROR_X;
- // pConfig.Orientation = GUI_SWAP_XY | GUI_MIRROR_Y;
- GUIDRV_FlexColor_Config(pDevice, &pConfig);
- //
- // Display driver configuration, required for Lin-driver
- //
- LCD_SetSizeEx (0, XSIZE_PHYS, YSIZE_PHYS);
- LCD_SetVSizeEx(0, VXSIZE_PHYS, VYSIZE_PHYS);
- //
- // Set controller and operation mode
- //
- PortAPI.pfWrite16_A0 = ssd1963_WriteReg;
- PortAPI.pfWrite16_A1 = ssd1963_WriteData;
- PortAPI.pfWriteM16_A1 = ssd1963_WriteDataMultiple;
- PortAPI.pfRead16_A1 = ssd1963_ReadData;
- PortAPI.pfReadM16_A1 = ssd1963_ReadDataMultiple;
- // GUIDRV_FlexColor_SetReadFunc66720_B16(pDevice, GUIDRV_FLEXCOLOR_READ_FUNC_II);
- GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66720, GUIDRV_FLEXCOLOR_M16C1B16);
- }
- /*********************************************************************
- *
- * LCD_X_DisplayDriver
- *
- * Function description:
- * This function is called by the display driver for several purposes.
- * To support the according task the routine needs to be adapted to
- * the display controller. Please note that the commands marked with
- * 'optional' are not cogently required and should only be adapted if
- * the display controller supports these features.
- *
- * Parameter:
- * LayerIndex - Index of layer to be configured
- * Cmd - Please refer to the details in the switch statement below
- * pData - Pointer to a LCD_X_DATA structure
- *
- * Return Value:
- * < -1 - Error
- * -1 - Command not handled
- * 0 - Ok
- */
- int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData)
- {
- int r;
- (void) LayerIndex;
- (void) pData;
- switch (Cmd)
- {
- case LCD_X_INITCONTROLLER:
- {
- ssd1963_Init();
- return 0;
- }
- default:
- r = -1;
- }
- return r;
- }
GUIConf.c
C Source Code
- #include "GUI.h"
- #include "BSP_GUI.h"
- #include "PIDConf.h"
- /*********************************************************************
- *
- * Defines
- *
- **********************************************************************
- */
- //
- // Define the available number of bytes available for the GUI
- //
- #define GUI_NUMBYTES 0x400
- #if (defined __ICCARM__) // IAR
- static __no_init U32 aMemory[GUI_NUMBYTES / 4] @ ".GUI_RAM";
- #elif (defined __SES_ARM) // SES
- static U32 aMemory[GUI_NUMBYTES / 4] __attribute__ ((section (".GUI_RAM")));
- #else
- static U32 aMemory[GUI_NUMBYTES / 4];
- #endif
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * Public code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * GUI_X_Config
- *
- * Purpose:
- * Called during the initialization process in order to set up the
- * available memory for the GUI.
- */
- void GUI_X_Config(void)
- {
- //
- // Assign memory to emWin
- //
- GUI_ALLOC_AssignMemory(aMemory, GUI_NUMBYTES);
- //
- // Set default font
- //
- GUI_SetDefaultFont(GUI_FONT_6X8);
- //
- // Init touch
- //
- //#ifndef _WINDOWS
- // GUI_PID_SetInitFunc(PID_X_Init);
- //#endif
- }
And .GUI_RAM lives in the SRAM.
Project specs:
Environment: Segger Embedded Studio
Microcontroller: stm32f407
Display driver: SSD1963
SRAM: IS61WV102416BLL
Heap Size: 1024 Bytes
Main Stack Size: 1024 Bytes
Process Stack Size: 0 Bytes