2020年问题记录

  1. stm32 串口DMA和cat1通讯导致串口还没有完全接受完模组数据,实际接受和模组将要发送的不一致,即AT模组会将1000的包分为两次接收+RECVICE,600 +RECVICE,400 然后+RECVICE,600中会在300个字节中触发串口的接收完成中断,还有300个没有接收完成,所以不能使用串口完成中断和串口空闲中断接收处理数据,空闲中断为1个字节的时间没有接收到数据就是空闲中断,很容易误判,需要使用定时器做串口超时接受处理

  2. stm32使用malloc时,将自动将heap大小计算到zi-data中

  3. 读写sfud(spi flash)时,使用sfud提供的读写函数可以正常操作,使用rt_device_write/read读写会求一个物理地址导致程序崩溃如下

    rtthread在使用sfud 操作w26q64的时候有两套操作函数

    1. sfud_erase_write/read适合任意地址任意字节的读写操作

    2. rt_device_write/read(&flash_dev->flash_device, 0x03, wdata, 1),注意最后两个参数,data必须大于等于w25q64的块大小4096,最后一个参数1为读取扇区数量不是字节数注意,因为在rt_sfud_read中乘了每个扇区的字节数如下

      /* change the block device's logic address to physical address */
      rt_off_t phy_pos = pos * rtt_dev->geometry.bytes_per_sector;
      rt_size_t phy_size = size * rtt_dev->geometry.bytes_per_sector;
      
  4. rt-thread 使用USB驱动时注意开usb的时钟

原文地址:https://www.cnblogs.com/st-home/p/14375900.html