TIDUE59A May 2018 – September 2020
Connection to the local network (CC3220 to AP) is handled independently from the provisioning task in the TIDC-01005 software application. The reason the connection is handled separately is because the system does not need to be provisioned every time it tries to connect to a network. A profile stored in the external serial flash of the CC3220S is used to connect the system to a network during most connection attempts. Additionally, connection management was implemented as a separate thread, because provisioning does not need to be automatically triggered if the system fails to automatically connect to a network based on a stored profile.
When the network connection thread runs, it first checks to see if a stored profile exists on the serial flash. If a profile does not exist, the system assumes that an automatic connection attempt will fail and, therefore, immediately enters one of the enabled provisioning modes. If a profile exists, the thread waits a predefined amount of time to see if the system automatically connects to an AP based on the stored profile. If the connection is successful, the connection thread goes to sleep until a disconnection event occurs. If the device does not connect to an AP based on the stored profile, the system waits a predefined amount of time before attempting to connect again. The reason the system attempts to connect again after a set amount of time is because it is possible that the AP described by the stored profile exists, but was inactive or out of range during the connection attempt.
The network connection task is also responsible for starting provisioning. When the system is first started by a user or reset to factory defaults, no profile exists on the serial flash. Therefore, either AP, SmartConfig, or BLE provisioning must run before the system can be used. The provisioning process is triggered by the network connection task when there is no profile.
Figure 2-5 shows the network-connection management state machine.