cdsteinkuehler / beaglebone-universal-io

Device tree overlay and support scripts for using most available hardware I/O on the BeagleBone without editing dts files or rebuilding the kernel
GNU General Public License v2.0
127 stars 54 forks source link

Extending wiki - how to automate "config-pin P9.28 spi" command #41

Closed rifotu closed 7 years ago

rifotu commented 8 years ago

Hello,

Can we add how to automate the config-pin commands . I have tried using /etc/rc.local Initd Monit But for some reason I wasnt able to have the system work reliably. ( I am using the latest debian wheezy image)

Can you please add this info to wiki? Thanks a lot Rifo

rifotu commented 8 years ago

Hello,

I have done some more trials. It seems that I need to insert a delay of 7 seconds in the application itself before issuing the "config-pin P9.30 spi" command from the application itself. without the delay, P9.30 pin stays in default mode.

mvduin commented 7 years ago

To reduce boot time, systemd (the init system used on beaglebone debian images) starts services in parallel as much as allowed by the ordering constraints specified by those services.

To ensure you can use config-pin you need to add a constraint ordering your service after the one which loads cape-universal, which is generic-board-startup.service.

A minimal service file for doing one-time setup would be something like

[Unit]
Description=insert description here

After=generic-board-startup.service

[Install]
WantedBy=multi-user.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/path/to/executable and arguments
rifotu commented 7 years ago

great! thanks a lot for your help