Z3LightSocV510MG1>Sending inter-PAN message of len 10 to (>)000B57FFFE07F6E3 with random values: T00000000:Inter-PAN TX (10) [A9 30 09 70 82 6D D1 A9 3B 14 ], 0x00
success (0x00)
接收端:
RX inter-PAN message (unicast):
src pan id: 0x2923
src long id: (>)000B57FFFE07F6E2
profile id: 0x0109
cluster id: 0x0000 (Basic)
ERR: Inter-PAN profile 0x0109, cluster 0x0000, command 0x09 not permitted
以上打印信息表明Inter-Pan消息发送成功。用户可根据自己的需求,构建自定义的消息。
函数流程分析:
发送流程:
当输入plugin interpan fragment-test,最调用如下函数:
void emAfInterpanFragmentTestCommand(void)
|-- emberAfSendInterPan()
|-- emberAfInterpanSendMessageCallback()
|-- makeInterPanMessage()
|-- emAfPluginInterpanSendRawMessage()
|-- emberSendRawMessage()
最核心的函数是emberSendRawMessage(),其在raw-message.h中定义。
/** @brief Sends the given message over the air without higher layer
* network headers.
*
* The first two bytes are interpreted as the 802.15.4 frame control field.
* If the Ack Request bit is set, the packet will be retried as necessary.
* Completion is reported via ::emberRawTransmitCompleteHandler().
* Note that the sequence number specified in this packet is not taken into
* account by the MAC layer. The MAC layer overwrites the sequence number field
* with the next available sequence number.
*
* @param message The message to transmit.
*
* @return ::EMBER_SUCCESS if the message was successfully submitted to
* the transmit queue, and ::EMBER_ERR_FATAL otherwise.
*/
EmberStatus emberSendRawMessage(EmberMessageBuffer message);
如果想发送广播消息, 可将emberAfSendInterPan()的参数改为如下格式:
EmberStatus status = emberAfSendInterPan( OxFFFF,
NULL,
EMBER_NULL_NODE_ID,
0, // mcast id - unused
clusterId,
SE_PROFILE_ID, // GBCS only
messageLen,
testMessage);
/** @brief This function is called when the stack has received a raw MAC message that has
* matched one of the application's configured MAC filters.
*
* @param macFilterMatchStruct This is a pointer to a structure containing information
* about the matching message, including the index of the filter that was matched,
* and the actual data of the message.
*/
void emberMacFilterMatchMessageHandler(const EmberMacFilterMatchStruct* macFilterMatchStruct);
The basic operation flow of the NVM Programming Utility (Si4010_NVM_Burner.exe) is as follows:
1. Select the Main tab on the GUI.
2. Select the USB adapter.
3. Hit the Connect button to connect to the part.
4. Add your application code intel hex file to the User Boot section.
5. Keep the address value as it is — first line has 0xE180 address filled automatically.
6. Check "Run" checkbox only.
7. Specify the new output NVM Burn File. Choose Overwrite if desired. GUI must check the file existence before running the composer since the composer always overwrites the existing output file.
8. Hit Compose and observe the results. The gui_composer.exe is invoked behind the scenes and the NBF file gets generated.
9.Make sure the 6.5 V programming voltage is connected to GPIO[0] of the part. For example, slide the PROG switch on the MSC-BA4 board to the ON position.
10. Hit Burn to burn the device. The burning process loads the NBF file in the device and uses the information in the NBF file to do the actual burning. Observe the results. The burning process stops at first error encountered.
The scheduled transmit/receive operations are designed to start at the exact time that you specify and RAIL accounts for any transition times and ramp times it knows about. In BLE, RAIL also has Rx and Tx chain delay values that make these times very accurate. In proprietary PHYs RAIL do not have the Rx and Tx chain delays so there may be some small error, but the timings should be pretty close.
Also, RAIL is only taking the idleToTx time for transmit and idleToRx time for receive into account. If the radio happens to be in a state other than idle, it will be subjected to the rxToTx or txToRx times which could be different and cause a scheduled operation to start at the wrong time. So, for now, those numbers just need to be set the same to ensure proper behavior.
In RAIL_SchedulRx() you can configure a ‘receive window’. If you do not receive a sync word within this window, the RAIL_RX_CONFIG_TIMEOUT callback will be asserted.
typedef struct {
uint16_t version; /** The version of this data structure */
uint16_t capabilitiesMask; /** A bitmask describing the capabilites of this particular external EEPROM */
uint16_t pageEraseMs; /** Maximum time it takes to erase a page. (in 1025Hz Milliseconds) */
uint16_t partEraseMs; /** Maximum time it takes to erase the entire part. (in 1024Hz Milliseconds) */
uint32_t pageSize; /** The size of a single erasable page in bytes */
uint32_t partSize; /** The total size of the external EEPROM in bytes */
const char * const partDescription; /** Pointer to a string describing the attached external EEPROM */
uint8_t wordSizeBytes; /** The number of bytes in a word for the external EEPROM **/
} HalEepromInformationType;
For Si4362-C2 part, the radio-config header file which is created by WDS doesn't define RF_PKT_CRC_SEED_31_24_4 and doesn't add it into RADIO_CONFIGURATION_DATA_ARRAY even though we set a new CRC seed in the WDS's GUI window. If the crc seed in the sender side is not all's 0, Si4362-C2 will appear crc error when it tries to receive the data.
A temporary solution is to define RF_PKT_CRC_SEED_31_24_4 and add it intoRADIO_CONFIGURATION_DATA_ARRAY manually.
Why does EFR32 part appear CRC error sometimes and how to solve the problem?
Answer
Sometimes we may see EFR32 part appears CRC error if enabling CRC function, it's maddening. The reason is radio's physical detecting algorithm.
When EFR32 part is receiving a packet with all's 1 or all's 0 payload, it couldn't detect the bits correctly if the packet is long because of its physical detecting algorithm.
The solution is to enable whitening so that the data payload in the air will not be all's 1 or all's 0.
Proprietary Knowledge Base
EmberZnet调试UART-NCP(基于EFR32MG)的一些实用方法
如何使用Inter-Pan消息实现两个不同网络的设备之间的单跳通信?(How do I use Inter-Pan messages to achieve single-hop communication between devices on two different networks?)
(This article was originally written in Chinese. To see an English version, please go to the bottom of the page and click on the Translate button.)
问题
如何使用Inter-Pan消息实现两个不同网络的设备之间的单跳通信?
答案
Inter-Pan消息可用于不同网络,同一信道的两个设备之间的单跳通信。Silicon Labs提供Inter-Pan Plugin,方便客户在此Plugin的基础上扩展,以在自己的应用中实现Inter-Pan消息的发送和接收。本文主要介绍如何搭建和测试Inter-Pan的功能,并以Z3Light sample(EmberZnet stack v5.10)为例,在WSTK+4151 无线板子上进行演示。
plugin interpan fragment-test [panId:2] [eui64:8] [clusterId:2] [msgLen:2]
plugin interpan fragment-test 0xFFFF {000B57FFFE07F6E3} 0x0000 10
其中第一个参数是目的设备的PANID,可以设置为0xFFFF。
第二个参数是目的设备的EUI64,可以设置为NULL代表广播消息,否则为单播。
第三个参数是目的设备的Cluster。
第四个参数是发送的消息的Playload长度。
发送端:
接收端:
以上打印信息表明Inter-Pan消息发送成功。用户可根据自己的需求,构建自定义的消息。
发送流程:
当输入plugin interpan fragment-test,最调用如下函数:
void emAfInterpanFragmentTestCommand(void)
|-- emberAfSendInterPan()
|-- emberAfInterpanSendMessageCallback()
|-- makeInterPanMessage()
|-- emAfPluginInterpanSendRawMessage()
|-- emberSendRawMessage()
最核心的函数是emberSendRawMessage(),其在raw-message.h中定义。
如果想发送广播消息, 可将emberAfSendInterPan()的参数改为如下格式:
接收流程:
当接收到Inter-Pan消息时,emberMacPassthroughFilterHandler()会被调用,其在raw-message.h中定义。
emberMacFilterMatchMessageHandler()
|-- emAfPluginInterpanProcessMessage()
|-- emberAfPluginInterpanPreMessageReceivedCallback()
以上就是Inter-Pan消息的测试过程以及发送和接收流程的源码分析,更多信息请参考Inter-Pan Plugin的源码。
Burning hex file into Si4010 step-by-step
The basic operation flow of the NVM Programming Utility (Si4010_NVM_Burner.exe) is as follows:
1. Select the Main tab on the GUI.
2. Select the USB adapter.
3. Hit the Connect button to connect to the part.
4. Add your application code intel hex file to the User Boot section.
5. Keep the address value as it is — first line has 0xE180 address filled automatically.
6. Check "Run" checkbox only.
7. Specify the new output NVM Burn File. Choose Overwrite if desired. GUI must check the file existence before running the composer since the composer always overwrites the existing output file.
8. Hit Compose and observe the results. The gui_composer.exe is invoked behind the scenes and the NBF file gets generated.
9.Make sure the 6.5 V programming voltage is connected to GPIO[0] of the part. For example, slide the PROG switch on the MSC-BA4 board to the ON position.
10. Hit Burn to burn the device. The burning process loads the NBF file in the device and uses the information in the NBF file to do the actual burning. Observe the results. The burning process stops at first error encountered.
RAIL_SetStateTiming and scheduled TX
The scheduled transmit/receive operations are designed to start at the exact time that you specify and RAIL accounts for any transition times and ramp times it knows about. In BLE, RAIL also has Rx and Tx chain delay values that make these times very accurate. In proprietary PHYs RAIL do not have the Rx and Tx chain delays so there may be some small error, but the timings should be pretty close.
Also, RAIL is only taking the idleToTx time for transmit and idleToRx time for receive into account. If the radio happens to be in a state other than idle, it will be subjected to the rxToTx or txToRx times which could be different and cause a scheduled operation to start at the wrong time. So, for now, those numbers just need to be set the same to ensure proper behavior.
RAIL_RX_CONFIG_TIMEOUT
当使用其它型号的外部SPI Flash时,需要如何扩展Bootloader源码?
The default header file radio_config.h of Si4362-C2 doesn't define RF_PKT_CRC_SEED_31_24_4
Why does EFR32 part appear CRC error sometimes and how to solve the problem?
EmberZNet 以及Thread协议栈需要用哪个版本的IAR EWARM进行编译?