WCH,CH32V208体验首篇
<div class='showpostmsg'><div>一, 简介</div><div>CH32V208WBU6-EVT-R0</div>
<div>RISC-V指令集 主频144MHz</div>
<div>GPIO口X53</div>
<div>4路USART*4(我眼中的核心功能,4路UART通信,可以直接外接4路传感器,或从机,三路接传感器,一路远程通信)</div>
<div>I2C *2</div>
<div>SPI *2</div>
<div>CAN *1 (有这玩意做机器人底盘也不错)</div>
<div>另外可圈可点的地方就是 两路USB2.0 一个高速网口,用料还是比较用心</div>
<div>集成开发环境</div>
<div>二 外观介绍及特殊情况</div>
<div></div>
<div></div>
<div>板载通孔,过孔非常多,难以仿制</div>
<div>其中,由于我在WCH官网也申请了两个低功耗蓝牙网关,其中有一个也是CH32V208…故而发现做工有一丢丢问题:</div>
<div>(注意芯片背面焊锡</div>
<div></div>
<div>其中有板芯片下过孔焊锡有残留,(白色为手机闪光灯,拍摄环境有限,见谅</div>
<div>三 开发环境的搭建及WCH linke的使用</div>
<div>由于官方已有集成开发环境,安装简单,下载解压后一路next和agree即可</div>
<div>桌面图标软件界面(空白页)</div>
<div>好好好,这种小概率事件也能给我碰上是吧,就是不知道是硬件问题还是软件问题,查找了官方回答,建议拔了重新插,试了没用,按IAR拔了重插没法实验,壳子不好拆,暂不进行破坏性实验,第二个建议是手动下载驱动,该方法解决了问题</div>
<div></div>
<div></div>
<div>其他建议: 建议开发板测评能够顺便赠送连接调试器的杜邦线 最好是一体的,方便测评</div>
<div>三点五:WCH link 驱动出问题,及解决方法</div>
<div>如何解决呢? 右键 MounRiver Studio 选择 打开文件所在位置</div>
<div>找到E:\Environment\WCH\MounRiver_Studio\LinkDrv\WCHLink</div>
<div>(./安装目录(WCH)\ MounRiver_Studio\LinkDrv\WCHLink</div>
<div>打开 SETU.EXE 出现下图</div>
<div></div>
<div>先点击卸载,确认</div>
<div>在点击 安装 确认</div>
<div>在设备管理器中检查,如下图,即为安装驱动成功(该方法仅限官方集成开发环境MounRiver——Studio,其他环境需自行卸载驱动再重装驱动,建议使用该方法和官方集成开发环境)</div>
<div></div>
<div>成功后官方IDE应该可以正常显示如下界面</div>
<div></div>
<div>四 例程测试</div>
<div>由于个人六级考试,及之前环境出问题,搞开发环境,调试器和写文档心态受了点影响,故觉得首周测评小水一下,跑下官方例程</div>
<div>/********************************** (C) COPYRIGHT *******************************</div>
<div>* File Name : main.c</div>
<div>* Author : WCH</div>
<div>* Version : V1.0.0</div>
<div>* Date : 2021/06/06</div>
<div>* Description : Main program body.</div>
<div>*********************************************************************************</div>
<div>* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.</div>
<div>* Attention: This software (modified or not) and binary are used for</div>
<div>* microcontroller manufactured by Nanjing Qinheng Microelectronics.</div>
<div>*******************************************************************************/</div>
<div><strong>#include</strong> "ch32v20x.h"</div>
<div><strong>#include</strong> <rtthread.h></div>
<div><strong>#include</strong> <rthw.h></div>
<div><strong>#include</strong> "drivers/pin.h"</div>
<div>/* Global typedef */</div>
<div>/* Global define */</div>
<div>/* LED0 is driven by the pin driver interface of rt */</div>
<div><strong>#define</strong> LED0_PIN 11 //PA1</div>
<div>/* Global Variable */</div>
<div>/*********************************************************************</div>
<div>* @fn LED1_BLINK_INIT</div>
<div>*</div>
<div>* <a href="home.php?mod=space&uid=159083" target="_blank">@brief </a> LED1 directly calls the underlying driver</div>
<div>*</div>
<div>* <a href="home.php?mod=space&uid=784970" target="_blank">@return </a> none</div>
<div>*/</div>
<div><strong>void</strong> <strong>LED1_BLINK_INIT</strong>(<strong>void</strong>)</div>
<div>{</div>
<div>GPIO_InitTypeDef GPIO_InitStructure={0};</div>
<div>RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, <em>ENABLE</em>);</div>
<div>GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;</div>
<div>GPIO_InitStructure.GPIO_Speed = <em>GPIO_Speed_50MHz</em>;</div>
<div>GPIO_InitStructure.GPIO_Mode = <em>GPIO_Mode_Out_PP</em>;</div>
<div>GPIO_Init(GPIOA, &GPIO_InitStructure);</div>
<div>}</div>
<div>/* main is just one of the threads, in addition to tshell,idle</div>
<div>* main is just an LED blinking, the main thread is registered in rtthread_startup,</div>
<div>* tshell uses the serial port to receive interrupts, and the interrupt stack and thread stack are</div>
<div>* used separately.Note that when entering an interrupt, the 16caller register needs to be pushed</div>
<div>* into the thread stack</div>
<div>*/</div>
<div><strong>int</strong> <strong>main</strong>(<strong>void</strong>)</div>
<div>{</div>
<div>SystemCoreClockUpdate();</div>
<div>rt_kprintf("\r\n MCU: CH32V20x\r\n");</div>
<div>rt_kprintf(" SysClk: %dHz\r\n",SystemCoreClock);</div>
<div>rt_kprintf( "ChipID:%08x\r\n", DBGMCU_GetCHIPID() );</div>
<div>rt_kprintf(" <a href="http://www.wch.cn" target="_blank">www.wch.cn</a>\r\n");</div>
<div>LED1_BLINK_INIT();</div>
<div>GPIO_ResetBits(GPIOA,GPIO_Pin_0);</div>
<div><strong>while</strong>(1)</div>
<div>{</div>
<div>GPIO_SetBits(GPIOA,GPIO_Pin_0);</div>
<div>rt_thread_mdelay(500);</div>
<div>GPIO_ResetBits(GPIOA,GPIO_Pin_0);</div>
<div>rt_thread_mdelay(500);</div>
<div>}</div>
<div>}</div>
<div>/* Test using the driver interface to operate the I/O port */</div>
<div><strong>int</strong> <strong>led</strong>(<strong>void</strong>)</div>
<div>{</div>
<div>rt_uint8_t count;</div>
<div>rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);</div>
<div><strong>printf</strong>("led_SP:%08x\r\n",__get_SP());</div>
<div><strong>for</strong>(count = 0 ; count < 10 ;count++)</div>
<div>{</div>
<div>rt_pin_write(LED0_PIN, PIN_LOW);</div>
<div>rt_kprintf("led on, count : %d\r\n", count);</div>
<div>rt_thread_mdelay(500);</div>
<div>rt_pin_write(LED0_PIN, PIN_HIGH);</div>
<div>rt_kprintf("led off\r\n");</div>
<div>rt_thread_mdelay(500);</div>
<div>}</div>
<div><strong>return</strong> 0;</div>
<div>}</div>
<div>MSH_CMD_EXPORT(led, led sample by using I/O drivers);</div>
<div></div>
<div>不过测试过程中发现,PA1无反应,反而PA0可以点灯,原因后续再深究</div>
<div>五 后续计划</div>
<div>深究一下为何实际运行情况与官方例程注释不符(毕竟是多版本兼容例程,有点小问题正常</div>
<div>2:做网关,搜集下位机或其他传感器传来的信息,考虑采用选通方式,也会尝试直接使用,看能否正常处理,是否为真4路USART</div>
<div>3,测速(目前设备受限,在学校暂无网线可用,该计划后续再补)</div>
<div>4. 连接上位机做协调器,该步骤完成步骤2后再实验,详细计划后续会实时更新</div>
<div>下面是祖传点灯的视频,请欣赏!</div>
<div>5e1a3dbb75d347e43391c10f1ee33ec3<br />
</div>
</div><script> var loginstr = '<div class="locked">查看本帖全部内容,请<a href="javascript:;" style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
if(parseInt(discuz_uid)==0){
(function($){
var postHeight = getTextHeight(400);
$(".showpostmsg").html($(".showpostmsg").html());
$(".showpostmsg").after(loginstr);
$(".showpostmsg").css({height:postHeight,overflow:"hidden"});
})(jQuery);
} </script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script> <p>印象中网口只能跑10M</p>
walker2048 发表于 2024-6-14 19:48
印象中网口只能跑10M
<p>是的,官方给的数据就是10m,这个对于现代计算机设备来说不能算是慢速,只能说是一般,毕竟现在百兆,千兆口都很常见了,不过对于这种,网关设备来说,还是很不错的。毕竟基本不会用来对高网络要求的设备组网,对于嵌入式相关传感器,等,之类的信息,10m可以说是真高速的,吹一手高速网口也不为过,而且10m速率就是真拿来做家庭网关中继器也是可以凑合用的,毕竟刷下视频,玩下手机,也要不了多高的速率,换算一下,一秒1.15M的网速,基本上大多数场景也能用(不过考虑双向,还要再除以二),不过几百k的速率看视频也基本流畅的。</p><br/> <p>大佬的分享计划非常丰富呀,在线学习中。</p>
lugl4313820 发表于 2024-6-15 06:18
大佬的分享计划非常丰富呀,在线学习中。
<p>嗨,能不能肝完还是个问题呢,尽力吧</p>
<p>不知道CH32V208能否支持移植Rt thead+lwip, 能省一点存储就省一点, <img height="52" src="https://bbs.eeworld.com.cn/static/editor/plugins/hkemoji/sticker/facebook/pleased.gif" width="48" /></p>
页:
[1]