Go to file
起床就犯困 432fa9ba62 完成部分对上通信,出现转发耗时较长 2025-03-04 18:04:30 +08:00
CH32V303-FreeRTOS 完成部分对上通信,出现转发耗时较长 2025-03-04 18:04:30 +08:00
.gitignore 添加adc,串口,gpio,flash等外设 2025-02-26 17:59:15 +08:00
README.md 完成部分对上通信,出现转发耗时较长 2025-03-04 18:04:30 +08:00

README.md

测试

串口中断发送通过测试

spi_flash读写通过测试

对智能模块通信串口,阻塞发送数据通过测试。

问题

串口中断

25/02/24

在freerots环境下中断不生效

解决

25/02/25

需要启动freerots任务

同时中断部分

void UART5_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));

变为

void UART5_IRQHandler(void) __attribute__((interrupt()));

其他中断同上,由硬件压栈变为软件压栈

串口发送的数据不正确

25/02/28

解决

将数据通过队列发送需要将buff的位置移动到起始位置+结构体长度

uint8_t *Buff = (uint8_t *)pvPortMalloc(200);
        if (Buff == NULL) {
            log_error("Memory allocation failed\n");
            return;
        }

        queueUartSendInfo *sendBuff = (queueUartSendInfo *)Buff;
        sendBuff->length = sizeof("hello world\n");
        sendBuff->data = Buff + sizeof(queueUartSendInfo);
        strlcpy((char *)sendBuff->data, "hello world\n", sizeof("hello world\n"));
        // for (int i = 0; i < sizeof("hello world\n"); i++) {
        //     sendBuff->data[i] = data[i];
        // }
        // *sendBuff->data = *data;
        // *sendBuff->data = 'H';
        
        log_info("dataLen:%d\n", sendBuff->length);
        log_info("data:%s\n", sendBuff->data);
        xQueueSend(upward_uart_Queue, &Buff, 10);
        vTaskDelay(1000);

中断中不能分配和释放内存

解决

中断中添加信号量,通知任务来释放。

接收解析

su806传来的数据

见网关单片机通信协议

传感器传来的数据