Merge branch 'master' of http://ikuai.hua-hua.cn:3000/huahua/K86
This commit is contained in:
commit
d7bc018b23
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project ver="10" name="RP-77B_CAN_Bootloader" libEmbed="true" icon="..." ui="win" output="RP-77B_CAN_Bootloader.exe" CompanyName="单位名称" FileDescription="CAN_Bootloader" LegalCopyright="Copyright (C) 作者 2022" ProductName="CAN_Bootloader" InternalName="CAN_Bootloader" FileVersion="0.0.0.10" ProductVersion="0.0.0.10" publishDir="/dist/" dstrip="false" local="false" ignored="false">
|
||||
<project ver="10" name="RP-77B_CAN_Bootloader" libEmbed="true" icon="..." ui="win" output="RP-77B_CAN_Bootloader.exe" CompanyName="单位名称" FileDescription="CAN_Bootloader" LegalCopyright="Copyright (C) 作者 2022" ProductName="CAN_Bootloader" InternalName="CAN_Bootloader" FileVersion="0.0.0.11" ProductVersion="0.0.0.11" publishDir="/dist/" dstrip="false" local="false" ignored="false">
|
||||
<file name="main.aardio" path="main.aardio" comment="main.aardio"/>
|
||||
<folder name="资源文件" path="res" embed="true" local="false" ignored="false"/>
|
||||
<folder name="窗体文件" path="dlg" comment="目录" embed="true" local="false" ignored="false">
|
||||
|
@ -3,9 +3,10 @@ import win.ui;
|
||||
mainForm = win.form(text="CAN_Bootloader";right=599;bottom=465;border="dialog frame";max=false)
|
||||
mainForm.add(
|
||||
btnConnect={cls="button";text="连接";left=204;top=64;right=289;bottom=90;z=4};
|
||||
btnExport={cls="button";text="转换烧录文件";left=35;top=294;right=134;bottom=323;z=26};
|
||||
btnFlash={cls="button";text="开始刷写";left=36;top=329;right=135;bottom=357;z=9};
|
||||
btnFresh={cls="button";text="刷新";left=204;top=28;right=288;bottom=54;z=2};
|
||||
btnOpen={cls="button";text="打开文件";left=36;top=296;right=135;bottom=324;z=8};
|
||||
btnOpen={cls="button";text="打开文件";left=182;top=193;right=281;bottom=221;z=8};
|
||||
btnOpenFlashdrv={cls="button";text="进入BOOT";left=148;top=296;right=247;bottom=324;z=22};
|
||||
btnReadF180={cls="button";text="读取boot版本";left=36;top=429;right=135;bottom=457;z=19};
|
||||
btnReadF186={cls="button";text="读取当前会话";left=36;top=363;right=135;bottom=391;z=13};
|
||||
@ -16,17 +17,17 @@ btnReadSw={cls="button";text="读取软件版本号";left=36;top=396;right=135;b
|
||||
btnTest={cls="button";text="停止";left=148;top=330;right=247;bottom=358;z=11};
|
||||
cbbChannel={cls="combobox";left=58;top=64;right=191;bottom=90;edge=1;items={};mode="dropdown";z=3};
|
||||
cbbDev={cls="combobox";left=58;top=27;right=191;bottom=53;edge=1;items={};mode="dropdown";z=1};
|
||||
checkbox={cls="checkbox";text="CANFD设备";left=151;top=101;right=248;bottom=120;z=21};
|
||||
checkbox={cls="checkbox";text="CANFD设备";left=151;top=101;right=248;bottom=120;checked=1;z=21};
|
||||
edFile={cls="richedit";left=8;top=131;right=288;bottom=187;border=1;disabled=1;edge=1;multiline=1;wrap=1;z=14};
|
||||
edit={cls="edit";left=294;top=19;right=596;bottom=401;autovscroll=false;edge=1;multiline=1;vscroll=1;z=5};
|
||||
progress={cls="progress";left=296;top=436;right=596;bottom=464;edge=1;max=100;min=0;z=15};
|
||||
radiobutton={cls="radiobutton";text="左侧";left=45;top=268;right=121;bottom=288;checked=1;group=1;z=24};
|
||||
radiobutton2={cls="radiobutton";text="右侧";left=163;top=268;right=242;bottom=287;z=25};
|
||||
radiobutton={cls="radiobutton";text="左侧";left=45;top=268;right=121;bottom=288;checked=1;group=1;hide=1;z=24};
|
||||
radiobutton2={cls="radiobutton";text="右侧";left=163;top=268;right=242;bottom=287;hide=1;z=25};
|
||||
static={cls="static";text="设备";left=1;top=28;right=61;bottom=52;align="center";center=1;transparent=1;z=6};
|
||||
static2={cls="static";text="通道";left=1;top=66;right=61;bottom=90;align="center";center=1;transparent=1;z=7};
|
||||
static3={cls="static";text="刷写进度";left=296;top=409;right=349;bottom=429;transparent=1;z=16};
|
||||
static4={cls="static";text="烧录APP";left=13;top=108;right=85;bottom=132;center=1;transparent=1;z=17};
|
||||
static5={cls="static";text="V0.2_20241219";left=451;top=1;right=595;bottom=17;align="right";center=1;transparent=1;z=18}
|
||||
static5={cls="static";text="V0.1_20250206";left=451;top=1;right=595;bottom=17;align="right";center=1;transparent=1;z=18}
|
||||
)
|
||||
/*}}*/
|
||||
|
||||
@ -257,6 +258,10 @@ mainForm.radiobutton2.oncommand = function(id,event){
|
||||
::PostThreadMessage(thrdId,121,0x732,0x7b2)//自定义消息-修改ID
|
||||
}
|
||||
|
||||
mainForm.btnExport.oncommand = function(id,event){
|
||||
::PostThreadMessage(thrdId,106,0,0)//自定义消息-修改ID
|
||||
}
|
||||
|
||||
mainForm.show();
|
||||
::PostThreadMessage(thrdId,121,0x731,0x7b1)//自定义消息-修改ID
|
||||
return win.loopMessage();
|
@ -55,6 +55,9 @@ FuncLoopMsg = function(msg){
|
||||
case 105 {//停止boot
|
||||
thread.stop(0);
|
||||
}
|
||||
case 106 {//导出
|
||||
exportbootflag();
|
||||
}
|
||||
case 110 {//readDID
|
||||
FuncReadDID(msg.wParam);
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ var Crc32Tble =
|
||||
var fileinfo = "";
|
||||
var FlashData = {};
|
||||
var AllData = {}
|
||||
var BootData = {};
|
||||
var S19path = null;
|
||||
FuncGetAllData = function(id){
|
||||
if(id > #AllData){
|
||||
return null;
|
||||
@ -76,6 +78,7 @@ FuncOpenS19File = function(id,path){
|
||||
|
||||
if(io.exist( path )){
|
||||
//winform.editPath.text = path;
|
||||
S19path = path;
|
||||
var readbuf = string.load(path);
|
||||
|
||||
readbuf = string.split(readbuf,'\r\n');
|
||||
@ -178,6 +181,11 @@ FuncOpenS19File = function(id,path){
|
||||
s19crc.data[0x7FF] = crc32temp>>16;
|
||||
s19crc.data[0x7FE] = crc32temp>>8;
|
||||
s19crc.data[0x7FD] = crc32temp&0XFF;
|
||||
|
||||
for(i=1;8;1){
|
||||
BootData[i] = s19crc.data[0x7F8 + i];
|
||||
}
|
||||
|
||||
}
|
||||
if(block != null){
|
||||
table.push(FlashData,block)
|
||||
@ -194,6 +202,26 @@ FuncOpenS19File = function(id,path){
|
||||
return path;
|
||||
}
|
||||
|
||||
exportbootflag = function(){
|
||||
if(io.exist( S19path )){
|
||||
var newpath = S19path++".fix";
|
||||
fsys.copy(S19path,newpath,,,);
|
||||
var str = "S20C037FF8"
|
||||
var checksum=0x0C+0x03+0x7f+0xf8;
|
||||
for(i=1;8;1){
|
||||
var num = BootData[i] & 0xff
|
||||
var tempstr = string.format("%02X",num);
|
||||
//console.log(tempstr);
|
||||
str = str++tempstr;
|
||||
checksum+=BootData[i];
|
||||
}
|
||||
checksum = 0xff - (checksum&0xff);
|
||||
str = str++string.format("%02X",checksum);;
|
||||
FuncDisplay(str);
|
||||
string.save(newpath,str,true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
2767
cva_asw_m0118/OUTPUT/app_sw0101.srec
Normal file
2767
cva_asw_m0118/OUTPUT/app_sw0101.srec
Normal file
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
|
||||
|
||||
@echo on
|
||||
|
||||
"D:\software\IAR\common\bin\cspybat" -f "E:\work\wk\K86\CVM0118BOOT\cva_asw_m0118\settings\cva_asw_m0118.Debug.general.xcl" --backend -f "E:\work\wk\K86\CVM0118BOOT\cva_asw_m0118\settings\cva_asw_m0118.Debug.driver.xcl"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\temp\K86\CODE\cva_asw_m0118\settings\cva_asw_m0118.Debug.general.xcl" --backend -f "F:\FCB_project\temp\K86\CODE\cva_asw_m0118\settings\cva_asw_m0118.Debug.driver.xcl"
|
||||
|
||||
@echo off
|
||||
goto end
|
||||
@ -34,7 +34,7 @@ goto end
|
||||
|
||||
@echo on
|
||||
|
||||
"D:\software\IAR\common\bin\cspybat" -f "E:\work\wk\K86\CVM0118BOOT\cva_asw_m0118\settings\cva_asw_m0118.Debug.general.xcl" "--debug_file=%~1" --backend -f "E:\work\wk\K86\CVM0118BOOT\cva_asw_m0118\settings\cva_asw_m0118.Debug.driver.xcl"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\temp\K86\CODE\cva_asw_m0118\settings\cva_asw_m0118.Debug.general.xcl" "--debug_file=%~1" --backend -f "F:\FCB_project\temp\K86\CODE\cva_asw_m0118\settings\cva_asw_m0118.Debug.driver.xcl"
|
||||
|
||||
@echo off
|
||||
:end
|
@ -23,9 +23,9 @@
|
||||
|
||||
if ($debugfile -eq "")
|
||||
{
|
||||
& "D:\software\IAR\common\bin\cspybat" -f "E:\work\wk\K86\CVM0118BOOT\cva_asw_m0118\settings\cva_asw_m0118.Debug.general.xcl" --backend -f "E:\work\wk\K86\CVM0118BOOT\cva_asw_m0118\settings\cva_asw_m0118.Debug.driver.xcl"
|
||||
& "E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\temp\K86\CODE\cva_asw_m0118\settings\cva_asw_m0118.Debug.general.xcl" --backend -f "F:\FCB_project\temp\K86\CODE\cva_asw_m0118\settings\cva_asw_m0118.Debug.driver.xcl"
|
||||
}
|
||||
else
|
||||
{
|
||||
& "D:\software\IAR\common\bin\cspybat" -f "E:\work\wk\K86\CVM0118BOOT\cva_asw_m0118\settings\cva_asw_m0118.Debug.general.xcl" --debug_file=$debugfile --backend -f "E:\work\wk\K86\CVM0118BOOT\cva_asw_m0118\settings\cva_asw_m0118.Debug.driver.xcl"
|
||||
& "E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\temp\K86\CODE\cva_asw_m0118\settings\cva_asw_m0118.Debug.general.xcl" --debug_file=$debugfile --backend -f "F:\FCB_project\temp\K86\CODE\cva_asw_m0118\settings\cva_asw_m0118.Debug.driver.xcl"
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
"-p"
|
||||
|
||||
"D:\software\IAR\arm\config\debugger\CVAChip\CVM0118.ddf"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0118.ddf"
|
||||
|
||||
"--semihosting"
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
"D:\software\IAR\arm\bin\armPROC.dll"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armPROC.dll"
|
||||
|
||||
"D:\software\IAR\arm\bin\armJLINK.dll"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armJLINK.dll"
|
||||
|
||||
"E:\work\wk\K86\CVM0118BOOT\cva_asw_m0118\Debug_FLASH\Exe\cva_asw_m0118.out"
|
||||
"F:\FCB_project\temp\K86\CODE\cva_asw_m0118\Debug_FLASH\Exe\cva_asw_m0118.out"
|
||||
|
||||
--plugin="D:\software\IAR\arm\bin\armbat.dll"
|
||||
--plugin="E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armbat.dll"
|
||||
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
</Stack>
|
||||
<PlDriver>
|
||||
<FirstRun>0</FirstRun>
|
||||
<MemConfigValue>D:\software\IAR\arm\config\debugger\CVAChip\CVM0118.ddf</MemConfigValue>
|
||||
<MemConfigValue>E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0118.ddf</MemConfigValue>
|
||||
</PlDriver>
|
||||
<ArmDriver>
|
||||
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
|
||||
|
File diff suppressed because one or more lines are too long
@ -110,7 +110,9 @@ void appTask(void)
|
||||
CANMsgTask();
|
||||
if (gSystick1msCnt % 5 == 0)
|
||||
{
|
||||
|
||||
AD_Task();
|
||||
/* Refresh wdg */
|
||||
WdgDrv_Refresh(&mcu.wdgDrv);
|
||||
}
|
||||
if (gSystick1msCnt % 50 == 0)
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "appTask.h"
|
||||
#include "can_message.h"
|
||||
#include "key.h"
|
||||
#include "hwctrl.h"
|
||||
/*******************************************************************************
|
||||
* the defines
|
||||
******************************************************************************/
|
||||
@ -248,7 +249,11 @@ void TxTestMsg(uint8_t *pdata)
|
||||
|
||||
void TxK86Msg(uint8_t *pdata)
|
||||
{
|
||||
FlexCanBoot_TxMessage(APP_TX_TEST1_MSG_ID, pdata, 8);
|
||||
if (getPowerMode() == 0)
|
||||
{
|
||||
FlexCanBoot_TxMessage(APP_TX_TEST1_MSG_ID, pdata, 8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FillK86Msg(uint8_t *pdata)
|
||||
@ -267,7 +272,7 @@ void FillK86Msg(uint8_t *pdata)
|
||||
uint8_t K86MsgBuf[8] = {0};
|
||||
void CANMsgTask(void)//1ms task
|
||||
{
|
||||
static uint16_t msg_counter=0;
|
||||
static uint16_t msg_counter=0,test_conter=0;
|
||||
FlexCan_FrameStructureType rxMsg;
|
||||
FillK86Msg(K86MsgBuf);
|
||||
if ((K86MsgBuf[0] & 0x3F) != 0)
|
||||
@ -286,8 +291,21 @@ void CANMsgTask(void)//1ms task
|
||||
{
|
||||
TxK86Msg(K86MsgBuf);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
test_conter++;
|
||||
if (test_conter >= 500)
|
||||
{
|
||||
test_conter = 0;
|
||||
uint16_t temp = getBatVoltage();
|
||||
uint8_t buf[8] = {0};
|
||||
buf[0] = (temp >> 8) & 0xFF;
|
||||
buf[1] = temp & 0xFF;
|
||||
temp = getACCVoltage();
|
||||
buf[2] = (temp >> 8) & 0xFF;
|
||||
buf[3] = temp & 0xFF;
|
||||
TxTestMsg(buf);
|
||||
}
|
||||
*/
|
||||
|
||||
if (msg_counter >= 1000)
|
||||
{
|
||||
|
@ -19,11 +19,17 @@
|
||||
******************************************************************************/
|
||||
extern McuType mcu;
|
||||
uint32_t gCpuClockFrequency = 0;
|
||||
|
||||
uint32_t adcResult[8];
|
||||
uint8_t PowerMode = 0;
|
||||
/*******************************************************************************
|
||||
* the const
|
||||
******************************************************************************/
|
||||
|
||||
/*! \brief The trgmux in out mappings table for trgmux configure
|
||||
*/
|
||||
const TrgMuxDrv_InOutMappingType c_trgmuxInOutMappings[] = {
|
||||
{TRGMUXDRV_TRIGSOURCE_SIM_SW_TRIG, TRGMUXDRV_TARGETMODULE_PDB0_TRG_IN, false}, /* Use SIM_SW_TRIG trigger PDB0 */
|
||||
};
|
||||
const uint16_t c_numOfTrgmuxInOutMappings = sizeof(c_trgmuxInOutMappings) / sizeof(TrgMuxDrv_InOutMappingType);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -31,7 +37,9 @@
|
||||
******************************************************************************/
|
||||
static void hw_clock_init(void);
|
||||
static void GPIO_init(void);
|
||||
static void AD_Init(void);
|
||||
|
||||
static void Watchdog_Init(void);
|
||||
|
||||
|
||||
void hw_init(void)
|
||||
@ -48,7 +56,12 @@ void hw_init(void)
|
||||
/* get CAN controller default configuration */
|
||||
FlexCanBoot_Init();
|
||||
|
||||
AD_Init();
|
||||
|
||||
GPIO_init();
|
||||
|
||||
WdgDrv_Refresh(&mcu.wdgDrv);
|
||||
Watchdog_Init();
|
||||
}
|
||||
|
||||
static void hw_clock_init(void)
|
||||
@ -71,6 +84,16 @@ static void hw_clock_init(void)
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTD, &clockConfig);
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTE, &clockConfig);
|
||||
|
||||
/* Enable the clock for ADC */
|
||||
clockConfig.gating = true;
|
||||
clockConfig.source = CLOCKDRV_PLL;
|
||||
clockConfig.div = 4;
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_ADC, &clockConfig);
|
||||
|
||||
/* Enable the clock for PDB0 */
|
||||
clockConfig.gating = true;
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PDB, &clockConfig);
|
||||
|
||||
|
||||
/* Set system tick clock, 1ms event */
|
||||
ClockDrv_GetFreq(&mcu.clockDrv, CLOCKDRV_SYS, &gCpuClockFrequency);
|
||||
@ -132,3 +155,152 @@ uint8_t getKeyIO(KEYID_t keyid)
|
||||
}
|
||||
}
|
||||
|
||||
static void AD_Init(void)
|
||||
{
|
||||
/* TRGMUX */
|
||||
TrgMuxDrv_ConfigType trgmuxConfig;
|
||||
trgmuxConfig.numOfInOutMappings = c_numOfTrgmuxInOutMappings;
|
||||
trgmuxConfig.inOutMapping = c_trgmuxInOutMappings;
|
||||
TrgMuxDrv_Configure(&mcu.trgMuxDrv, &trgmuxConfig);
|
||||
/* Configure ADC module */
|
||||
AdcDrv_ConfigType adcCfg;
|
||||
AdcDrv_GetDefaultConfig(&adcCfg);
|
||||
adcCfg.conversionMode = ADCDRV_CONVERSION_12BIT; /* Selects the ADC resolution to 12-bit conversion */
|
||||
adcCfg.avgEnable = true; /* Enable hardware average function */
|
||||
adcCfg.avgSamplesSel = ADCDRV_AVERAGE_32; /* Select 32 samples average */
|
||||
adcCfg.continuousMode = ADCDRV_ONESHOT; /* Select one-shot mode */
|
||||
adcCfg.chnCfg[0].chnSel = ADCDRV_INCHN_EXT10;
|
||||
adcCfg.chnCfg[1].chnSel = ADCDRV_INCHN_EXT11;
|
||||
|
||||
AdcDrv_Configure(&mcu.adcDrv, &adcCfg);
|
||||
|
||||
uint32_t pdbFreq;
|
||||
ClockDrv_GetFreq(&mcu.clockDrv, CLOCKDRV_PDB, &pdbFreq);
|
||||
|
||||
PdbDrv_ConfigType pdbCfg;
|
||||
PdbDrv_GetDefaultConfig(&pdbCfg);
|
||||
pdbCfg.ldmode = PDBDRV_LDMOD_LOAD_VAL_IMMEDIATELY; /* The internal registers are loaded with the values from their buffers, immediately after 1 is written to LDOK */
|
||||
pdbCfg.trgInSel = PDBDRV_TRGSEL_TRGGER_IN_0; /* Use hardware trigger source */
|
||||
pdbCfg.cMode = PDBDRV_CONT_CONTINUOUS; /* PDB operation in Continuous mode */
|
||||
pdbCfg.prescalerFactor = PDBDRV_PRESCALER_128MULT; /* Counting uses the peripheral clock divided by MULT (the multiplication factor) */
|
||||
pdbCfg.mult = PDBDRV_MULT_FACTOR_40; /* Multiplication factor is 40 */
|
||||
pdbCfg.preTrgCfg.mode[0][0] = PDBDRV_PRETRG_DELAY_MODE; /* The first channel start with delay operation */
|
||||
pdbCfg.preTrgCfg.mode[0][1] = PDBDRV_PRETRG_BB_MODE; /* PDB channel[0][1-7] with Back-to-Back operation*/
|
||||
|
||||
pdbCfg.dlyCfg.modCnt = 1*pdbFreq / 128 / 40 / 200; /* Periodic triggering PDB in 5ms*/
|
||||
pdbCfg.dlyCfg.dlyCnt[0][0] = 0; /* first channel don't need delay time*/
|
||||
PdbDrv_Configure(&mcu.pdbDrv, &pdbCfg);
|
||||
|
||||
PdbDrv_EnablePdb(&mcu.pdbDrv); /* Enable PDB0 */
|
||||
|
||||
TrgMuxDrv_GenSWTrigger(&mcu.trgMuxDrv, 100); /* Trigger PDB0 */
|
||||
}
|
||||
|
||||
void AD_Task(void)//5ms
|
||||
{
|
||||
static uint16_t power_cnt;
|
||||
adcResult[0] = AdcDrv_GetRn(&mcu.adcDrv, 0);
|
||||
adcResult[1] = AdcDrv_GetRn(&mcu.adcDrv, 1);
|
||||
uint16_t batvol = getBatVoltage();
|
||||
switch (PowerMode)
|
||||
{
|
||||
case 0:
|
||||
if (batvol > 16500)
|
||||
{
|
||||
power_cnt++;
|
||||
if(power_cnt > 800)
|
||||
{
|
||||
power_cnt = 0;
|
||||
PowerMode = 1;
|
||||
}
|
||||
}
|
||||
else if (batvol < 8500)
|
||||
{
|
||||
power_cnt++;
|
||||
if(power_cnt > 800)
|
||||
{
|
||||
power_cnt = 0;
|
||||
PowerMode = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
power_cnt = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (batvol < 16000)
|
||||
{
|
||||
power_cnt++;
|
||||
if(power_cnt > 800)
|
||||
{
|
||||
power_cnt = 0;
|
||||
PowerMode = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
power_cnt = 0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (batvol > 9000)
|
||||
{
|
||||
power_cnt++;
|
||||
if(power_cnt > 800)
|
||||
{
|
||||
power_cnt = 0;
|
||||
PowerMode = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
power_cnt = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t getBatVoltage(void)
|
||||
{
|
||||
uint32_t temp;
|
||||
temp = adcResult[0];
|
||||
temp *= 55000;
|
||||
temp >>= 12;
|
||||
temp += 700;
|
||||
return temp;
|
||||
}
|
||||
|
||||
uint16_t getACCVoltage(void)
|
||||
{
|
||||
uint32_t temp;
|
||||
temp = adcResult[1];
|
||||
temp *= 55000;
|
||||
temp >>= 12;
|
||||
temp += 700;
|
||||
return temp;
|
||||
}
|
||||
|
||||
uint8_t getPowerMode(void)
|
||||
{
|
||||
return PowerMode;
|
||||
}
|
||||
|
||||
static void Watchdog_Init(void)
|
||||
{
|
||||
/* Initialize WDG drivers */
|
||||
WdgDrv_ConfigureType wdgConfigParams;
|
||||
WdgDrv_GetDefaultConfig(&wdgConfigParams);
|
||||
wdgConfigParams.clkSource = WDGDRV_CLK_SRC_LPO128K;
|
||||
wdgConfigParams.winEnable = false;
|
||||
wdgConfigParams.prescalerEnable = false;
|
||||
wdgConfigParams.enable = true;
|
||||
wdgConfigParams.intEnable = false;
|
||||
wdgConfigParams.updateEnable = true;
|
||||
wdgConfigParams.stopModeEnable = false;
|
||||
wdgConfigParams.timeoutValue = 12800;//100ms
|
||||
wdgConfigParams.windowValue = 1000;
|
||||
WdgDrv_Configure(&mcu.wdgDrv, &wdgConfigParams);
|
||||
}
|
@ -27,7 +27,10 @@
|
||||
******************************************************************************/
|
||||
void hw_init(void);
|
||||
uint8_t getKeyIO(KEYID_t keyid);
|
||||
|
||||
void AD_Task(void);
|
||||
uint16_t getBatVoltage(void);
|
||||
uint16_t getACCVoltage(void);
|
||||
uint8_t getPowerMode(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
|
||||
|
||||
@echo on
|
||||
|
||||
"D:\software\IAR\common\bin\cspybat" -f "E:\work\wk\K86\CVM0118BOOT\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.general.xcl" --backend -f "E:\work\wk\K86\CVM0118BOOT\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.driver.xcl"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\temp\K86\CODE\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.general.xcl" --backend -f "F:\FCB_project\temp\K86\CODE\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.driver.xcl"
|
||||
|
||||
@echo off
|
||||
goto end
|
||||
@ -34,7 +34,7 @@ goto end
|
||||
|
||||
@echo on
|
||||
|
||||
"D:\software\IAR\common\bin\cspybat" -f "E:\work\wk\K86\CVM0118BOOT\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.general.xcl" "--debug_file=%~1" --backend -f "E:\work\wk\K86\CVM0118BOOT\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.driver.xcl"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\temp\K86\CODE\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.general.xcl" "--debug_file=%~1" --backend -f "F:\FCB_project\temp\K86\CODE\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.driver.xcl"
|
||||
|
||||
@echo off
|
||||
:end
|
@ -23,9 +23,9 @@
|
||||
|
||||
if ($debugfile -eq "")
|
||||
{
|
||||
& "D:\software\IAR\common\bin\cspybat" -f "E:\work\wk\K86\CVM0118BOOT\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.general.xcl" --backend -f "E:\work\wk\K86\CVM0118BOOT\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.driver.xcl"
|
||||
& "E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\temp\K86\CODE\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.general.xcl" --backend -f "F:\FCB_project\temp\K86\CODE\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.driver.xcl"
|
||||
}
|
||||
else
|
||||
{
|
||||
& "D:\software\IAR\common\bin\cspybat" -f "E:\work\wk\K86\CVM0118BOOT\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.general.xcl" --debug_file=$debugfile --backend -f "E:\work\wk\K86\CVM0118BOOT\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.driver.xcl"
|
||||
& "E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\temp\K86\CODE\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.general.xcl" --debug_file=$debugfile --backend -f "F:\FCB_project\temp\K86\CODE\cva_bootloader_m0118\settings\cva_bootloader_m0118.Debug.driver.xcl"
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
"-p"
|
||||
|
||||
"D:\software\IAR\arm\config\debugger\CVAChip\CVM0118.ddf"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0118.ddf"
|
||||
|
||||
"--semihosting"
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
"D:\software\IAR\arm\bin\armPROC.dll"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armPROC.dll"
|
||||
|
||||
"D:\software\IAR\arm\bin\armJLINK.dll"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armJLINK.dll"
|
||||
|
||||
"E:\work\wk\K86\CVM0118BOOT\cva_bootloader_m0118\Debug_FLASH\Exe\bootloader_m118.out"
|
||||
"F:\FCB_project\temp\K86\CODE\cva_bootloader_m0118\Debug_FLASH\Exe\bootloader_m118.out"
|
||||
|
||||
--plugin="D:\software\IAR\arm\bin\armbat.dll"
|
||||
--plugin="E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armbat.dll"
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -13,14 +13,14 @@
|
||||
</Stack>
|
||||
<PlDriver>
|
||||
<FirstRun>0</FirstRun>
|
||||
<MemConfigValue>D:\software\IAR\arm\config\debugger\CVAChip\CVM0118.ddf</MemConfigValue>
|
||||
<MemConfigValue>E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0118.ddf</MemConfigValue>
|
||||
</PlDriver>
|
||||
<ArmDriver>
|
||||
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
|
||||
<EnableCache>0</EnableCache>
|
||||
</ArmDriver>
|
||||
<DebugChecksum>
|
||||
<Checksum>2065733558</Checksum>
|
||||
<Checksum>643595526</Checksum>
|
||||
</DebugChecksum>
|
||||
<Disassembly>
|
||||
<MixedMode>1</MixedMode>
|
||||
@ -63,16 +63,16 @@
|
||||
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
|
||||
<CStepIntDis>_ 0</CStepIntDis>
|
||||
</StLinkDriver>
|
||||
<Trace2>
|
||||
<Enabled>0</Enabled>
|
||||
<ShowSource>0</ShowSource>
|
||||
</Trace2>
|
||||
<DriverProfiling>
|
||||
<Enabled>0</Enabled>
|
||||
<Mode>1</Mode>
|
||||
<Graph>0</Graph>
|
||||
<Symbiont>0</Symbiont>
|
||||
</DriverProfiling>
|
||||
<Trace2>
|
||||
<Enabled>0</Enabled>
|
||||
<ShowSource>0</ShowSource>
|
||||
</Trace2>
|
||||
<TermIOLog>
|
||||
<LoggingEnabled>_ 0</LoggingEnabled>
|
||||
<LogFile>_ ""</LogFile>
|
||||
@ -81,8 +81,7 @@
|
||||
<mode>0</mode>
|
||||
</DisassembleMode>
|
||||
<Breakpoints2>
|
||||
<Bp0>_ 0 "EMUL_CODE" "{$PROJ_DIR$\src\bootloader\bootloader.c}.872.25" 0 0 1 "" 0 "" 0</Bp0>
|
||||
<Count>1</Count>
|
||||
<Count>0</Count>
|
||||
</Breakpoints2>
|
||||
<Aliases>
|
||||
<Count>0</Count>
|
||||
|
File diff suppressed because one or more lines are too long
7170
release/sw0101/K86_sw0101.srec
Normal file
7170
release/sw0101/K86_sw0101.srec
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user