From ec51312d1b175c9eebe7a92e1cc15e4d0d120e64 Mon Sep 17 00:00:00 2001 From: zhangbo <zhangbo@qq.com> Date: 星期二, 29 七月 2025 18:06:34 +0800 Subject: [PATCH] 修改can模块的通讯速率500k --- 源码/核心板/Src/main.c | 33 ++++++++++++++++++++++++++++++--- 1 files changed, 30 insertions(+), 3 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" index 69eef50..e7631af 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" @@ -224,7 +224,7 @@ void IdleTask(void) { - UART_CheckReceive(); + UART_CheckReceive(); UART_CheckSend(); if(heartbeat_timer>1000) @@ -245,7 +245,7 @@ // NVIC_SystemReset(); // } // } - flag_newsecond=0; + flag_newsecond=0; tagpos_binary=0; memcpy(ancidlist_send,ancidlist_rec,ancidlist_num*2); ancidlist_num=0; @@ -308,6 +308,32 @@ g_com_map[RELAY2_STATE_INDEX] = READ_RELAY2; } +uint8_t at_cmd[3]={0x2B,0x2B,0x2B}; +uint8_t at_cmd1[2]={0x41,0x54}; +char at_cmd2[20]={"AT+CAN=500,70,NDTF\r\n"}; //AT+CAN?\r\n +char at_cmd3[9]={"AT+CAN?\r\n"}; +char at_cmd4[9]={"AT+EXAT\r\n"}; +void send_to_ECAN() +{ +// UART_PushFrame(at_cmd,3); +// +// UART_PushFrame(at_cmd1,2); +//// delay_ms(1); +// UART_PushFrame((uint8_t*)at_cmd2,20); +//// delay_ms(1); +// UART_PushFrame((uint8_t*)at_cmd3,9); +//// delay_ms(1); +// UART_PushFrame((uint8_t*)at_cmd4,9); + printf("+++"); + delay_ms(20); + printf("AT"); + delay_ms(20); + printf("AT+CAN=500,0,NDTF\r\n"); + delay_ms(1); + printf("AT+CAN?\r\n"); + delay_ms(1); + printf("AT+EXAT\r\n"); +} int main(void) { @@ -324,9 +350,10 @@ usart_send[1]=0xAA; usart_send_anc[0]=0x55; usart_send_anc[1]=0xAA; - + send_to_ECAN(); while(1) { + g_start_sync_flag=0; if(g_start_send_flag) { -- Gitblit v1.9.3