1.电路板必须要有电源指示灯,当没电的时候能快速判断。
2.电路板必须要有心跳灯,芯片死机的时候,能够立刻发现。程序运行的不同状态也能通过心跳灯来表示。
3.变量命名,用前缀表示分类。比如,TEST_LED,表示测试类的led。LED_TEST,表示LED类的叫test的灯。分类不一样。同样TEST_KEY和KEY_TEST也是分类不同。
4.bootloader和IAP要分开来实现,bootloader只负责启动哪一个程序,IAP随应用一起实现。有自升级要求的应用要选用flash大一些的芯片,空间布局可以是boot loader + config + A应用+ B应用,A和B可以轮动升级,保证升级失败也不死机,而且可以回退到上个版本。
5.canbus的采样点问题 (参考 https://community.nxp.com/thread/433929)
The sample point is the location, typically given as a percent value, inside each bit period where the CAN controller looks at the state of the bus and determines if it is a logic zero (dominant) or logic one (recessive). All CAN controllers allow this point to be configured and it is always specified as a percentage from the start of the bit period.
The location of the sample point is a trade-off. An early sample point decreases the sensitivity to oscillator tolerances and allows lower-quality oscillators. A late sample point allows for a longer signal propagation time and therefore a longer bus. A later sample point is useful for non-ideal bus topologies.
The CAN-in-Automation user’s group makes recommendations of where the sample point should be for various bit rates, with 87.5% the most common.
"FAQ contribution from Embedded Systems Academy, experts in CAN bus. For more information visit www.esacademy.com"
如上表述,采样点延后对长距离通讯更有利,87.5%是比较推荐的。
6.不能debug的问题,参考http://www.cnblogs.com/zhanghonglang/p/8882034.html