内容提要
引言
云途配置工具(yct - yuntu config tool)自去年q4推出以来,已经有不少云途车规mcu的客户在实际项目使用了。它简明快捷高效的sdk和mcal配置界面以及强大的工具链整合能力大大提高了用户汽车电子ecu应用代码的开发效率,深受好评。
tips:关于云途yct工具的功能特性(features)、下载安装和使用请参考以下公众号文章(点击文章标题即可直接跳转阅读):
《云途配置工具(yct)快速上手指南(qsg)》
随着云途车规mcu型号的日益增加(cover越来越多汽车电子应用),云途sdk和mcal也在不断升级,作为配套的图形化配置工具yct也进行了若干次升级,在修改已知bug的同时也新增了不少新功能。
最近,云途车规mcu的非autsoar架构驱动软件包 - ytm32 sdk进行了一次比较大的升级,强烈推荐大家将之前使用的sdk升级到最新的rtm v1.1.1版本,以快速修改已知云途车规mcu外设底层驱动代码的bug及硬件勘误表(errata)的workaroud,以下为ytm32 sdk rtm v1.1.1版本的release note的下载链接,供大家参考:
为了方便大家进行sdk的快速升级替换,特撰写本文介绍升级yct创建的云途sdk配置工程的详细步骤和方法。
确认当前应用工程的yct配置工程使用的sdk/mcal版本
打开应用工程根目录下的yct工程,在yct的顶行home菜单旁边即为当前yct工程使用的sdk或者mcal的版本信息。
mcal的yct配置工程:
sdk的yct配置工程:
确认要升级目标版本的sdk/mcal软件包已经安装好
通过yct主页界面的sdk/mcal升级界面确实确认要升级目标版本的sdk/mcal软件包已经安装好,比如本文想要将上面的md14的v0.8.1版本sdk的应用工程升级到v1.1.1版本:
修改yct文件中的sdk版本信息
使用任意文本编辑器,比如notepad++或者在vscode中双击打开工程根目录下的yct文件,ctrl + f查找“sdkversion”配置:
将其从原有的“0_8_1”修改为新版本“1_1_1”,并保存:
修复yct工程中的sdk外设差异配置error
接下来,使用yct工具打开上一步骤修改后的应用工程yct文件,修改problems窗口提示的所有配置error。
本文示例工程,打开后有etmr/pwm和can两个配置报错,下面介绍具体修复方法。
4.1 修复can驱动模块的波特率配置错误
在v0.8.1版本sdk的can通信波特率配置中传输段(propagation segment)、相位段1(phase segment 1)、相位段2(phase segment 2)和时钟预分频因子(prescaler division factor)在配置时会将配置值减1写入flexcan模块的寄存器,而在新版本v1.1.1 sdk中这些配置将被直接写入flexcan模块的寄存器,因此,为了实现相同的波特率(500kbit/s)相应的配置值需要减1。
v0.8.1版本的can波特率配置在v1.1.1中为错误配置:
v1.1.1版本sdk中相应波特率(500kbit/s)的正确配置如下:
4.2 修改etmr/pwm驱动模块的配置错误
v1.1.1版本sdk相对于之前老版本的sdk驱动和配置界面做了一些bug修改,因为需要先disable etmr模块的配置,然后重新enable进行配置才能解决相关error。
首先、disable etmr驱动模块,之前的配置信息将全部丢失:
然后,重新enable etmr模块,添加common配置:
使能pwm配置,并根据原有工程的需求添加pwm通道配置:
tips:为了减少应用代码中调用sdk配置参数的修改,需要将以上etmr驱动模块的common和pwm配置的配置结构体名字和配置参数保持与原工程相同。
重新生成工程和替换sdk底层驱动
将以上配置error全部修复之后,点击保存(save),然后重新生成(generate):
点击确认覆盖(overwrite)原有工程的sdk驱动静态代码即可完成sdk驱动更新和版本升级:
tips:连续点击多个文件覆盖后,yct会提示是否覆盖所有文件,点击“ok”确认即可快速完成覆盖替换:
重新编译应用工程,修改编译错误
重新编译工程,根据编译错误和sdk releasenote中的bug list,修复/调整所有sdk api的参数,比如pwm占空比更新函数--etmr_drv_updatepwmchannel()的0.8.1与1.1.1版本sdk的差异如下:
-------------------------------------------------------------//v10.8.1 sdk:-------------------------------------------------------------/*! * @brief this function updates the waveform output in pwm mode (duty cycle and phase). * * @param [in] instance the etmr peripheral instance number. * @param [in] channel the channel number. in combined mode, the code finds the channel. * @param [in] typeofupdate the type of pwm update in the duty cycle/pulse or in ticks. * @param [in] alignmode the alignment of pwm update in the duty cycle/pulse or in ticks. * @param [in] dutycycle duty cycle of pwm. * @param [in] offset the offset from counter initial value to the first rising edge. * it is used for asymmetrical alignment pwm. when in edge align and * center align pwm mode, it is forced to 0. * @return success * - status_success : completed successfully. * - status_error : error occurred. */status_t etmr_drv_updatepwmchannel(uint32_t instance, uint8_t channel, etmr_pwm_update_option_t typeofupdate, etmr_pwm_align_mode_t alignmode, uint32_t dutycycle, uint32_t offset);-------------------------------------------------------------//v1.1.1 sdk:-------------------------------------------------------------/*! * @brief this function updates the waveform output in pwm mode (duty cycle and phase). * * @param [in] instance the etmr peripheral instance number. * @param [in] channel the channel number. in combined mode, the code finds the channel. * @param [in] dutycycle duty cycle of pwm. * @param [in] offset the offset from counter initial value to the first rising edge. * it is used for asymmetrical alignment pwm. when in edge align and * center align pwm mode, it is forced to 0. * @return success * - status_success : completed successfully. * - status_error : error occurred. */status_t etmr_drv_updatepwmchannel(uint32_t instance, uint8_t channel, uint32_t dutycycle, uint32_t offset);
在新版本sdk中,该api函数少了typeofupdate和alignmode两个参数,需要将其删除。
另外,pwm通道参数配置结构体etmr_pwm_param_t的通道配置成员名由*pwmindependentchannelconfig改为了*pwmchannelconfig,也需要做相应的调整:
-------------------------------------------------------------//v0.8.1 sdk:-------------------------------------------------------------/*! * @brief etmr driver pwm parameters * * implements : etmr_pwm_param_t_class */typedef struct{ uint8_t nnumindependentpwmchannels; /*!< number of independent pwm channels */ etmr_channel_mode_t mode; /*!< etmr pwm mode */ uint32_t ufrequencyhz; /*!< pwm period in hz */ etmr_counter_init_src_t counterinitsrc; /*!< counter initial value source */ etmr_independent_ch_param_t *pwmindependentchannelconfig; /*!< configuration for independent pwm channels */#if (0 == feature_etmr_support_chanel_deadtime) uint16_t evendeadtime; /*!< enable/disable dead time for channel 0,2,4,6 */ uint16_t odddeadtime; /*!< enable/disable dead time for channel 1,3,5,7 */#endif etmr_fault_param_t *faultconfig; /*!< configuration for pwm fault */} etmr_pwm_param_t;-------------------------------------------------------------//v1.1.1 sdk:-------------------------------------------------------------/*! * @brief etmr driver pwm parameters * * implements : etmr_pwm_param_t_class */typedef struct{ uint8_t nnumpwmchannels; /*!< number of independent pwm channels */ etmr_channel_mode_t mode; /*!< etmr pwm mode */ uint32_t ufrequencyhz; /*!< pwm period in hz */#if feature_etmr_has_cnt_init_src bool counterinitvalfrominitreg; /*!< counter initial value source from init register or not */#endif uint32_t cntval; /*!< counter initial value from cnt register */ etmr_pwm_ch_param_t *pwmchannelconfig; /*!< configuration for independent pwm channels */#if !feature_etmr_deadtime_config_each_channel etmr_deadtime_param_t *deadtimeconfig; /*!< configuration for pwm dead time */#endif etmr_fault_param_t *faultconfig; /*!typeofupdate, etmrstateptr[etmr_inst]->alignmode, (0x8000u * pwm_duty), 0x0000u);
v1.1.1版本sdk调用:
/* update the pwm output duty cycle */etmr_drv_updatepwmchannel(etmr_inst, etmr0_ch5_pwm_config.pwmchannelconfig[0].hwchannelid, (0x8000u * pwm_duty), 0x0000u);
修复所有编译error后,编译成功即完成sdk升级:
总结
本文详细介绍了基于yct的云途sdk配置工程升级方法,希望对大家有所帮助。
场效应管的介绍和用途
中国AI专利数赶超美国_跻身全球第一梯队
高压断路器有什么作用?
投影机的使用与日常维护
第六代WiFi技术的802.11ax,具备哪些功能
基于YCT的云途SDK配置工程升级方法
机器学习如何破译早已消亡的古老语言?
SIG想要挑战ZigBee技术?
工程师需要的软件工具
苹果AirPods发售!折腾这么久的背后是为何?
小度人工智能音箱成科技新伙伴
AI帮助聋哑人与世界交流 利用科技让聋哑人“感受”声音
苹果可折叠iPhone概念图曝光
新华三集团成功入围三大运营商的核心路由产品集采
未来反向无线充电技术会给我们带来什么影响
走近绿色环保电池
新唐科技N584L020芯片介绍
你该了解的单片机复位电路
4G信号明明满格,但网速却慢过蜗牛…
构建中国VR生态 HTC的布局及挑战