We developed some year ago a product based on the MC13213 with the Beekit 3.0.2 (BeeKit HCS08 MAC Codebase 2.6.1)
Ou application is based on the exemple Non Beacon Device:
On start, the device send a Scan request to get all possible coordinator (on all channel 11 to 26). Then after get the list of the coordinator, send an association request.
The original Scan request was done in the "App_StartScan" function vy the folloiniwg code:
/* This is a MLME-SCAN.req command */
pMsg->msgType = gMlmeScanReq_c;
/* Create the Scan request message data. */
pScanReq = &pMsg->msgData.scanReq;
/* gScanModeED_c, gScanModeActive_c, gScanModePassive_c, or gScanModeOrphan_c */
pScanReq->scanType = scanType;
/* ChannelsToScan & 0xFF - LSB, always 0x00 */
pScanReq->scanChannels = (uint8_t)((mDefaultValueOfChannel_c) & 0xFF);
/* ChannelsToScan>>8 & 0xFF */
pScanReq->scanChannels = (uint8_t)((mDefaultValueOfChannel_c >> 8) & 0xFF);
/* ChannelsToScan>>16 & 0xFF */
pScanReq->scanChannels = (uint8_t)((mDefaultValueOfChannel_c >> 16) & 0xFF);
/* ChannelsToScan>>24 & 0xFF - MSB */
pScanReq->scanChannels = (uint8_t)((mDefaultValueOfChannel_c >> 24) & 0xFF);
/* Duration per channel 0-14 (dc). T[sec] = (16*960*((2^dc)+1))/1000000.
A scan duration of 3 on 16 channels approximately takes 2 secs. */
/* So use faster value (0) and then scan with value 4 for the last try! */
pScanReq->scanDuration = 1;
pScanReq->securityLevel = 0;
/* Send the Scan request to the MLME. */
if(MSG_Send(NWK_MLME, pMsg) == gSuccess_c)
This work ok.
I made a modification last year to perform the connection time:
I Scan the network only on the last channel where the device was connected (saved in NV memory) with a short duration time.
If not success, I try a second time, Then a third time (with a longer duration scan) and then, I make a last try on all channel.
But sometime, with this sequence, on the 4 try (on all channel), the broadcast request on the air on a channel (21 on 22) the frame is bad (with a sniffer, the Dest address is not FFFF and the CRC is bad...
Very not lucky!
If I scan another time (5) it work properly. If I scan on all channel on the first, second or third try, this work also!
Is somebody could help me about this problem? Is now, the beestack source code is accessible?