I am using CoAP to send uplinks from an STM32 MCU to my socket server via the BG95-MF modem over UART.
On my STM32U083 NUCLEO board with the Quectel UMTS & LTE EVB kit, everything works fine - I can open a CoAP connection and send uplinks successfully.
However, when I run the exact same firmware on my custom PCB (with the same STM32U083 MCU and BG95-MF modem), I encounter problems.
- I can communicate with the modem over UART without issues.
- But when I send the command:
AT+QCOAPOPEN=0,"<SERVER>",<SERVER_PORT>
the modem responds with:
+QCOAPOPEN: 0,-4
According to the Quectel_BG95&BG77&BG600L_Series_CoAP_Application_Note_V1.0 (Chapter 4: Summary of Result Codes), the return code -4 means “Network failure.”
My question:
What exactly does “Network failure” mean in this context?
Why would the same command succeed on the NUCLEO + EVB kit setup but fail with a -4 on my custom PCB?
I do not know of to edit my post…
Here is the log:
20:12:17:645 -> [DBG] (MODEM): REQ: AT
20:12:17:650 -> [DBG] (MODEM): RES:
20:12:17:650 -> [DBG] (MODEM): REQ: AT
20:12:17:658 -> [DBG] (MODEM): RES: AT
20:12:17:658 -> OK
20:12:17:661 ->
20:12:17:661 -> [INF] (MODEM): Modem is ready
20:12:17:664 -> [INF] (MODEM): Disabling command echo mode
20:12:17:670 -> [DBG] (MODEM): REQ: ATE0
20:12:17:676 -> [DBG] (MODEM): RES: ATE0
20:12:17:679 -> OK
20:12:17:679 ->
20:12:17:679 -> [DBG] (MODEM): REQ: AT+GMR
20:12:17:687 -> [DBG] (MODEM): RES:
20:12:17:687 -> BG95MFLAR05A01
20:12:17:690 ->
20:12:17:690 -> OK
20:12:17:690 ->
20:12:17:690 -> [INF] (MAIN): Modem firmware version: BG95MFLAR05A01
20:12:17:696 -> [INF] (MAIN): MCU temperature: 343 dC
20:12:17:702 -> [DBG] (MODEM): REQ: AT+QTEMP
20:12:17:734 -> [DBG] (MODEM): RES:
20:12:17:734 -> +QTEMP: 28,26,27
20:12:17:738 ->
20:12:17:738 -> OK
20:12:17:738 ->
20:12:17:740 -> [INF] (MAIN): Modem temperature: pmic_temp: 28, xo_temp: 26, pa_temp: 27
20:12:17:760 -> [DBG] (MODEM): REQ: AT+CBC
20:12:17:761 -> [DBG] (MODEM): RES:
20:12:17:761 -> +CBC: 0,4,3244
20:12:17:764 ->
20:12:17:764 -> OK
20:12:17:764 ->
20:12:17:767 -> [INF] (MAIN): Modem battery charge: bcs: 0, bcl: 4, voltage: 3244
20:12:17:773 -> [DBG] (MODEM): REQ: AT+QCCID
20:12:17:783 -> [DBG] (MODEM): RES:
20:12:17:783 -> +QCCID: 8931080520035807492F
20:12:17:785 ->
20:12:17:785 -> OK
20:12:17:785 ->
20:12:17:789 -> [INF] (MAIN): ICCID: 8931080520035807492F
20:12:17:792 -> [INF] (MAIN): Location mode is set to NONE. No location services will be started
20:12:17:800 -> [INF] (NBIOT): Initializing CoAP connection
20:12:17:807 -> [DBG] (MODEM): REQ: AT+QCOAPCFG="pdpcid",0
20:12:17:818 -> [DBG] (MODEM): RES:
20:12:17:818 -> +QCOAPCFG: "pdpcid",1
20:12:17:821 ->
20:12:17:821 -> OK
20:12:17:821 ->
20:12:17:821 -> [DBG] (MODEM): REQ: AT+QCOAPOPEN=0,"<SERVER>",<SERVER_PORT>
20:12:17:841 -> [DBG] (NBIOT): Received CoAP open response:
20:12:17:844 -> OK
20:12:17:844 ->
20:12:17:844 -> +QCOAPOPEN: 0,-4
20:12:17:847 ->
20:12:17:847 -> [ERR] (NBIOT): Network failure (-4)
20:12:17:851 -> [ERR] (NBIOT): CoAP connection initialized unsuccessfully