jinglixixi 发表于 2020-12-17 01:10

【GD32307E-START】+MP3播放控制

本帖最后由 jinglixixi 于 2020-12-17 18:59 编辑

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">GD32307E-START<span style="font-family:宋体">提供了与外部通讯的功能,并可用</span>USB<span style="font-family:宋体">接口转换为串口通讯,其接口电路如图</span>1<span style="font-family:宋体">所示。</span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">图</span>1&nbsp; USB<span style="font-family:宋体">转串口</span></span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">同样也可以使用该串口来控制</span>MP3<span style="font-family:宋体">模块进行播放,其整体电路构成如图</span>2<span style="font-family:宋体">所示。</span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">图</span>2 &nbsp;<span style="font-family:宋体">整体构成</span></span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">为了突出通讯功能的测试,这里直接用串口来输出歌单内容,其形式如图</span>3<span style="font-family:宋体">所示。</span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">图</span>3 <span style="font-family:宋体">播放内容输出</span></span></span></p>

<p>&nbsp;</p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">实现图示功能的主程序如下:</span></span></span></p>

<pre>
<code>int main(void)
{     
uint8_t  i,n;     
/* initialize the LEDs */       
led_init();      
/* configure systick */       
systick_config();     
/* configure EVAL_COM1 */       
gd_eval_com_init(EVAL_COM1);       
/* enable USART and GPIOA clock */       
rcu_periph_clock_enable(RCU_GPIOA);       
rcu_periph_clock_enable(RCU_USART0);       
rcu_periph_clock_enable(RCU_USART1);       
/* configure USART0 Tx as alternate function push-pull */       
gpio_init(GPIOB, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_6);             
/* configure USART1 Tx as alternate function push-pull */       
gpio_init(GPIOA, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_2);         
/* USART0 and USART1 baudrate configuration */       
usart_baudrate_set(USART0, 115200);      
usart_baudrate_set(USART1, 115200);       
/* enable USART0 half duplex mode*/       
usart_halfduplex_enable(USART0);       
/* enable USART1 half duplex mode*/       
usart_halfduplex_enable(USART1);       
/* configure USART transmitter */       
usart_transmit_config(USART0, USART_TRANSMIT_ENABLE);       
usart_transmit_config(USART1, USART_TRANSMIT_ENABLE);       
/* configure USART receiver */       
usart_receive_config(USART0, USART_RECEIVE_ENABLE);       
usart_receive_config(USART1, USART_RECEIVE_ENABLE);       
/* enable USART */       
usart_enable(USART0);       
usart_enable(USART1);      
printf("\r\n USART &amp; MP3 example:\r\n");      
setVolume(24);      
while(1)      
{           
if(RESET == gd_eval_key_state_get(KEY_WAKEUP))           
{             
// turn on LED1             
gd_eval_led_on(LED1);             
n++;             
if(n&gt;5) n=0;             
if(n==0)  printf("\r\n澎湖湾:\r\n");            
if(n==1)  printf("\r\n 放心去飞:\r\n");             
if(n==2)  printf("\r\n 味道:\r\n");             
if(n==3)  printf("\r\n 鸿雁:\r\n");             
if(n==4)  printf("\r\n 海阔天空:\r\n");             
if(n==5)  printf("\r\n 期待:\r\n");             
playn(n);             
for (i=0;i&lt;10;i++)              
{                   
while(RESET == usart_flag_get(USART1, USART_FLAG_TBE));
usart_data_transmit(USART1, cmd3);              
}             
delay_1ms(300);            
}            
else            
{                
// turn off LED1                 
gd_eval_led_off(LED1);                
delay_1ms(300);            
}       
}
}</code></pre>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p style="text-align:justify"><i>&nbsp;</i></p>

<p>&nbsp;</p>

<p>&nbsp;</p>

okhxyyo 发表于 2020-12-21 14:38

<p><strong><a href="https://bbs.eeworld.com.cn/elecplay/content/139" target="_blank">兆易GD32307E-START测评</a></strong></p>

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

w494143467 发表于 2020-12-17 09:13

<p>为啥看不到图片?是图片消失了?还是服务器的问题。</p>

jinglixixi 发表于 2020-12-17 10:45

w494143467 发表于 2020-12-17 09:13
为啥看不到图片?是图片消失了?还是服务器的问题。

<p>不知为什么,昨天就是不保存图片,回头去单位再补一下,看看是不是电脑出问题了。</p>

jinglixixi 发表于 2020-12-17 19:01

w494143467 发表于 2020-12-17 09:13
为啥看不到图片?是图片消失了?还是服务器的问题。

<p>照片补上了,可能是服务器的问题,图是原电脑发的。</p>
页: [1]
查看完整版本: 【GD32307E-START】+MP3播放控制