AT Command For Overwriting ICCID Sim - gsm

Is it possible to overwrite a SIM card's ICCID number using AT commands? If so, what is the command for it?
If not possible via AT commands, is there another way to overwrite the ICCID of a sim card? USSD etc

No, I'm afraid it is not possible.
ICCID number is physically written in the internal memory of the SIM itself.As soon as the cellular modem/telephone is powered on:
the SIM is resetted
the ATR string is read (ATR = Answer To reset)
the communication modem <-> SIM is configured
After that the SIM is just like some sort of "data array", in which you can read specific data at specific indexes. One of them is ICCID number and it is used for the SIM authentication on the network.
Whay it is not possible to change it? Well SIM stands for "Subscriber Identity Module". Changing your ICCID number would mean adulterating its identity, and that would fail to fulfil SIM's own main purpose.

Related

Restore grinded off markings of STM32 MCU via JTAG

I have a board with presumably an STM32 mcu. I want to make custom firmware for that board as the stock one is very buggy. Unfortunately the board manufacturers were kind enough to grind off all the markings. Is there any way to get the device/family id via jtag and cross reference it to a model number? Everything I could find was about getting the unique id of the chip, which is NOT what I need.
In pystlink (SWD programmer) is implementation, which almost successfully identify any STM32 MCU.
The principle is:
read PART_NO from register CPUID at address 0xe000ed00 and with this is possible to identify if MCU is CortexM0, M3, M4, .. in this file stm32devices.py
read IDCODE_REG (M0 and M0+ has this register on different address than M3, M4 and M7) first 12bits is DEV_ID, which identify family and again look into stm32devices.py file
read flash size from register FLASH_SIZE_REG (each family has this register on different address) and identify concrete device again by stm32devices.py file
Or simply connect SWD and keep pystlink to detect right MCU.
You can get down to a family of STM32 through the JTAG IDCODE of the device, but getting to the exact part number will require more guessing, like actual flash and ram size, or optional features.
I would do the following:
get IDCODE from boundary scan JTAG TAP, confirm it is ST and STM;
look for it in manuals from ST, get to the family;
see whether the family implements the flash identification feature (some families expose flash size and page size at fixed offsets in memory space);
if not, probe for actual flash size through memory accesses (dichotomy in plausible address space will give good results);
do the same for ram.
At last, you know for sure the package you have on the board. With this, you should be able to narrow down to the matching part number.
If you have access to a boot loader UART you can use stm32flash to identify and program the device, unless it is locked down.

How to auto-select the APN depending on SIM card?

