pulkin / micropython

MicroPython implementation on Ai-Thinker GPRS module A9 (RDA8955)
https://micropython.org
MIT License
103 stars 31 forks source link

not a issue,is possible to fix IMEI ? #79

Closed ens4dz closed 4 years ago

ens4dz commented 4 years ago

I have 3 of GSM A9 Pudding Board, 2 of them lost their IMEI ! : but still, GSM calls and SMS are working fine ! i flashed the smaller size ROM firmware_debug_fla­sh.lod with : Ai-Thinker firmwarw_tool_v2.1­ But they failed to boot. Then, i flashed the firmware_debug_ful­l.lod

the first one:

AT+GSN
000000000000000

the second one:

>>> cellular.get_imei()
'000000000000000'

the third one is fine:

>>> cellular.get_imei()
'8687150300xxx00'
pulkin commented 4 years ago

I do not know. This is what the assembly shows:

INT32 tgt_GetImeiSv(UINT8 simId,UINT8 *imeiSv) {
...  
  if (((imeiSv != (UINT8 *)0x0) && (simId < 4)) &&
     (IVar1 = FACTORY_ReadField((uint)simId * 9 + 4,9,imeiSv), IVar1 != 0)) {
    hal_DbgAssert(&UNK_881ca800);
  }
...
  return IVar1;
}
INT32 FACTORY_ReadField(UINT32 offset,UINT32 size,UINT8 *buff)

{
...
  if (g_factory_info.has_init != '\0') {
    factory_SemWaitFor();
    SUL_MemCopy8(buff,offset + 0x82094f04);
    factory_SemRelease();
  }
  ...
}

So maybe if 0x82094f04 + 0x4 is a part of SPI memory or any other memory that you can write you will be able to change your IMEI.

Even if non-zero, IMEI of these boards are just random and fail the checksum anyway.

ens4dz commented 4 years ago

So, it is ok to leave off that zeros IMEI . Thank you for this awesome port project and for your great support. I wish you the best.

ens4dz commented 3 years ago

Update: In old a9g tutorial, I found that Is possible to write IMEI by AT firmware: AT+EGMR=1,7,................ To Read IMEI AT+EGMR=2,7

IMEI is printed as QR code at module shield !!! ,you need good phone QR app to recognize it It's seems be valid one. IMG_20210811_014501

By the way,In other module with fine IMEI : os.listdir('/') Returns file named : AT_CFG_0.BIN I found IMEI stored at the end of it