This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] RTOS/CC2640:SNV 在定制配置文件中读取/写入

Guru**** 2587365 points
Other Parts Discussed in Thread: CC2640

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/599275/rtos-cc2640-snv-read-write-in-custom-profile

器件型号:CC2640

工具/软件:TI-RTOS

大家好、

我正在尝试使用自定义配置文件中的 SNV 函数、根据 Simplepereral 项目在闪存中读取和写入参数。  

我要预测的是、每当主设备(手机)尝试读取参数时、从设备(CC2640)从闪存读取并发送到主设备。 每当主器件尝试写入参数时、从器件都会获取该参数并将其保存到闪存中。  

在实践中,我测试 了 SimpleBLEPeripheral_init()中工作正常的 SNV 读/写函数。 但是、当我在配置文件中实现它们并运行时、程序将进入 HAL_ASSERT_CAUSE_ICALL_ABORT 情况、并且每当遇到 SNV 读取/写入函数时、永远不会返回。

以下是代码:

在 ReadAttrCB 函数中:

Case interrupt_STARTTIME_Hour_UUID: 
*PLEN = interrupt_STARTTIME_Hour_LEN; uint8 buf[interrter_STARTTIME_Hour_LEN]={0}; 状态= osal_SNV_read (interrupt_STARTTIME_Hour_snV_ID、interr_STARTTIME_Hour_LEN、(uint8 *) buf); pValue = buf; memcpy( pValue、pAttr->pValue、interrter_STARTTIME_Hour_LEN );
中断;


在 WriteAttrCB 函数中:

Case interrupt_STARTTIME_Hour_UUID:

如果(offset ==0)
{
如果(len!= interrter_STARTTIME_Hour_LEN)
{
状态= ATT_ERR_INVALID_VALUE SIZE;
}
}
其他
{
状态= ATT_ERR_ATTR_NOT _long;
}

如果(status == Success)
{
memcpy (pAttr->pValue、pValue、interrter_STARTTIME_Hour_LEN);
uint8 buf[interrter_STARTTIME_Hour_LEN]= pValue;
RET = osal_SNV_write (interrupt_STARTTIME_Hour_sv_ID、interr_STARTTIME_Hour_LEN、(uint8 *) buf);
notifyApp = interrupt_STARTTIME_HOUR;
}

中断; 

   我的配置文件中是否应该设置其他任何内容、以使 SNV 函数的工作方式与 simple_peripheral.c 中的工作方式相同?




  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    您无法在回调函数中执行阻塞堆栈 API 调用。 这包括 OSAL SNV。 最好在 RAM 中缓存这些值、以便它们可用于服务回调。

    祝你一切顺利