Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zariot new SIMs - retrieve atsign details #395

Open
murali-shris opened this issue Aug 21, 2023 · 5 comments
Open

Zariot new SIMs - retrieve atsign details #395

murali-shris opened this issue Aug 21, 2023 · 5 comments
Assignees
Labels
arch call Flagging for architecture call discussion bug Something isn't working

Comments

@murali-shris
Copy link
Member

Describe the bug

While trying to access the atsign details loaded in the SIM batch that Zariot shipped to Colin, getting an error while selecting the IoTSafe app.

+CSIM: 6,"019000"
OK
AT+CSIM=24,"01A4040007A0000005590010"
+CME ERROR: 0

Steps to reproduce

sshnp -f @scrapbookgemini -t @mwcpi -d raksign1 -h @rv_am
connect to minicom terminal
Run the below AT commands
+CSIM: 6,"019000"
OK
AT+CSIM=24,"01A4040007A0000005590010"
+CME ERROR: 0

Expected behavior

select IoT safe app command should return success without error code

Screenshots

No response

Smartphones

x

Were you using an atApplication when the bug was found?

No response

Additional context

No response

@murali-shris murali-shris added the bug Something isn't working label Aug 21, 2023
@murali-shris murali-shris self-assigned this Aug 21, 2023
@murali-shris murali-shris added 3 SP 3 Story Points - 1 Day Small and removed 3 SP 3 Story Points - 1 Day Small labels Aug 21, 2023
@murali-shris
Copy link
Member Author

Thanks colin for your help yesterday with NoPorts all up and running on the remote RAK test environment.
I ran some remote tests on the Quectel EG95. It seems to drop commands but does actually address IoTSafe.
It may even be worth contacting Quectel with the end customer and raise the issue, to see if there is a revised Flash to solve the problem with AT commands +CSIM.

So what is happening? Well the device itself is obviously using the SIM at the same time i.e. reading the IMSI, updating ciphering keys, AKA etc.
This causes a re-entrancy problem. Logical channels is supposed to stop this problem, but make sure you are the only one with exclusive access to the channel, because it could be the previous session isn't closed, or the terminal itself is also using the same one, as SIMs don't have a session key for logical channels i.e.

Close channel 1:

AT+CSIM=10,"0070800100"
+CSIM: 4,"9000"

Now the second thing I notice:

Every so often the modem is unresponsive to AT+CSIM commands:

AT+CSIM=10,"0070000001"
ERROR

I type AT again and retry the command:

AT+CSIM=10,"0070000001"
ERROR
at
OK
AT+CSIM=10,"0070000001"
+CSIM: 6,"019000"

Then success? you may have to have this in your code? as an exception handler or such like ...

Next to prove finally that I can read the @id here it is:

OK
AT+CSIM=24,"01A4040007A0000005590010"
+CSIM: 4,"9000"

OK
AT+CSIM=44,"81B0000011730F5A6172696F745F4964656E74697479"
+CSIM: 4,"6164"

OK
AT+CSIM=10,"81C0000064"
ERROR
AT+CSIM=10,"81C0000064"
+CSIM: 204,"315F6440FFC8DD494BEC36E53D6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"

But see I retried the command see in red above, and this is using a logical channel. So my advice is always to close the channel after a session and request one at the start i.e.

Open Channel:
AT+CSIM=10,"0070000001"

Close Channel:
AT+CSIM=10,"0070800100"

If in doubt open another the terminals typically only ever use three at most. There are four, so make use of them.

Final thing avoid busy times for SIMs i.e. boot strap. There is a huge amount of requests to the SIM and the SIM is really only a half duplex asynchronous device. Ther terminal will just reject requests during this period. It is probably why I didn't have the issues you saw, because by the time I used the device, I was well past the bootstrap.

Oh yes Random challenge:

AT+CSIM=10,"8184000000"
+CSIM: 516,"D805143E71C99CEFF80BA908B39CCBE86E5CFD109510F733CE83E034E4B25350338D96D0029A4D53855711BC7E7FF3D2FA1A392D04603B5D39D4679DDD06EF884081D8EE5F41520FCE2D1EB403A19B6

A final note. Do I think this is a SIM problem?
If It was I'd be the first on the phone to Kigen and the OS guys. The error is coming from the terminal and not, and not the SIM i.e. SW1, SW2 errors and I don't see them, even on extended debug mode. I do check the SIM isn't dropping clock or VCC and also doesn't drop the reset line.
So definitely a modem issue and we can prove Quectel with other modems don't have the same issue. Check for Fota (Firmware OTA) for updates there is a command from memory for Quectel.

Any more problems ping me your code and I'll have a look, no problem 😉

Best Regards and thanks in advance for your attention.

Jerry

@murali-shris
Copy link
Member Author

@cconstab should I move to backlog or is this still a priority?

@cconstab
Copy link
Member

We need this to work so please prioritize

@cconstab
Copy link
Member

We need to be able to grab the CRAM and then ask the SIM for a keypair and then for signing operatoons.

So only the SIM has the private PKAM key

@murali-shris
Copy link
Member Author

No updates in PR71. carrying over

@murali-shris murali-shris added the arch call Flagging for architecture call discussion label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch call Flagging for architecture call discussion bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants