1、startup.s汇编文件的的中断重定向改为ifdef,通过切换app_debug和app_boot判断是否编译
2、Sx1276Type_t 结构体给定固定值 3、lora通道选择取消,通过修改频率来修改通道 4、增加了修改lora参数的函数 5、将USE_BOOTLOADER的宏定义更改到工程预编译define 6、将BootPara_t结构体定义到bsp.h文件下 7、在bsp.h文件下增加了LoraPara_r,RS485Para_t结构体并声明 8、串口带波特率参数初始化 9、增加了MAIN_DBG_LOG和DATA_DBG_LOG调试打印 10、Update.h的boot参数定义在bsp.h获取 11、当工程是app_boot时调试口为Lpuart0,当工程是app_debug时调试口为uart0 12、设备Mac从bootloader中固定地址0x00002800获取,设备类型、通讯方式、设备标志和设备序号从获取到的mac地址解析 13、debug文件增加了调试指令
This commit is contained in:
+23
-9
@@ -89,7 +89,7 @@ static void SystemRCLInit(void)
|
||||
Sysctrl_ClkSourceEnable(SysctrlClkRCL, TRUE); ///< 使能RCL时钟
|
||||
}
|
||||
|
||||
static void Uart0Init(void)
|
||||
void Uart0Init(uint32_t Baud)
|
||||
{
|
||||
stc_gpio_cfg_t stcGpioCfg;
|
||||
stc_uart_cfg_t stcCfg;
|
||||
@@ -116,7 +116,7 @@ static void Uart0Init(void)
|
||||
stcCfg.enMmdorCk = UartMskEven; ///<偶校验
|
||||
stcCfg.stcBaud.u32Pclk = Sysctrl_GetPClkFreq(); ///<PCLK获取
|
||||
stcCfg.stcBaud.enClkDiv = UartMsk8Or16Div; ///<采样分频
|
||||
stcCfg.stcBaud.u32Baud = 500000; ///<波特率
|
||||
stcCfg.stcBaud.u32Baud = Baud; ///<波特率
|
||||
stcCfg.enRunMode = UartMskMode1; ///<工作模式
|
||||
Uart_Init(M0P_UART0, &stcCfg);
|
||||
|
||||
@@ -166,7 +166,7 @@ static void Uart1Init(void)
|
||||
Uart_EnableIrq(M0P_UART1, UartRxIrq); ///<使能接收中断
|
||||
EnableNvic(UART1_3_IRQn, IrqLevel3, TRUE); ///<系统中断使能
|
||||
}
|
||||
static void LpUart0Init(void)
|
||||
void LpUart0Init(uint32_t Baud)
|
||||
{
|
||||
stc_gpio_cfg_t stcGpioCfg;
|
||||
stc_lpuart_cfg_t stcCfg;
|
||||
@@ -193,7 +193,7 @@ static void LpUart0Init(void)
|
||||
stcCfg.stcBaud.enSclkSel = LPUartMskRcl; ///<传输时钟源
|
||||
stcCfg.stcBaud.u32Sclk = 38400; ///<PCLK获取
|
||||
stcCfg.stcBaud.enSclkDiv = LPUartMsk4Or8Div; ///<采样分频
|
||||
stcCfg.stcBaud.u32Baud = 9600; ///<波特率
|
||||
stcCfg.stcBaud.u32Baud = Baud; ///<波特率
|
||||
stcCfg.enRunMode = LPUartMskMode1; ///<工作模式
|
||||
LPUart_Init(M0P_LPUART0, &stcCfg);
|
||||
|
||||
@@ -703,9 +703,22 @@ void PrintfMess(void)
|
||||
}
|
||||
void DBGUartSendByte(uint8_t sData)
|
||||
{
|
||||
#if USE_BOOTLOADER
|
||||
LPUart_SendData(M0P_LPUART0, sData);
|
||||
#else
|
||||
Uart_SendDataPoll(M0P_UART0, sData);
|
||||
#endif
|
||||
}
|
||||
void DBGUartSend(uint8_t *sData, int sLen)
|
||||
{
|
||||
#if USE_BOOTLOADER
|
||||
LPUart0SendArray(sData, sLen);
|
||||
#else
|
||||
for(int i = 0; i < sLen; i++) {
|
||||
Uart_SendDataPoll(M0P_UART0, sData[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LPUart0SendArray(uint8_t *sData, uint8_t sLen)
|
||||
{
|
||||
RS485_CTRL_TX();
|
||||
@@ -783,6 +796,7 @@ void LpUart0_IRQHandler(void)
|
||||
LPUart_ClrStatus(M0P_LPUART0, LPUartRC); ///<清接收中断请求
|
||||
uint8_t u8RxData = LPUart_ReceiveData(M0P_LPUART0); ///读取数据
|
||||
LPUartRx_CallBack(u8RxData);
|
||||
DebugUartIRQ(u8RxData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,7 +805,7 @@ void Uart0_IRQHandler(void)
|
||||
if(Uart_GetStatus(M0P_UART0, UartRC)) { ///接收数据
|
||||
Uart_ClrStatus(M0P_UART0, UartRC); ///<清接收中断请求
|
||||
uint8_t u8RxData = Uart_ReceiveData(M0P_UART0); ///读取数据
|
||||
DebugUartIRQ(u8RxData);
|
||||
//DebugUartIRQ(u8RxData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -876,7 +890,7 @@ void WakeUpInit(void)
|
||||
AdcInit();
|
||||
#endif
|
||||
#if (USE_UART0 == 1)
|
||||
Uart0Init();
|
||||
Uart0Init(500000);
|
||||
#endif
|
||||
#if (USE_SPI0 == 1)
|
||||
SPI0Init();
|
||||
@@ -908,7 +922,7 @@ void BspInit(void)
|
||||
AdcInit();
|
||||
#endif
|
||||
#if (USE_UART0 == 1)//< DEBUG
|
||||
Uart0Init();
|
||||
Uart0Init(500000);
|
||||
#endif
|
||||
#if (USE_RTC == 1)//< RTC
|
||||
RTCInit(30);
|
||||
@@ -923,7 +937,7 @@ void BspInit(void)
|
||||
SPI1Init();
|
||||
#endif
|
||||
#if (USE_LPUART0 == 1)//< LPUART0
|
||||
LpUart0Init();
|
||||
LpUart0Init(9600);
|
||||
#endif
|
||||
#if(USE_I2C0 == 1)
|
||||
I2C0Init();
|
||||
|
||||
Reference in New Issue
Block a user