Dragos Iosub
Published

BeagleBone Black w. u-GSM modem Debian10 notes

Hardware (and software) notes and hints for itbrainpower. net u-GSM modem integration with BeagleBone Black..

AdvancedProtip2 hours160
BeagleBone Black w. u-GSM modem Debian10 notes

Things used in this project

Story

Read more

Schematics

BeagleBone Black with u-GSM modem + super-capacitor assembly

BeagleBone Black with u-GSM modem + super-capacitor assembly

BeagleBone Black with u-GSM modem + LiPO assembly

BeagleBone Black with u-GSM modem + LiPO assembly

Code

u-Env.txt

SH
BBB overlay
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
#disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
disable_uboot_overlay_wireless=1
disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768@60e

##enable Generic eMMC Flasher:
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

rc.config-itbp-u-GSM-modem

SH
#!/bin/sh -e
#
# rc.config-itbp-uGSM-modem v0.22
#
# This script configs the BBB ports for usage with the u-GSM modems [https://itbrainpower.net/u-GSM]
#
# Tested on BeagleBoard.org Debian Buster IoT Image 2020-04-06, kernel version 4.19.94-ti-r42 - the default image found shipped on new BBB
#
# This SOFTWARE is distributed is provide "AS IS" in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# itbrainpower.net invests significant time and resources providing those how to and in design phase of our IoT products.
# Support us by purchasing itbrainpower.net modems from https://itbrainpower.net/order#u-GSM
#
# Dragos Iosub, Bucharest 2023.
# https://itbrainpower.net
#!/bin/sh -e
#
# rc.config-itbp-uGSM-modem v0.22
#
# This script configs the BBB ports for usage with the u-GSM modems [https://itbrainpower.net/u-GSM]  
#
# Tested on BeagleBoard.org Debian Buster IoT Image 2020-04-06, kernel version 4.19.94-ti-r42 - the default image found shipped on new BBB
#
# This SOFTWARE is distributed is provide "AS IS" in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# itbrainpower.net invests significant time and resources providing those how to and in design phase of our IoT products.
# Support us by purchasing itbrainpower.net modems from https://itbrainpower.net/order#u-GSM
#
# Dragos Iosub, Bucharest 2023.
# http://itbrainpower.net
#

# next 3 lines, config P9_14, P9_16 and P9_12 as input pins WITHOUT pullings. 
# Those pins will be used as CONTROL interface for the ITBP modular modems.
sudo /usr/bin/config-pin P9_16 gpio_input #GPIO_51 ==> u-GSM pin STS
sudo /usr/bin/config-pin P9_14 gpio #GPIO_50 ==> u-GSM pin ENA
sudo /usr/bin/config-pin P9_12 gpio #GPIO_60 ==> u-GSM pin RST
  
#next four lines, config the P9_11 and P9_13 ports to be internally connected to UART4 [will be available under linux as /dev/ttyO4]
cd /sys/devices/platform/ocp/ocp:P9_11_pinmux*/
echo uart > state
cd /sys/devices/platform/ocp/ocp:P9_13_pinmux*/
echo uart > state

exit 0

ITBP-gpioBBB.py

Python
#ITBP_gpioBBB.py v022 - RPI.GPIO helper file for ITBP u-GSM modems and modular modems - [Debian 10] port
#COPYRIGHT (c) 2017-2023 Dragos Iosub / R&D Software Solutions srl
#
#You are legaly entitled to use this SOFTWARE ONLY IN CONJUNCTION WITH ITBP u-GSM modems or with ITBP MODULAR MODEMS DEVICES USAGE
#[l-LTE, c-uGSM, h-nanoGSM and d-u3G shileds]. Modifications, derivates and redistribution of this software must include unmodified this COPYRIGHT NOTICE.
#You can redistribute this SOFTWARE and/or modify it under the terms of this COPYRIGHT NOTICE. Any other usage may be permited only after written
#notice of Dragos Iosub / R&D Software Solutions srl.
#
#This SOFTWARE is distributed is provide "AS IS" in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
#warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
#Dragos Iosub, Bucharest 2023.
#https://itbrainpower.net
###############################################################################################################################################################
#ITBP_gpioBBB.py v022 - RPI.GPIO helper file for ITBP u-GSM modems and modular modems - [Debian 10] port 
#COPYRIGHT (c) 2017-2023 Dragos Iosub / R&D Software Solutions srl
#
#You are legaly entitled to use this SOFTWARE ONLY IN CONJUNCTION WITH ITBP u-GSM modems or with ITBP MODULAR MODEMS DEVICES USAGE
#[l-LTE, c-uGSM, h-nanoGSM and d-u3G shileds]. Modifications, derivates and redistribution of this software must include unmodified this COPYRIGHT NOTICE.
#You can redistribute this SOFTWARE and/or modify it under the terms of this COPYRIGHT NOTICE. Any other usage may be permited only after written
#notice of Dragos Iosub / R&D Software Solutions srl.
#
#This SOFTWARE is distributed is provide "AS IS" in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
#warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
#Dragos Iosub, Bucharest 2023.
#https://itbrainpower.net
###############################################################################################################################################################

