Skip to content

SW_Debug

Rolf Obrecht edited this page Aug 3, 2023 · 3 revisions

General hints

Use logging

If piTelex refuses to work properly, it is generally a good idea to use the logging options described in SW_DebugLog to locate the problem. Also increasing the verbosity of log output can be helpful.

Check the config file for errors

A common reason for a malfunction are syntax errors in the config file (telex.json by default).

  • Check exactly the correct bracket pairings! Often the first opening bracket (just before "devices") got deleted by accident.

  • Also make sure that entries within a bracket pair must be separated by a comma except the last one which is followed immediately by the closing bracket. This applies to all nesting levels!

  • strings must be enclosed in quotes, numbers and logical values true, false not. E.g.

    "option_name" : "String",
    "option_number": 12345,
    "option_bool" : true 
    

Also take into account that misspelled option names are slightly ignored - without warning or error message. If you set

 "baudrat" : 100,

instead of

 "baudrate" : 100,

piTelex will discard the line and silently use the default baud rate of 50Bd without warning.


What to do if...

...installation fails

If piTelex throws error messages after initial installation, check the following items:

  • Try to generate a tailored telex.json according to the Configuration Guide. Be sure to call telex.py from the directory it lives in; this directory must also contain the actual telex.json by default. If location or name of your configuration file differs from this default, you must specify it by the cmdline arg -c <path-to-cfg-file>.

  • Chances are that the default (file and directory) paths in the default telex.json and even in your newly generated configuration file do not meet your local environment. Be sure to adapt them to your needs: edit the file by hand.

  • Some device modules require additional python modules to be available. These are documented in the module's source code, in this wiki's module description and also in the full blown examples for telex.json. Take care to have all of these modules properly installed.

  • Depending on your OS and distribution, there are several ways to install python modules:

    • by system tools (sudo apt install <pkgname>)

    • by the python installer pip or pip3 as root user (sudo pip install <module>)

    • by pip or pip3 as normal user (pip install <module>)

    • (...)

    If in doubt, you should figure out which of these methods work for your environment ....

  • Try to disable all hardware device modules, so that a mere software telex (module screen) is left, and monitor the change in behaviour. Or try to disable all but hardware modules (Log,i-Telex,Twitter,....) and monitor the change in behaviour. This might give you a better idea of the error reason (hopefully...).


... you are unable to set piTelex to a functional Baud rate when using Raspberry's GPIO

This is a rare problem, but has indeed been reported. The daemon PIGPIOD, which does the timing for the baud rate in this setup, uses a hardware timer that may be used and changed by another (unknown) process, so that piTelex uses a wrong timing base. The solution is to tell piTelex to use a different hardware timer. The option -t can be used to achieve this. From the manual page:

       -t value
              Clock peripheral.  0=PWM 1=PCM.  Default PCM.  pigpio uses one
              or both of PCM and PWM. (...)

To change the timer for pigpiod, do the following:

Edit the configuration for the daemon:

   sudo systemctl edit pigpiod

to add the lines

 [Service]
 ExecStart=
 ExecStart=/usr/bin/pigpiod -l -t 0

in the allowed area of the file, so that it finally has the following content:

### Editing /etc/systemd/system/pigpiod.service.d/override.conf
### Anything between here and the comment below will become the new contents of>

[Service]
ExecStart=
ExecStart=/usr/bin/pigpiod -l -t 0

### Lines below this comment will be discarded

### /lib/systemd/system/pigpiod.service
# [Unit]
# Description=Daemon required to control GPIO pins via pigpio
# [Service]
# ExecStart=/usr/bin/pigpiod -l
# ExecStop=/bin/systemctl kill pigpiod
# Type=forking
# [Install]
# WantedBy=multi-user.target

This makes piTelex use timer 0 instead of the default timer 1.

Save the file and restart the daemon or the whole system so that the changes take effect.

Good luck!

Clone this wiki locally