F7disco BSP for LCD causes bus error.

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
forester3
Posts: 22
Joined: Sat Oct 21, 2017 5:01 am

F7disco BSP for LCD causes bus error.

Post by forester3 » Thu Apr 26, 2018 8:58 am

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;
}
}

User avatar
dhylands
Posts: 3211
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: F7disco BSP for LCD causes bus error.

Post by dhylands » Thu Apr 26, 2018 4:06 pm

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.

forester3
Posts: 22
Joined: Sat Oct 21, 2017 5:01 am

Re: F7disco BSP for LCD causes bus error.

Post by forester3 » Fri Apr 27, 2018 3:17 am

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.

forester3
Posts: 22
Joined: Sat Oct 21, 2017 5:01 am

Re: F7disco BSP for LCD causes bus error.

Post by forester3 » Sun May 20, 2018 10:41 am

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()

shaoziyang
Posts: 272
Joined: Sun Apr 17, 2016 1:55 pm

Re: F7disco BSP for LCD causes bus error.

Post by shaoziyang » Sun May 20, 2018 3:14 pm

It is great!

forester3
Posts: 22
Joined: Sat Oct 21, 2017 5:01 am

lcdconsole for F7disco

Post by forester3 » Tue Jul 31, 2018 12:28 pm

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

jrprogrammer
Posts: 7
Joined: Sat Feb 09, 2019 1:51 pm

Re: F7disco BSP for LCD causes bus error.

Post by jrprogrammer » 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
Jim

Post Reply