Crash on connecting to Access Point

Quite often, when I try to connect to my 5GHz WiFi network I’m getting a hard fault (security fault) as shown below.
Please note that it does happen on some devices equipped with BW16 module) more often where others seems to work more stable (the probability of getting such fault is much lower).
Here’s an example of logs, showing the AP connection process. I get similar logs/errors quite often when trying to establish socket connection/trasmitting the data.
The SDK I use for the devices was taken from main Ameba SDK repository, branch: master.

The AT command I send:

The logs I get:

RTL8721D[Driver]: set ssid [JRRSoftware]
RTL8721D[Driver]: rtw_set_wpa_ie[1160]: AuthKeyMgmt = 0x2
RTL8721D[Driver]: rtw_restruct_sec_ie[4202]: no pmksa cached

Security Fault:
Secure State: 1

R0 = 0x1007d70d
R1 = 0x00000000
R2 = 0x180a2206
R3 = 0xdeadbeef
R12 = 0xdeadbeef
LR = 0xdeadbeef
PC = 0xdeadbeef
PSR = 0xdeadbeef

EXC_RETURN = 0xffffffb9
MSP = 0x1007fff4
PSP = 0x100047fc
xPSR = 0xa0000007
CFSR = 0x00000400
HFSR = 0x00000000
DFSR = 0x00000000
MMFAR = 0x00000000
BFAR = 0x00000000
AFSR = 0x00000000
PriMask = 0x00000000
SVC priority: 0x00
PendSVC priority: 0x00
Systick priority: 0x00
MSP_NS = 0x10004fd8
PSP_NS = 0x10055040
CFSR_NS = 0x00000400
HFSR_NS = 0x00000000
DFSR_NS = 0x00000000
MMFAR_NS = 0x00000000
BFAR_NS = 0x00000000
AFSR_NS = 0x00000000
SVC priority NS: 0x00
PendSVC priority NS: 0xe0
Systick priority NS: 0xe0