###############################################################################################################################################################
#next, configs required for u-GSM modems (uFL) connected via u-GSM BBB interface [https://itbrainpower.net/images/u-GSM-top-03-pinout_1200px.jpg]
#or, u-GSM SMA version / ITBP MODULAR MODEMS conected via ITBPMM using wires [https://itbrainpower.net/a-gsm/BBB_u-GSM_Debian10_notes#wires]
###############################################################################################################################################################
# Edit the "uGSM2_19_hw_control.py" - "*********_hw_control.py" for other modems - file [mcedit uGSM2_19_hw_control.py] and replace the line 17":
# import RPi.GPIO as GPIO with:
# import ITBP_gpioBBB as GPIO
#
# Edit the "globalParVar.py" file [mcedit globalParVar.py] and set the "CONTROL interface for the ITBP modems" as bellow:
#   RESET = "P9_14"
#   POWER = "P9_16"
#   STATUS = "P9_12"
#
# Edit the "globalParVar.py" file [mcedit globalParVar.py] and replace the line
#   SERIALPORT = "/dev/ttyAMA0" with
#   SERIALPORT = "/dev/ttyO4"
#
# If previous line not found (for older version of python support files - mainly for ITBP MODULAR MODEMS, edit the "******GSM_Serial_Lib.py" file
# [mcedit ******GSM_Serial_Lib.py] and replace the line":
#   agsm = serial.Serial("/dev/ttyAMA0", serialSpeed, timeout=1) with:
#   agsm = serial.Serial("/dev/ttyO4", serialSpeed, timeout=1)
#
###############################################################################################################################################################

import subprocess
ports   = ['P9_12','P9_14','P9_16','P9_18']
mapping = {'P9_12':'gpio60','P9_14':'gpio50','P9_16':'gpio51','P9_18':'gpio4'}
gpioPath = '/sys/class/gpio/'
configPin = '/usr/bin/config-pin'

#some definitions, do not change

OUT     ='out'
IN      ='in'
HIGH    = 1
LOW     = 0
BOARD   = 1 #just 4 compatibility with RPi.GPIO
dirmap = {'out':1,'in':0}

def output(port, value):
    p = subprocess.Popen('echo '+str(value)+' > '+gpioPath+mapping[port]+'/value', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    out, err = p.communicate()
    #print str(out)
    #print str(err)

def setup(port, direction, initial=-100):
    p = subprocess.Popen(configPin+' '+str(port)+' '+str(direction), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    out, err = p.communicate()
    #print out
    #print err
    if (initial > -100):
        output(port, initial) #write initial state
        
def input(port):
    p = subprocess.Popen(['cat',gpioPath+mapping[port]+'/value'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    out, err = p.communicate()
    #print out
    #print err
    try:
        return int(out)
    except:
        return -100
    #print str(out)
    #print str(err)

def cleanup():
    global ports
    for port in ports:
        setup(port, 'in', -101)# input float


#just 4 compatibility with RPi.GPIO
def setmode(whatever):
    return

#just 4 compatibility with RPi.GPIO    
def setwarnings(whatever):
    return
    

Credits

Dragos Iosub

Dragos Iosub

28 projects • 18 followers
Electronics & software, electronics & software, ...

Comments