Skip to content

Instantly share code, notes, and snippets.

@brettbeeson
Created January 12, 2024 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettbeeson/864e72bdb21e4e6a80e37c562aba65af to your computer and use it in GitHub Desktop.
Save brettbeeson/864e72bdb21e4e6a80e37c562aba65af to your computer and use it in GitHub Desktop.
Find the bands a SIM7670 modem is using based on reported output from AT+CNBP?
import sys
#
# Find the bands a SIM7670 modem is using
# First, get the LTE bitcode from via the command
# AT+CNBP?
# The second number is the LTE bands in bitcode format
# The number is a 64-bit hex number from the command-line (such as 0X00010A000 or 0X00010A000)
# This script will parse it and display the bands indicated
# Lookup
# A76XX_Series_AT_Command_Manual_V1.09.pdf
#
lte_modes = '''
0 EUTRAN_BAND1(UL:1920-1980; DL:2110-2170)
1 EUTRAN_BAND2(UL:1850-1910; DL:1930-1990)
2 EUTRAN_BAND3(UL:1710-1785; DL:1805-1880)
3 EUTRAN_BAND4(UL:1710-1755; DL:2110-2155)
4 EUTRAN_BAND5(UL: 824-849; DL: 869-894)
5 EUTRAN_BAND6(UL: 830-840; DL: 875-885)
6 EUTRAN_BAND7(UL:2500-2570; DL:2620-2690)
7 EUTRAN_BAND8(UL: 880-915; DL: 925-960)
8 EUTRAN_BAND9(UL:1749.9-1784.9;DL:1844.9-1879.9)
9 EUTRAN_BAND10(UL:1710-1770; DL:2110-2170)
10 EUTRAN_BAND11(UL:1427.9-1452.9; DL:1475.9-1500.9)
11 EUTRAN_BAND12(UL:698-716; DL:728-746)
12 EUTRAN_BAND13(UL: 777-787; DL: 746-756)
13 EUTRAN_BAND14(UL: 788-798; DL: 758-768)
16 EUTRAN_BAND17(UL: 704-716; DL: 734-746)
17 EUTRAN_BAND18(UL: 815-830; DL: 860-875)
18 EUTRAN_BAND19(UL: 830-845; DL: 875-890)
19 EUTRAN_BAND20(UL: 832-862; DL: 791-821)
20 EUTRAN_BAND21(UL:1447.9-1462.9; DL: 1495.9-1510.9)
22 EUTRAN_BAND23(UL: 2000-2020; DL: 2180-2200)
23 EUTRAN_BAND24(UL: 1626.5-1660.5; DL: 1525 -1559)
24 EUTRAN_BAND25(UL: 1850-1915; DL: 1930 -1995)
25 EUTRAN_BAND26(UL: 814-849; DL: 859 -894)
26 EUTRAN_BAND27(UL: 807.5-824; DL: 852 -869)
27 EUTRAN_BAND28(703-748; DL: 758-803)
28 EUTRAN_BAND29(UL:1850-1910 or 1710-1755; DL:716-728)
29 EUTRAN_BAND30(UL: 2305-2315 ; DL: 2350 - 2360)
30 EUTRAN_BAND31(UL: 452.5-457.4; DL:462.5–467.4)
32 EUTRAN_BAND33(UL: 1900-1920; DL: 1900-1920)
33 EUTRAN_BAND34(UL: 2010-2025; DL: 2010-2025)
34 EUTRAN_BAND35(UL: 1850-1910; DL: 1850-1910)
35 EUTRAN_BAND36(UL: 1930-1990; DL: 1930-1990)
36 EUTRAN_BAND37(UL: 1910-1930; DL: 1910-1930)
37 EUTRAN_BAND38(UL: 2570-2620; DL: 2570-2620)
38 EUTRAN_BAND39(UL: 1880-1920; DL: 1880-1920)
39 EUTRAN_BAND40(UL: 2300-2400; DL: 2300-2400)
40 EUTRAN_BAND41(UL: 2496-2690; DL: 2496-2690)
41 EUTRAN_BAND42(UL: 3400-3600; DL: 3400-3600)
42 EUTRAN_BAND43(UL: 3600-3800; DL: 3600-3800)
'''
def bands():
retval = {}
for l in lte_modes.splitlines():
if len(l)>0:
n,band = (l.split(" ",1))
retval[int(n)]=band
return retval
if len(sys.argv)!=1+1:
print("provide 64-bit hex number such as 0X00010A000 or 0X00010A000 LTE bitcode from AT+CNBP? on a SIM86XX")
exit(1)
# first arg, zeroth is program name
# parse as hex
lte_bitcode = int(sys.argv[1],16)
print(f"{sys.argv[1]}\n{hex(lte_bitcode)}\n{bin(lte_bitcode)}\n")
for n,band in bands().items():
#print(bin(1 << n) + " " + band)
if (1 << n & lte_bitcode):
print (band)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment