tinnu 发表于 2020-10-6 21:03

【GD32450I-EVAL】板载SDRAM支持LittleVGL

<p>此前的程序都是只支持内部RAM,内部RAM对于480*272的屏幕来说终究还是小了点,为了支持整个屏幕,必须开辟480*272*4字节的空间,总共510K,板载芯片尾号IK,只有256K,就算是最大的那个II系列,也只有512K,其余的程序分配2K根本就不够,单论堆栈空间都需要8K。</p>

<p>&nbsp;</p>

<p><span style="font-size:20px;"><span style="font-family:楷体;">(一)外部SDRAM驱动</span></span></p>

<p>GD系列单片机SDRAM的驱动总线叫做EXMC,这个外设还同时支持各种nand flash nor falsh</p>

<p>地址示意:</p>

<p>SDRAM设备支持两个,起始地址分别是0xC0000000和0xD0000000,一个设备竟然有256Mb,一开始觉得这个配置是不是会空余很大的空白地址,后来看了下程序,发现整个256Mb都被使用了才发现。</p>

<p></p>

<p>这颗SDRAM型号是 MT48LC16M16A2P-6AIT ,里面有个16M的字样,一开始理所当然地以为是16M,后来看代码发现不太对,搜了一下才发现是一颗镁光的256M的内存!</p>

<p>&nbsp;</p>

<p>驱动代码方面没什么值得注意的,因为配置完EXMC之后,就跟操作内部存储的差距不大了,屏蔽了底层,不需要调用什么函数。</p>

<p>驱动代码可以直接引用例程EXMC里面的SDRAM工程代码。</p>

<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-cpp"><span class="hljs-comment">/* Define mode register content */</span>
<span class="hljs-comment">/* Burst Length */</span>
<span class="hljs-preprocessor">#define SDRAM_MODEREG_BURST_LENGTH_1             ((uint16_t)0x0000)</span>
<span class="hljs-preprocessor">#define SDRAM_MODEREG_BURST_LENGTH_2             ((uint16_t)0x0001)</span>
<span class="hljs-preprocessor">#define SDRAM_MODEREG_BURST_LENGTH_4             ((uint16_t)0x0002)</span>
<span class="hljs-preprocessor">#define SDRAM_MODEREG_BURST_LENGTH_8             ((uint16_t)0x0003)</span>

<span class="hljs-comment">/* Burst Type */</span>
<span class="hljs-preprocessor">#define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL      ((uint16_t)0x0000)</span>
<span class="hljs-preprocessor">#define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED   ((uint16_t)0x0008)</span>

<span class="hljs-comment">/* CAS Latency */</span>
<span class="hljs-preprocessor">#define SDRAM_MODEREG_CAS_LATENCY_2            ((uint16_t)0x0020)</span>
<span class="hljs-preprocessor">#define SDRAM_MODEREG_CAS_LATENCY_3            ((uint16_t)0x0030)</span>

<span class="hljs-comment">/* Write Mode */</span>
<span class="hljs-preprocessor">#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000)</span>
<span class="hljs-preprocessor">#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE   ((uint16_t)0x0200)</span>

<span class="hljs-preprocessor">#define SDRAM_MODEREG_OPERATING_MODE_STANDARD    ((uint16_t)0x0000)</span>

<span class="hljs-preprocessor">#define SDRAM_TIMEOUT                            ((uint32_t)0x0000FFFF)</span>


<span class="hljs-comment">/*!
    \brief      sdram peripheral initialize
    \paramsdram_device: specifie the SDRAM device
    \param none
    \retval   none
*/</span>
<span class="hljs-keyword">void</span> exmc_synchronous_dynamic_ram_init(uint32_t sdram_device)
{
    exmc_sdram_parameter_struct      sdram_init_struct;
    exmc_sdram_timing_parameter_structsdram_timing_init_struct;
    exmc_sdram_command_parameter_struct   sdram_command_init_struct;

    uint32_t command_content = <span class="hljs-number">0</span>, bank_select;
    uint32_t timeout = SDRAM_TIMEOUT;

    <span class="hljs-comment">/* enable EXMC clock*/</span>
    rcu_periph_clock_enable(RCU_EXMC);
    rcu_periph_clock_enable(RCU_GPIOB);
    rcu_periph_clock_enable(RCU_GPIOC);
    rcu_periph_clock_enable(RCU_GPIOD);
    rcu_periph_clock_enable(RCU_GPIOE);
    rcu_periph_clock_enable(RCU_GPIOF);
    rcu_periph_clock_enable(RCU_GPIOG);
    rcu_periph_clock_enable(RCU_GPIOH);


    <span class="hljs-comment">/* common GPIO configuration */</span>
    <span class="hljs-comment">/* SDNE0(PC2),SDCKE0(PC5) pin configuration */</span>
    gpio_af_set(GPIOC, GPIO_AF_12, GPIO_PIN_2 | GPIO_PIN_5);
    gpio_mode_set(GPIOC, GPIO_MODE_AF, GPIO_PUPD_PULLUP, GPIO_PIN_2 | GPIO_PIN_5);
    gpio_output_options_set(GPIOC, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_2 | GPIO_PIN_5);

    <span class="hljs-comment">/* D2(PD0),D3(PD1),D13(PD8),D14(PD9),D15(PD10),D0(PD14),D1(PD15) pin configuration */</span>
    gpio_af_set(GPIOD, GPIO_AF_12, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_8 | GPIO_PIN_9 |
                                 GPIO_PIN_10 | GPIO_PIN_14 | GPIO_PIN_15);
    gpio_mode_set(GPIOD, GPIO_MODE_AF, GPIO_PUPD_PULLUP, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_8 | GPIO_PIN_9 |
                                                         GPIO_PIN_10 | GPIO_PIN_14 | GPIO_PIN_15);
    gpio_output_options_set(GPIOD, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_8 | GPIO_PIN_9 |
                                                                     GPIO_PIN_10 | GPIO_PIN_14 | GPIO_PIN_15);

    <span class="hljs-comment">/* NBL0(PE0),NBL1(PE1),D4(PE7),D5(PE8),D6(PE9),D7(PE10),D8(PE11),D9(PE12),D10(PE13),D11(PE14),D12(PE15) pin configuration */</span>
    gpio_af_set(GPIOE, GPIO_AF_12, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_7| GPIO_PIN_8 |
                                 GPIO_PIN_9| GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 |
                                 GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
    gpio_mode_set(GPIOE, GPIO_MODE_AF, GPIO_PUPD_PULLUP, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_7| GPIO_PIN_8 |
                                                         GPIO_PIN_9| GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 |
                                                         GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
    gpio_output_options_set(GPIOE, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_7| GPIO_PIN_8 |
                                                                     GPIO_PIN_9| GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 |
                                                                     GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);

    <span class="hljs-comment">/* A0(PF0),A1(PF1),A2(PF2),A3(PF3),A4(PF4),A5(PF5),NRAS(PF11),A6(PF12),A7(PF13),A8(PF14),A9(PF15) pin configuration */</span>
    gpio_af_set(GPIOF, GPIO_AF_12, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_2| GPIO_PIN_3|
                                 GPIO_PIN_4| GPIO_PIN_5| GPIO_PIN_11 | GPIO_PIN_12 |
                                 GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
    gpio_mode_set(GPIOF, GPIO_MODE_AF, GPIO_PUPD_PULLUP, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_2| GPIO_PIN_3|
                                                         GPIO_PIN_4| GPIO_PIN_5| GPIO_PIN_11 | GPIO_PIN_12 |
                                                         GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
    gpio_output_options_set(GPIOF, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_2| GPIO_PIN_3|
                                                                     GPIO_PIN_4| GPIO_PIN_5| GPIO_PIN_11 | GPIO_PIN_12 |
                                                                     GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);

    <span class="hljs-comment">/* A10(PG0),A11(PG1),A12(PG2),A14(PG4),A15(PG5),SDCLK(PG8),NCAS(PG15) pin configuration */</span>
    gpio_af_set(GPIOG, GPIO_AF_12, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_4 |
                                 GPIO_PIN_5 | GPIO_PIN_8 | GPIO_PIN_15);
    gpio_mode_set(GPIOG, GPIO_MODE_AF, GPIO_PUPD_PULLUP, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_4 |
                                                         GPIO_PIN_5 | GPIO_PIN_8 | GPIO_PIN_15);
    gpio_output_options_set(GPIOG, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_4 |
                                                                     GPIO_PIN_5 | GPIO_PIN_8 | GPIO_PIN_15);
    <span class="hljs-comment">/* SDNWE(PH5) pin configuration */</span>
    gpio_af_set(GPIOH, GPIO_AF_12, GPIO_PIN_5);
    gpio_mode_set(GPIOH, GPIO_MODE_AF, GPIO_PUPD_PULLUP, GPIO_PIN_5);
    gpio_output_options_set(GPIOH, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_5);

    <span class="hljs-comment">/* specify which SDRAM to read and write */</span>
    <span class="hljs-keyword">if</span>(EXMC_SDRAM_DEVICE0 == sdram_device)
    {
      bank_select = EXMC_SDRAM_DEVICE0_SELECT;
    }
    <span class="hljs-keyword">else</span>
    {
      bank_select = EXMC_SDRAM_DEVICE1_SELECT;
    }

    <span class="hljs-comment">/* EXMC SDRAM device initialization sequence --------------------------------*/</span>
    <span class="hljs-comment">/* Step 1 : configure SDRAM timing registers --------------------------------*/</span>
    <span class="hljs-comment">/* LMRD: 2 clock cycles */</span>
    sdram_timing_init_struct.load_mode_register_delay = <span class="hljs-number">2</span>;
    <span class="hljs-comment">/* XSRD: min = 67ns */</span>
    sdram_timing_init_struct.exit_selfrefresh_delay = <span class="hljs-number">7</span>;
    <span class="hljs-comment">/* RASD: min=42ns , max=120k (ns) */</span>
    sdram_timing_init_struct.row_address_select_delay = <span class="hljs-number">5</span>;
    <span class="hljs-comment">/* ARFD: min=60ns */</span>
    sdram_timing_init_struct.auto_refresh_delay = <span class="hljs-number">6</span>;
    <span class="hljs-comment">/* WRD:min=1 Clock cycles +6ns */</span>
    sdram_timing_init_struct.write_recovery_delay = <span class="hljs-number">2</span>;
    <span class="hljs-comment">/* RPD:min=18ns */</span>
    sdram_timing_init_struct.row_precharge_delay = <span class="hljs-number">2</span>;
    <span class="hljs-comment">/* RCD:min=18ns */</span>
    sdram_timing_init_struct.row_to_column_delay = <span class="hljs-number">2</span>;
   
    <span class="hljs-comment">/* step 2 : configure SDRAM control registers ---------------------------------*/</span>
    sdram_init_struct.sdram_device = sdram_device;
    sdram_init_struct.column_address_width = EXMC_SDRAM_COW_ADDRESS_9;
    sdram_init_struct.row_address_width = EXMC_SDRAM_ROW_ADDRESS_13;
    sdram_init_struct.data_width = EXMC_SDRAM_DATABUS_WIDTH_16B;
    sdram_init_struct.internal_bank_number = EXMC_SDRAM_4_INTER_BANK;
    sdram_init_struct.cas_latency = EXMC_CAS_LATENCY_3_SDCLK;
    sdram_init_struct.write_protection = DISABLE;
    sdram_init_struct.sdclock_config = EXMC_SDCLK_PERIODS_2_HCLK;
    sdram_init_struct.brust_read_switch = ENABLE;
    sdram_init_struct.pipeline_read_delay = EXMC_PIPELINE_DELAY_1_HCLK;
    sdram_init_struct.timing= &amp;sdram_timing_init_struct;
    <span class="hljs-comment">/* EXMC SDRAM bank initialization */</span>
    exmc_sdram_init(&amp;sdram_init_struct);

    <span class="hljs-comment">/* step 3 : configure CKE high command---------------------------------------*/</span>
    sdram_command_init_struct.command = EXMC_SDRAM_CLOCK_ENABLE;
    sdram_command_init_struct.bank_select = bank_select;
    sdram_command_init_struct.auto_refresh_number = EXMC_SDRAM_AUTO_REFLESH_1_SDCLK;
    sdram_command_init_struct.mode_register_content = <span class="hljs-number">0</span>;
    <span class="hljs-comment">/* wait until the SDRAM controller is ready */</span>
    <span class="hljs-keyword">while</span>((exmc_flag_get(sdram_device, EXMC_SDRAM_FLAG_NREADY) != RESET) &amp;&amp; (timeout &gt; <span class="hljs-number">0</span>))
    {
      timeout--;
    }
    <span class="hljs-comment">/* send the command */</span>
    exmc_sdram_command_config(&amp;sdram_command_init_struct);

    <span class="hljs-comment">/* step 4 : insert 10ms delay----------------------------------------------*/</span>
    delay_1ms(<span class="hljs-number">10</span>);

    <span class="hljs-comment">/* step 5 : configure precharge all command----------------------------------*/</span>
    sdram_command_init_struct.command = EXMC_SDRAM_PRECHARGE_ALL;
    sdram_command_init_struct.bank_select = bank_select;
    sdram_command_init_struct.auto_refresh_number = EXMC_SDRAM_AUTO_REFLESH_1_SDCLK;
    sdram_command_init_struct.mode_register_content = <span class="hljs-number">0</span>;
    <span class="hljs-comment">/* wait until the SDRAM controller is ready */</span>
    timeout = SDRAM_TIMEOUT;
    <span class="hljs-keyword">while</span>((exmc_flag_get(sdram_device, EXMC_SDRAM_FLAG_NREADY) != RESET) &amp;&amp; (timeout &gt; <span class="hljs-number">0</span>))
    {
      timeout--;
    }
    <span class="hljs-comment">/* send the command */</span>
    exmc_sdram_command_config(&amp;sdram_command_init_struct);

    <span class="hljs-comment">/* step 6 : configure Auto-Refresh command-----------------------------------*/</span>
    sdram_command_init_struct.command = EXMC_SDRAM_AUTO_REFRESH;
    sdram_command_init_struct.bank_select = bank_select;
    sdram_command_init_struct.auto_refresh_number = EXMC_SDRAM_AUTO_REFLESH_8_SDCLK;
    sdram_command_init_struct.mode_register_content = <span class="hljs-number">0</span>;
    <span class="hljs-comment">/* wait until the SDRAM controller is ready */</span>
    timeout = SDRAM_TIMEOUT;
    <span class="hljs-keyword">while</span>((exmc_flag_get(sdram_device, EXMC_SDRAM_FLAG_NREADY) != RESET) &amp;&amp; (timeout &gt; <span class="hljs-number">0</span>))
    {
      timeout--;
    }
    <span class="hljs-comment">/* send the command */</span>
    exmc_sdram_command_config(&amp;sdram_command_init_struct);

    <span class="hljs-comment">/* step 7 : configure load mode register command-----------------------------*/</span>
    <span class="hljs-comment">/* program mode register */</span>
    command_content = (uint32_t)SDRAM_MODEREG_BURST_LENGTH_1      |
                              SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL   |
                              SDRAM_MODEREG_CAS_LATENCY_3         |
                              SDRAM_MODEREG_OPERATING_MODE_STANDARD |
                              SDRAM_MODEREG_WRITEBURST_MODE_SINGLE;

    sdram_command_init_struct.command = EXMC_SDRAM_LOAD_MODE_REGISTER;
    sdram_command_init_struct.bank_select = bank_select;
    sdram_command_init_struct.auto_refresh_number = EXMC_SDRAM_AUTO_REFLESH_1_SDCLK;
    sdram_command_init_struct.mode_register_content = command_content;

    <span class="hljs-comment">/* wait until the SDRAM controller is ready */</span>
    timeout = SDRAM_TIMEOUT;
    <span class="hljs-keyword">while</span>((exmc_flag_get(sdram_device, EXMC_SDRAM_FLAG_NREADY) != RESET) &amp;&amp; (timeout &gt; <span class="hljs-number">0</span>))
    {
      timeout--;
    }
    <span class="hljs-comment">/* send the command */</span>
    exmc_sdram_command_config(&amp;sdram_command_init_struct);

    <span class="hljs-comment">/* step 8 : set the auto-refresh rate counter--------------------------------*/</span>
    <span class="hljs-comment">/* 64ms, 8192-cycle refresh, 64ms/8192=7.81us */</span>
    <span class="hljs-comment">/* SDCLK_Freq = SYS_Freq/2 */</span>
    <span class="hljs-comment">/* (7.81 us * SDCLK_Freq) - 20 */</span>
    exmc_sdram_refresh_count_set(<span class="hljs-number">761</span>);

    <span class="hljs-comment">/* wait until the SDRAM controller is ready */</span>
    timeout = SDRAM_TIMEOUT;
    <span class="hljs-keyword">while</span>((exmc_flag_get(sdram_device, EXMC_SDRAM_FLAG_NREADY) != RESET) &amp;&amp; (timeout &gt; <span class="hljs-number">0</span>))
    {
      timeout--;
    }
}
</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url(&quot;https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png&quot;) rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>

<p>&nbsp;</p>

<p><span style="font-size:20px;"><span style="font-family:楷体;">(二)将缓冲放到SDRAM中</span></span></p>

<p>LittleVGL 和 TLI配置的缓冲区都要修改。</p>

<p>1-配置缓冲地址</p>

<p>定义SDRAM中的地址,初始化中使用了是SDRAM设备0,对应地址为&nbsp;0xC0000000&nbsp;</p>

<p>定义地址:</p>

<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-cpp"><span class="hljs-preprocessor">#define EXT_BUFFER0_ADDR    0xC0000000</span>
<span class="hljs-preprocessor">#define EXT_BUFFER1_ADDR    (EXT_BUFFER0_ADDR + LCD_WIDTH * LCD_HEIGHT * 2)</span></code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url(&quot;https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png&quot;) rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>

<p>*2是因为每个像素包含一个RGB565数据,5+6+5是16bit即两个8字节。</p>

<p>&nbsp;</p>

<p>2-TLI 缓冲区</p>

<p>把TLI初始化中的缓冲位定向到SDRAM的地址中:</p>

<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-cpp">    tli_layer_init_struct.layer_frame_bufaddr = (uint32_t)EXT_BUFFER0_ADDR;
    tli_layer_init_struct.layer_frame_bufaddr = (uint32_t)EXT_BUFFER1_ADDR;</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url(&quot;https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png&quot;) rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>

<p>删去layer_window_leftpos、layer_window_rightpos、layer_window_toppos、layer_window_bottompos的偏移:</p>

<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-cpp">    tli_layer_init_struct.layer_window_leftpos = HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH;
    tli_layer_init_struct.layer_window_rightpos = (LCD_WIDTH + HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH - 1);
    tli_layer_init_struct.layer_window_toppos = VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH;
    tli_layer_init_struct.layer_window_bottompos = (LCD_HEIGHT + VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH - 1);
</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url(&quot;https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png&quot;) rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>

<p></p>

<p>3-LittleVGL 缓冲</p>

<p>lv_port_disp_init 函数里,首先要在一开始调用EXMC的初始化函数,并且开辟内存:</p>

<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-cpp">    exmc_synchronous_dynamic_ram_init(EXMC_SDRAM_DEVICE0);
    delay_ms(<span class="hljs-number">1</span>);
    <span class="hljs-built_in">memset</span>((<span class="hljs-keyword">void</span> *)EXT_BUFFER0_ADDR, <span class="hljs-number">0</span>, LCD_WIDTH * LCD_HEIGHT * LCD_FB_BYTE_PER_PIXEL*<span class="hljs-number">2</span>);
    <span class="hljs-built_in">memset</span>((<span class="hljs-keyword">void</span> *)EXT_BUFFER1_ADDR, <span class="hljs-number">0</span>, LCD_WIDTH * LCD_HEIGHT * LCD_FB_BYTE_PER_PIXEL*<span class="hljs-number">2</span>);
        </code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url(&quot;https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png&quot;) rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>

<p>重新定向缓冲区:</p>

<pre>
<code class="language-cpp">
        static lv_disp_buf_t disp_buf;
    lv_disp_buf_init(&amp;disp_buf, EXT_BUFFER0_ADDR, EXT_BUFFER1_ADDR, LCD_WIDTH * LCD_HEIGHT * LCD_FB_BYTE_PER_PIXEL);
    disp_drv.buffer = &amp;disp_buf;</code></pre>

<p>&nbsp;</p>

<p>4-重新配置触摸范围</p>

<p>DEMO_ReadTouch 函数中,把以下两行注释掉:</p>

<pre>
<code class="language-cpp">       // touch_x -= 20;
      // touch_y -= 30;</code></pre>

<p>&nbsp;</p>

<p><span style="font-size:20px;"><span style="font-family:楷体;">(三)显示效果</span></span></p>

<p>对比之前的局部显示效果:</p>

<p><img _height="360" border="0" src="https://bbs.eeworld.com.cn/data/attachment/forum/202010/06/185738k7ae7i99so7i71he.gif" width="640" /></p>

<p>&nbsp;</p>

<p><span style="font-size:20px;"><span style="font-family:楷体;">代码:</span></span></p>

<p>源码查看本人gitee开源代码:<a href="https://gitee.com/tinnu/littlevgl_gd32f450" target="_blank">LittleVGL_GD32F450</a></p>

okhxyyo 发表于 2020-10-9 15:48

<p><a href="https://bbs.eeworld.com.cn/thread-1140981-1-1.html" target="_blank">兆易GD32450I-EVAL</a></p>

<p>汇总贴:<a href="https://bbs.eeworld.com.cn/thread-1140981-1-1.html">https://bbs.eeworld.com.cn/thread-1140981-1-1.html</a></p>

老母鸡 发表于 2021-6-15 20:27

楼主您好啊,请问下这个有完整工程能开源一下吗,谢谢了

tinnu 发表于 2021-6-15 23:44

老母鸡 发表于 2021-6-15 20:27
楼主您好啊,请问下这个有完整工程能开源一下吗,谢谢了

<p>最后有链接啊&hellip;&hellip;gitee上有,没有工程文件,要自己吧源文件添加</p>

liangbread 发表于 2022-5-31 01:13

<p>请问可以通过407接sdram同时驱动intel8080接口的lcd吗</p>
页: [1]
查看完整版本: 【GD32450I-EVAL】板载SDRAM支持LittleVGL