Page 1 of 1

F7disco BSP for LCD causes bus error.

Posted: Thu Apr 26, 2018 8:58 am
by forester3
Hi,

I try to implement LCD module into micropython firmware on STM32F746G-disco.
But in SDRAM store statement, CPU hardware exception causes as bus fault.
Why?

void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code)
{
/* Write data value to all SDRAM memory */
if(hLtdcHandler.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565)
{ /* RGB565 format */
*(__IO uint16_t*) (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (2*(Ypos*BSP_LCD_GetXSize() + Xpos))) = (uint16_t)RGB_Code;
}
else
{ /* ARGB8888 format */
*(__IO uint32_t*) (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (4*(Ypos*BSP_LCD_GetXSize() + Xpos))) = RGB_Code;
}
}

Re: F7disco BSP for LCD causes bus error.

Posted: Thu Apr 26, 2018 4:06 pm
by dhylands
Was the SDRAM initialized? i.e. did you setup the clocks, turn it on, etc?

If you setup the board to have a serial REPL (instead of a USB one) then you'll get some more information printed on the serial REPL about the fault, including the actual address which caused the fault.

Re: F7disco BSP for LCD causes bus error.

Posted: Fri Apr 27, 2018 3:17 am
by forester3
Hi,

I setup machine.freq(192000000).
And then I call BSP_LCD_Init() function.
The function includes BSP_SDRAM_Init() function.

F7disco's LCD BSP could be found here:
https://os.mbed.com/teams/ST/code/BSP_D ... very_lcd.c

I aleady use TrueStudio to debug at symblic, but st-link debug is very slow.
I will try simple serial (non USB)REPL.

Thank you.

Re: F7disco BSP for LCD causes bus error.

Posted: Sun May 20, 2018 10:41 am
by forester3
Hi,

I scucessed merging BSP driver of LCD(STM32F746G-discovery) to MicroPython.
The source codes repository be found here: https://github.com/forester3/micropytho ... f7disc-lcd

But BSP driver has some probrem, so you try to use carefully this module.

https://os.mbed.com/teams/ST/code/BSP_D ... cd_8c.html
The LCD module calls the BSP global function described in the above URL.

How to use LCD module.

import lcdF7D
lcdF7D.init()
lcdF7D.set_font(18)
lcdF7D.display_string_at_line(3,"Hello, STM32F746G-Discovery")
lcdF7D.set_font(16)
lcdF7D.display_string_at_line(5,"Good collaboration with MicroPython !")
lcdF7D.deinit()

Re: F7disco BSP for LCD causes bus error.

Posted: Sun May 20, 2018 3:14 pm
by shaoziyang
It is great!

lcdconsole for F7disco

Posted: Tue Jul 31, 2018 12:28 pm
by forester3
Hi,
I updated lcd module for STM32F746G-Disco. It is named "lcdF7D".
Now it works lcd console to use uos.dupterm.

>>> import lcdconsole
>>> con = lcdconsole.LcdConsole()
>>> uos.dupterm(con)

This lcdconsole module will be found here: https://github.com/forester3/micropytho ... console.py

Re: F7disco BSP for LCD causes bus error.

Posted: Sat May 18, 2019 3:58 pm
by jrprogrammer
I'm having an issue finding "lcdF7D"... When you say "import lcdF7D"... searching high and low, I can't find it. Can you tell me where it is hiding?
Thanks
Jim