I have this GSM embedded device under linux, where depending on external factors I might chose to put a different sim card into. But in the configuration for the PPP, I have to give an APN, which changes depending on the network du jour. How can I automatize that?
It just downed on me that smartphones don't need explicit APN entry to work when changing the sim card (also, the APN is sometimes different in M2M and actual cell phone, not sure I can use the same trick).
(I know you are curious: it's deployed in the middle of nowhere, and we chose the least worst network at the last minute on the installation site)
You can detect the network operator from the IMSI of the SIM, and have in your device a table mapping operators to APNs.
There are several sites that will provide you an IMSI to operator listing or MCC and MNC to operator listing. The MCC (Mobile Country One) is the first three digits of the IMIS and the MNC (Mobile Network code) the next 2 or 3 digits. Some example links:
https://www.imei.info/carriers/
https://www.mcc-mnc.com
As an aside, if you want to be able to change to adapt to the best available network coverage over time, the way many M2M applications achieve this is to use a 'forgein' SIM which can then roam to the best available signal at a given time. If your data usage requirements are low this can be a good way to avoid being dependent on one operator in an area with poor coverage. There are quite a few companies who specialise in these type of M2M sims, depending on your target location.

IMSI retrieval from the network elements using IMEI without SIM card

My question is more specific to GSM mobile telephony networks and more or less about SS7/SigTran Protocol suite. So I am not asking the possibility of knowing SIM card details using IMEI number from an end user point of view as it is asked here.
Being a network operator is there anyway that I can retrieve the IMSI associated with IMEI number from MSC,VLR, HLR or any other network elements in the core network(I am excluding EIR on purpose as my current implementation does not include that)? The query should be just based on IMEI with an assumption that we are not interacting with the SIM or the device. Do any of these elements store IMEI-IMSI pair when it is used before.
In summary is it possible to retrieve IMSI from the database of any of the network elements provided just IMEI number. If yes, how? what are the messages (e.g. provideSubscriberInfo-req) that are needed and the ASN1 encoding scheme.
P.S: This is not handset specific such as the one mentioned here , more of network operator specific.
Well its not possible(not that I know off) from a standard GSM operation where you can input IMEI and receive IMSI. However you can get IMSI if you know the MSISDN by GSM Map operation Any_Time_Interrogation_Request. We are using a solution from sigtrangateway.com SigtranGateway.com for same purpose in a telco project and its working fine so far.

Receiving data from multiple devices using parallel wired RS232

I'm currently developing a small application for monitoring the power / current our solar collector is generating.
The array is connected to 3 inverters. Every inverter has a RS232 interface, transmitting one Line of information(its current status) every 10 seconds.
Since I want to do the monitoring using a device only having one serial port, I need to come up with a way to be able to read the data from all of the inverters in parallel.
I don't need to send anything to one of the inverters!
Is it possible to just connect 3 RS232 wires in parallel to one serial port? Collisions will be pretty unlikely since every inverter is transmitting only 64Byte / 10seconds ending with a newline, so I could check for variable line lengths to detect collisions.
I'm sort of chuckling at doomsday and wacky answers that so often pop up on stackoverflow...
But anyway, in years gone buy I have used paralleled RS-232 transmit lines using diodes and it can work fine for situations where collisions are unlikely. In one particular application I used this technique there were two input terminals where a user could key in simple commands to control the system (a specialized security system) and it was very unlikely that two people would be trying to control it at the same time from the two different terminals. Amazingly enough there are no problems with voltage levels with most RS-232A receivers I tested at the time and they tolerated the signal characteristics (no negative voltage) that result from the simple use of the diodes in series with the TXD signals. However, if I had to do this again I would likely add a simple pull-down resister and capacitor to ground with a diode between RXD and the cap in a sort of charge pump configuration or a pull-down to negative going handshake signal to ensure the "OR'd" input signal goes truly negative since the RS-232 spec defines +3 to -3v as invalid.
In any case, I would recommend not using this technique except in very specific, limited, and non-mission critical cases and would not use it in the case where you have multiple devices sending information at a programmed interval as in the case of the OP or where there is a software handshake.
In can be a simple solution to the problem of not enough serial input ports but only in a very limited set of environments.
No, you should NOT connect 3 serial output port in parallel. If you do that you are probably going to broke the RS232 output circuitry of your inverters.
You have 3 RS232 outputs, so you need 3 RS232 input, then you can manage these 3 input the way you like: maybe you can buffer the data from each input, and reoutput the data on a single RS232 output, to be connected to your monitoring device.... but you should add some code in the data flow to differentiate the data coming from the 3 inverters.
Maybe you can use some kind of IC that do the job for you, I'm not sure, but maybe that some IC that multiplex multiple RS232 input on a single RS232 output already exist.
Try this search: rs232 port input multiplexer on Google
Or, if the monitoring device is a Window computer, you can use 3 serial-to-usb converter: that will create 3 virtual COM port on your computer and you can read data from them with any software.
Update
About the hypothesis of securing the output circuitry using diods to block reentering current, I don't think it's going to work...
Many year have passed by since last time I've used an RS232 link at low level (so maybe I'm wrong) but I think that there is some kind of handshake going on between RS232 input and output port (speed to use, parity, stop bit...).
Each RS232 port have inputs and outputs signal, both for data and for transmission control, so your multiple RS232 outputs does have some input signals, and your single RS232 input does have some outputs.
This mean that your input monitoring RS323 port is going to try to make a handshake with 3 RS323 ports at the same time... and the 3 RS232 ports are probably going to respond at the same time... so I think it's not going to work.
Other than that if you place diodes on your output, you are going to loose 0.7v, I don't remember the tolerance on signal level of RS232, but maybe that 0.7v can be relevant.

How to check if the PIN has a certain value

I'm developing on a mobile gsm platform and I need to know the PIN in order to change it. Is there a way to verify if the PIN has a certain value?
I'm looking for the solution that makes use of AT commands since this is the only way to control the gsm modem.
I need this to prevent the use of the SIM card for data transfer, calls etc in personal phones or other devices.
Is there a simple way to find out what the PIN is (highly unlikely) or to check if the PIN is the one from a list of expected values?
Thanks
You cannot extract the pin with the standard command set, AT+CPIN=XXXX will respond with OK if XXXX is the correct pin, otherwise it will generate a CME error - however submitting 3 incorrect attempts can cause the SIM to lock until the PUK code is entered.
If you know the PUK however, you could always change the pin to a known value without needing the original PIN (AT+CPIN again).

Resources