I successfully used the tree command this morning to get the SIM file structure. I had to tweak pysim to not look for the echo of its own commands.
I modded the firmware to stop status line
The design of the phoenix interface means that whatever it sends gets seen by the receive side. This is probably deliberate so if the card starts sending it is seen. Especially as ignoring a failed command can be dodgy, e.g. you send equivalent of cd to card to select a file and then read or write.
//printf("stop bit: %d parity bit: %d data bits: %d\n", hwuart_stop_bits, hwuart_parity, hwuart_data_bits);
pio_sm_set_enabled(pio, sm, false); //pause the RX state machine? maybe just discard the byte?
pio_sm_put_blocking(pio, sm-1, data);
pio_hwuart_wait_idle(pio, sm-1);//wait for the TX state machine to finish
pio_sm_set_enabled(pio, sm, true); //enable the RX state machine again
I looked into the local echo. It should be disabling the RX during TX. I donāt get any local echo when I type into bridge mode. Do you think it is coming from the Bus Pirate? Itās completely possible, but I couldnāt reproduce it.
No the buspirate is not echoing the characters being sent to the SIM card. An old fashioned serial interface phoenix adaptor does echo, due to the minimal electronicss interface. So pysim expects the echoā¦ it is not really a buspirate problem, but a tweak to pysim.
If you look in this schematic you will see the interface to pin7 of SIM will basically loop back the data out to the input
I have yet to get a macro file onto the buspirate but this is the output from pySim-shell for those who wan to use Ians smartcard/sim adaaptors to explore random sim cards.
lawrence@dell7520:~/git/pysim$ ./pySim-shell.py --device /dev/buspirate-text --baud 9600
No reader/driver specified; falling back to default (Serial reader)
Using reader serial:/dev/buspirate-text
Waiting for cardā¦
Info: Card is of type: UICC
Detected UICC Add-on āSIMā
AIDs on card:
USIM: a0000000871002ff49ff0589 (EF.DIR)
ADF.ISD: a000000003000000
Welcome to pySim-shell!
(C) 2021-2023 by Harald Welte, sysmocom - s.f.m.c. GmbH and contributors
Online manual available at pySim-shell ā osmopysim-usermanual documentation
pySIM-shell (00:MF)> tree
DF.GSM 7f20 GSM Network related files
EF.LP 6f05 Language Preference
EF.IMSI 6f07 IMSI
EF.Kc 6f20 Ciphering key Kc
EF.PLMNsel 6f30 PLMN selector
EF.HPPLMN 6f31 Higher Priority PLMN search period
EF.ACMmax 6f37 ACM maximum value
EF.SST 6f38 SIM service table
EF.ACM 6f39 Accumulated call meter
This was my attempt at a mcro file to set it up, note that one step says no to existing setup of the mode, sc.txt (250 Bytes)
And when I press the button, I get the 0x3b sequence displayed.
Linux Ubuntu 22.04 LTS
Iāve used both screen and tio to connect.
Output of the āiā command follows:
Something is different.
HDPLXUART> i
This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) this device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation.
Bus Pirate 5 REV10
Firmware main branch (2024-04-25T10:18:08Z)
RP2040 with 264KB RAM, 128Mbit FLASH
S/N: 32104F0B33CC62E4
https://BusPirate.com/
Storage: 0.10GB (FAT16 File System)
Configuration file: Loaded
Available modes: HiZ 1-WIRE UART HDPLXUART I2C SPI 2WIRE DIO LED
Active mode:
Display format: Auto
Data format: 8 bits, LSB bitorder
Pull-up resistors: OFF
Power supply: ON (3.2V/3.29V)
Current limit: OK (6.4mA/0.0mA)
Frequency generators:
IO1: 3.571MHz, 50.00% duty cycle
1.Vout 2.IO0 3.IO1 4.IO2 5.IO3 6.IO4 7.IO5 8.IO6 9.IO7 10.GND
6.4mA RXTX PWM - - - - - - GND
3.3V 2.7V 3.6M 2.7V 0.0V 0.0V 0.0V 0.0V 0.0V GND
With the latest update to the buspirate firmware I reverted to the stock copy of pysim from osmocom, master branch no local edits.
Because buspirate in bridge mode with no options just worksā¦
So configure the buspirate into bridge mode (half duplex 9600 etc. ) AND exit what ever terminal program connected to the buspirate and then run pysim.
That was my mistake. I have to (1) use bridge, not bridge -s", (2) I have to use the ASCII port (/dev/ttyACM0) and not the binary port, and (3) I have to disconnect my terminal program from the BusPirate (I used Control-t q with tio). . However, Iām having trouble with the Sle4442 cards. I have a TMobile SIM card that works
pySIM-shell (no card)> equip
equip
Waiting for card...
Info: Card is of type: SIM
pySIM-shell (00:MF)> cardinfo
cardinfo
Card info:
Name: SIM
ATR: 3b3d95008067af030f017c060e833e9f16
ICCID: None
Class-Byte: a0
Select-Ctrl: 0000
AIDs:
pySIM-shell (00:MF)>
but thatās a different connectionā¦ Let me see if I can find a bad joint.
I am not using one of Ianās interface adaptors. I soldered a SIM card socket I had lying around to an soic to dip adaptor PCB. 5 connections, gnd, vcc/vpp, clock, data, reset.
If you are successfully seeing ATR but it fails after that, that can only be data going to the SIM card. After the ATR all data from SIM card is in response to requests to the SIM card.
Not sure what platform you are on, Linux,windows,macos.
Can you check that the port had not come up with flow control enabled. I deliberately exit from minicom WITHOUT resetting the serial port. On Linux stty -F /dev/buspirate-text will display current configurationā¦
If serial configured for flow control this could explain why SIM not getting request for data.
Ah no its a simcard utility. Just had to quickly look up SLE4442, they are memory cards. Sim cards have a processor on them (stating the obvious) so the utility is talking to the interface that the on card system exposes to the internals. Lots of standards.
The Mini socket works, but not the nano nor the full-size card.
I canāt test the micro card - as I don;t have a SIM of that size.
The Mini SIM cards I have are very old - so perhaps these work with the utility. The Nano is a modern SIM - so perhaps this explains why I canāt use pySym-shell test the card. Thanks for the clarification. I was growing very frustrated.