GithubHelp home page GithubHelp logo

gmx_pi_hat's Introduction

GMX_PI_HAT

The GMX PI HAT brings the GMX module interface to the Raspberry PI world, opening this platform to the GMX IoT modules world. As you can see from the picture with this HAT your Raspberry PI can use two GMX modules.




The HAT simply bring the PI GPIOS over to the GMX connectors and adds a dual IC2 UART interface based on the NXPSC16752 chip.
The HAT works with the 40 Pins PI extension board - so (very) old versions of the PI won't be compatible.
Full schematics are coming as well...

How to Configure your PI with Raspian

You need to add support for the NXPSX16752 chipset before being able to use the board. This, hopefully, should be quite easy.
We have been testing the latest Raspian release Stretch ( as of August 2017).
As we are using the I2C version of the chip so first of all you need to enable I2C on the PI ( if you haven't yet done it)

sudo raspi-config
  • Choose Interfacing options.
  • Choose I2C Enable/Disable automatic loading.
  • Follow the prompts to set this to load this automatically.
  • Reboot the Pi.

Then install the I2C utilities

sudo rpi-update
sudo apt-get update 
sudo apt-get install -y i2c-tools

and let's test if you can identify the GMX PI HAT.
sudo i2cdetect -y 1

You should see a device at address 0x4D.


Now let's add the kernel support for the SC16IS752.

Edit the module files

sudo nano /etc/modules 

Add at the bottom the line

sc16is7xx

You should have something like this:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

i2c-dev
sc16is7xx

The we need to create the Device Tree Overlay sc16is752-i2c.dts.
By default the SPI version is already present but not the I2C one ( thanks to MaterWuff ) here are the steps.

Create the file

sudo nano sc16is752-i2c.dts

and copy this content:

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; // Depending on your RPi Board Chip
    
    fragment@0 {
        target = <&i2c1>;
        
        frag1: __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;
            status = "okay";

            sc16is752: serial@4d {
                compatible = "nxp,sc16is752";
                reg = <0x4D>; // i2c address
                clocks = <&sc16is752_clk>;
                interrupt-parent = <&gpio>;
                interrupts = <17 0x2>; //GPIO and falling edge
                gpio-controller;
                #gpio-cells = <0>;
                i2c-max-frequency = <400000>;
                status = "okay";
            };
        };
    };

    fragment@1 {
        target-path = "/";

        __overlay__ {
            sc16is752_clk: sc16is752-clk {
                compatible = "fixed-clock";
                clock-frequency = <1843200>;
                #clock-cells = <0>;
            };
        };
    };

    __overrides__ {
        int_pin = <&sc16is752>,"interrupts:0";
    };
};

The GMX PI HAT has i2c address at 0x4D and interrupt pin GPIO 17.

Now we need to create the DTBO overlay file ( and you need kernel > 4.4 - use 'uname -r' to check).

dtc -@ -I dts -O dtb -o sc16is752-i2c.dtbo sc16is752-i2c.dts

If there is a warning, like this...

sc16is752-i2c.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property 

Its fine..

and copy it to the overlay folder

sudo cp sc16is752-i2c.dtbo /boot/overlays/

and finally activate in the /boot/config.txt.
Add the line: dtoverlay=sc16is752-i2c ( usually at the bottom of the file)
Add the beginning of the config.txt file the 'debug on': dtdebug=on ( once everything works you can remove this)


Reboot your PI.

Let's check if everything works:

lsmod

you should see the file 'sc16is7xx'
then..

sudo vcdbg log msg

and you should find the "Loaded overlay 'sc16is752-i2c'" line

and finally...

ls โ€“l /dev/ttyS*

And you should see the additional UART ports for the 2 GMX modules:

  • /dev/ttySC0
  • /dev/ttySC1

The HAT is configured and working!

Pinout RaspberryPI / GMX Slots

Here is the table showing the connection between the RapsberryPI GPIO ports and the GMX Slots.

Some example Code

In this repo we will add differnt examples to use our GMX modules.
The first 'basic' example is for the LoRaWAN GMX-LR1 module gmx_lr1.py, this is a first version of the python code to make a LoRaWAN connection.
The gmx_nbiot.py is an example file to run the GMX-NBIoT module with configuration for Deutsche Telekom network.
The gmx_catm1.py is an example file to run the GMX-CATM1 module with configuration for Swisscom network.

These examples are still quite rough but they work!
To make them work you need to install python-serial module:

 sudo apt-get install python-serial


Stay tuned for updates and feel free to change it as you wish, and if you want to contribute you are very welcome!

Contact

If you want additional info please contat us at [email protected]

gmx_pi_hat's People

Contributors

afaerber avatar gimasi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.