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

Re: F7disco BSP for LCD causes bus error.

Posted: Fri Sep 20, 2019 12:15 pm
by jimmo
jrprogrammer wrote:
Sat May 18, 2019 3:58 pm
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
Sorry about the delayed response but I found this thread while trying to answer the same question in anohter thread.

It looks like forester3 implemented a driver for the LCD in their fork of micropython, at

In particular the code is here:
https://github.com/forester3/micropytho ... odlcdF7D.c

I don't know what other functionality it depends on from that fork, but it might be possible to copy it over into upstream micropython and add it to your build. See relevant changes to https://github.com/forester3/micropytho ... nfigport.h and lots of stuff in https://github.com/forester3/micropytho ... TM32F7DISC