DA14531 CODELESS
使用官方codeless,用自己的开发板进行测试发现AT命令无反应。经排查发现demo中需要从SPI Flash中读取参数。而所采用的硬件上并没有SPI Flash,即便是有对应地址所存储的内容可能也不是想要的。
执行的现象是芯片重启
分析代码:
user_codeless.c文件中888行的函数
void user_app_on_init(void)
{
//代码省略很多...
// line 988
#if defined(USE_AT_BND)
#if (BLE_APP_SEC)
// The bdb should be initialized once if the bonding commands are
// included. The security should be enabled as well otherwise the
// bond commands do not make sense.
default_app_bdb_init();
#else
#warning "Bonding commands are included but security is disabled;No bonding commands will be available"
#endif
#endif
#if defined(USE_AT_HNDL)
// The hdb should be initialized once if the handler commands are
// included
app_hdb_init();
#endif
#if defined(USE_AT_CONPAR) || defined(USE_AT_MAXMTU) || defined(USE_AT_DLEEN)
app_cpdb_init();
app_load_cpdb_conf_from_flash(&codeless_env.conn_conf);
#endif
#if defined (USE_AT_EVENT)
// The events database should be initialized once if the event command
// is included
app_evdb_init();
#endif
}
如上的几个函数会访问Flash加载一些参数。解决的办法是暂时先不支持这些函数。
修改user_at_command.hw文件:
//line 58
#define USE_AT_FLOWCONTROL
// #define USE_AT_CONPAR 不支持
// #define USE_AT_BND 不支持
#define USE_AT_SEC
#if !defined(USE_AT_BINARY_MODE)
#if !defined (USE_SET_TWO)
#define USE_AT_PRINT
// #define USE_AT_HNDL 不支持
#define USE_AT_EVENT
#define USE_AT_BROADCASTER
#define USE_AT_RANDOM
// #define USE_AT_MAXMTU 不支持
#define USE_AT_PWM
#if CMD_LOCAL_SOURCE==CMD_UART
#define USE_AT_BAUD
#endif
#elif defined (USE_SET_TWO)
#if (CMD_LOCAL_SOURCE != CMD_SPI)
#if !defined (CFG_SPI_FLASH_ENABLE)
#define USE_AT_SPI
#endif
#endif
// #define USE_AT_DLEEN
#define USE_AT_MEM
#define USE_AT_BATT
// #define USE_AT_HOSTSLP 不支持
#define USE_AT_ADC
#define USE_AT_I2C
#define USE_AT_PWRLVL
#define USE_AT_RSSI
#define USE_AT_HRTBT
#define USE_AT_CMD
#endif // !USE_SET_TWO
#endif //!USE_AT_BINARY_MODE
如上操作后程序可正常执行并输出
AT
OK
此处使用的是codeless_531_set_two_standalone的配置