I’m trying to use FreeRTOS Cellular Library and FreeRTOS+TCP from Quectel BG96 on windows using demo ( FreeRTOS/FreeRTOS Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96 ) to make MQTT connection using Mutual Authentication ( mbedTLS).
I configured the project and created a mosquito broker on my host machine.
I have a problem when I launch a debug session, the software remains blocked on Cellular GetServiceStatus failed 0, ps registration status 3.
I think it’s a network registration issue.
I tried to connect to the UART port with a tool (I see that it responds well to the AT+COPS command? by +COPS: 0,0,“F SFR EMnify”,0.
There are something we can check first. 1. Change the default RAT config in cellular_config.h
BG96 support RAT searching sequence. If CELLULAR_CONFIG_DEFAULT_RAT is not defined, the default value is to search LTE-CATM1 network only. We can try to define the following in cellular_config.h to see if we can register to GSM network now.
2. Enable DEBUG log to provide more information
We can also enable the debug message in cellular_config.h to provide more information if the modem still have problem registering the network.
#ifndef LIBRARY_LOG_LEVEL
#define LIBRARY_LOG_LEVEL LOG_INFO <= Change the level to LOG_DEBUG
#endif
I added the modifications on the cellular config.h file, but I have another problem, I think it cannot detect the sim card ( >>> Cellular SIM failure <<<).
I did some tests by sending AT commands and it works fine ( AT_CMD_USING_UART.txt) , I think I have some problems with the project configuration.
Do you have any ideas please to help me or a tutorial that explains how to configure the project for a quectual BG96.
From this log.txt file, the AT command is echo-ed back. It looks like the command echo is not disabled. The first command should be ATE0 instead of ATI. Command echo disabled is required by cellular interface. Please reference the original BG96 Cellular_ModuleEnableUE.
12 3 [CellularDemo] [DEBUG] [CellularLib] [_Cellular_AtcmdRequestTimeoutWithCallbackRaw:224] >>>>>Start sending [ATI]<<<<<
13 4 [Cellular_Threa] [DEBUG] [CellularLib] [_Cellular_ReadLine:581] AT Read 54 bytes, data[00C15F49]
14 4 [Cellular_Threa] [DEBUG] [CellularLib] [_handleMsgType:679] Allocate at response 00C1A7E4
15 4 [Cellular_Threa] [DEBUG] [CellularLib] [_handleMsgType:682] AT solicited Resp[ATI]
16 4 [Cellular_Threa] [DEBUG] [CellularLib] [_saveATData:177] Save [ATI] 3 AT data to pResp
The log file “AT_CMD_USING_UART.txt” indicate that your device can register to the CAT-M1 network with CELLULAR_APN “EM”
AT+QSIMSTAT?
+QSIMSTAT: 0,1
OK
AT+CGDCONT?
+CGDCONT: 1,"IP","EM","0.0.0.0",0,0,0,0
OK
AT+COPS?
+COPS: 0,2,"20801",8
Summarize your log. I can suggest the following things:
Use the original code without modification in cellular_bg96.c
Check the following configs in your cellular_config.h
// This is your com port to communicate with BG96
#define CELLULAR_COMM_INTERFACE_PORT "...insert here..."
// This is your APN
#define CELLULAR_APN "EM"
// Make sure you are using USBAT or UART to communicate. If you are using USB to communicate with BG96, this config should be defined.
#define CELLULAR_BG96_URC_PORT_USBAT
Since the modem can register to CAT-M1 network, which is the default value, we don’t have to change CELLULAR_CONFIG_DEFAULT_RAT in cellular_config.h
Re-run the demo application. If there is new problem, please share the log again.
I would like to port the cellular freeRTOS library to the Nordic nRF52840 platform.
I added the freeRTOS cellular library in our project but I have a weird compilation problem (IDE segger studio).
at the compilation level I have undeclared macro errors (but for information, they are all defined in the cellular_config_defaults.h file.
For information, I am inspired by the MQTT_Mutual_Auth_Demo_with_BG96 demo ( and I did not change the configuration file cellular_config.h and I did not define the macro CELLULAR_DO_NOT_USE_CUSTOM_CONFIG.
Yes, I did include the cellular_config_defaults.h file in the project and I did replay its path in the include directories, but it makes sense that the macros are defined cellular_config_defaults.h but this file is not included in the cellular_types file. h.
I didn’t understand how it’s compiled in visual studio , that’s what it needs a particular configuration or you have to define the macros as a compiler option such as -D in gcc .
Thanks Gaurav, indeed it was a configuration problem on my environment.
I have another problem please, also compilation problems.
For information I want to port for the Nordic platform.
I have errors compiling the mbedtls_platform_entropy_poll function which depends on the windows library ( C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\bcrypt.h ).
I see a comment in the function ( /* TLS requires a secure random number generator; use the RNG provided
* by Windows. This function MUST be re-implemented for other platforms. */ ), do I also have to port it for my nordic nRF52 platform or does that mean the platforms (windows, linux, Unix)?
Is there a way to disable the use of the Mbedtls library because frankly for the moment I don’t need it and it gives me a lot of trouble?