Accessing the response af +CMGR

Using the HL7800 to receive SMS and forward those on to Nordic nrf52840 through UART1. Using either CMGL or CMGR I can see a new text has arrived and see the response in the log. I need to pull that SMS message and store it on the nrf52840 so I can use it. In the HL7800.c I see that there is an “UNHANDLED Rx” that dumps the message into the debug line.

if (IS_ENABLED(HL7800_LOG_UNHANDLED_RX_MSGS) &&
!cmd_handled && frag && len > 1) {
out_len = net_buf_linearize(msg, sizeof(msg),
rx_buf, 0, len);
msg[out_len] = 0;
LOG_HEXDUMP_DBG((const uint8_t *)&msg, len,
“UNHANDLED RX”);

In my RTT log on start up I see the response when I send +CMGR:
rtt:~$ [00:00:05.028,533] modem_hl7800: hl7800_rx: UNHANDLED RX
00> 74 74 65 6d 70 65 6e 63 6f 63 6b 3a 31 31 30 30 |ttempenc ock:1100

How do I get that SMS into the “ttempenc ock:1100” into a Nordic nrf52840 register?

Thanks.

What is the raw output from hl78 module?
If it can output correctly, then you should ask Nordic team

I have asked the Nordic Team. They said I had to check to see if the driver supported this. I am getting this in the RTT Viewer log, just like I need to see it, it’s as far as I can tell, that message is not actually getting stored anywhere on the nrf52840. Nordic says I have have the HL7800.c state where that gets stored. Where in the HL7800 can I access that message to send it?

The output I’m getting is what you see in the primary post, if there is a different way to see that, let me know.
74 74 65 6d 70 65 6e 63 6f 63 6b 3a 31 31 30 30 |ttempenc ock:1100

Thanks

It is showing “t t e m p e n c o c k : 1 1 0 0” from hl78 module

What do you want from the module then?

Unless, I’m mistaken, all the CMGR return does is show me there is a message and its content in index 1. It is not saving it anywhere on the nrf. I need to access SMS index 1 on the HL78 so I can store it to the Nordic and use the value in my program.

You cannot always store in index 1

Btw, how do you read sms? Always using “at+cmgr=1”?

I am using either CMGL or CMGR. The plan is to use CMGR, store the SMS response so I can use it in my program, then CMGD to clear out any index that has a value. This should mean that any following message received by the modem would go to Index 1 and the cycle repeats.

So yes, AT+CMGR=1 is what I use normally.
I used AT+CMGL="ALL" to make sure other indexes were not being populated with this method.

This kind of logic is not recommended
Have you considered what if two sms received simultaneously?
How about concatenated sms?

Not sure how that would be a possibility. The external app that sends the SMS can only send 1 single SMS to this modem at a time and tracks it. If by some strange event one of the other indexes ended up being populated, it would be cleared each cycle and the program would only recognize index 1.

Right now, I just need to be able to access the message received in index 1 and store it so I can prove the concept at the demo this week. I can work on handling possible error modes after that, which I will, but I have to prove that I can receive the SMS, and identify the message content so the program can act on it.

I really do appreciate the help on this.

You might need to delete the sms after you receive and read the new sms in index 1

Yes that CMGD is part of the sequence, once I am able to read the SMS and move it to memory.

How do I read index 1 from the modem so I can move it into a location I can get at with the nrf code?

You can use at+cmgr=1 to read index1 sms

Yes, that is what I said initially. at+cmgr=1 is what I am using. I get a response sent back in the RTT log that shows me that when I use RTT Viewer, but that doesn’t help me. It’s not saved to any memory as far as I can tell.

I need to know how to call whatever register is index1 so the code can use the contents of the SMS.

what do you mean by “save to any memory”?
As far as the AT+CMGR=1 output the content in index 1, then module has no problem, right?

This is what i’ve been asking, I need to copy the actual SMS in Index 1 to another location.

Let’s say the message received is “TTempclock” in Index 1. When I use AT+CMGR=1, I can see that SMS in Index 1 in the RTT log, but that does not seem to put the SMS anywhere in the Nordi device.

I do not know how to get the code to move that SMS message “TTempclock” out of Index 1 and into another location.

I then use AT+CMGD to clear out Index 1 to be ready for the next scheduled SMS.

Index 1 is in the HL7800 correct?

The module is working, yes, but I need to be able to get the text message out of Index 1 for use in the NOrdic code.

what do you mean by into another location?
You can save the SMS in your host platform, right?

you can check AT+CPMS? to see where the SMS is stored

I created a handler in the HL7800.c driver to do this, but now I need to parse the SMS message in that handler.

When I run +CPMS, I see that the message is stored in ME, mem1.
From RTT Viewer log:
2b 43 50 4d 53 3a 20 22 4d 45 22 2c 31 2c 35 30 |+CPMS: " ME",1,50
2c 22 4d 45 22 2c 31 2c 35 30 2c 22 4d 45 22 2c |,“ME”,1, 50,“ME”,
31 2c 35 30 |1,50

What is the problem then?
you cannot point where the module goes wrong…

if you want to store the SMS in SIM, you need to change the AT+CPMS to “SM”