JFF-Bohdan / sim-module

Python 3 classes for SIM 900 GSM module
MIT License
54 stars 26 forks source link

Problem with first initializing #2

Open heximcz opened 8 years ago

heximcz commented 8 years ago

Hi,

I have problem after first boot or reboot rasperry, log:

root@raspberrypi:~/sim-module# ./test_imei_retrieving.py [2015-08-24 02:04:06,054] INFO: opening port [2015-08-24 02:04:06,059] INFO: initializing SIM900 session [2015-08-24 02:04:06,236] ERROR: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128) [2015-08-24 02:04:06,452] ERROR: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128) [2015-08-24 02:04:06,667] ERROR: 'ascii' codec can't decode byte 0x98 in position 0: ordinal not in range(128) [2015-08-24 02:04:06,882] ERROR: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128) [2015-08-24 02:04:07,097] ERROR: 'ascii' codec can't decode byte 0xf8 in position 0: ordinal not in range(128) [2015-08-24 02:04:07,300] ERROR: error initializing session: 'ascii' codec can't decode byte 0xf8 in position 0: ordinal not in range(128) DONE root@raspberrypi:~/sim-module# ./test_imei_retrieving.py [2015-08-24 02:04:10,274] INFO: opening port [2015-08-24 02:04:10,278] INFO: initializing SIM900 session [2015-08-24 02:04:10,531] INFO: Disabling echo, calling 'ATE0' [2015-08-24 02:04:11,365] INFO: retrieving IMEI [2015-08-24 02:04:11,454] INFO: IMEI = xxxxxxxxxxxxxxxx DONE root@raspberrypi:~/sim-module# ./test_imei_retrieving.py [2015-08-24 02:04:16,471] INFO: opening port [2015-08-24 02:04:16,475] INFO: initializing SIM900 session [2015-08-24 02:04:16,937] INFO: retrieving IMEI [2015-08-24 02:04:17,006] INFO: IMEI = xxxxxxxxxxxxxxxx DONE [now still all right]

Second reboot, log:

root@raspberrypi:~/sim-module# ./test_imei_retrieving.py [2015-08-24 01:57:32,008] INFO: opening port [2015-08-24 01:57:32,013] INFO: initializing SIM900 session [2015-08-24 01:57:32,195] ERROR: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128) [2015-08-24 01:57:32,411] ERROR: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128) [2015-08-24 01:57:32,626] ERROR: 'ascii' codec can't decode byte 0x98 in position 0: ordinal not in range(128) [2015-08-24 01:57:32,842] ERROR: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128) [2015-08-24 01:57:33,057] ERROR: 'ascii' codec can't decode byte 0xf8 in position 0: ordinal not in range(128) [2015-08-24 01:57:33,261] ERROR: error initializing session: 'ascii' codec can't decode byte 0xf8 in position 0: ordinal not in range(128) DONE root@raspberrypi:~/sim-module# ./test_imei_retrieving.py [2015-08-24 01:57:48,549] INFO: opening port [2015-08-24 01:57:48,554] INFO: initializing SIM900 session [2015-08-24 01:57:48,751] INFO: Disabling echo, calling 'ATE0' [2015-08-24 01:57:49,422] ERROR: Wrong response for PIN state request [2015-08-24 01:57:49,425] ERROR: error initializing session: Wrong response for PIN state request DONE root@raspberrypi:~/sim-module# ./test_imei_retrieving.py [2015-08-24 01:57:56,339] INFO: opening port [2015-08-24 01:57:56,343] INFO: initializing SIM900 session [2015-08-24 01:57:56,810] INFO: retrieving IMEI [2015-08-24 01:57:56,882] INFO: IMEI = xxxxxxxxxxxxxxxx DONE [now still all right]

Configuration: Raspberry Pi A version with SIM900 GSM/GPRS Add-On v1.0, /boot/cmdline.txt dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait /etc/inittab

T0:23:respawn:/sbin/getty -L ttyAMA0 9600 vt100

Thank you and best regards.

JFF-Bohdan commented 8 years ago

Very interesting. I will fix it when will return at work. It's will be approx in one week.

andreibosco commented 7 years ago

@heximcz How did you fix the ascii codec error?

Update: just in case someone is having this 'ascii codec' issue, heres the fix: