lmic-rpi-lora-gps-hat icon indicating copy to clipboard operation
lmic-rpi-lora-gps-hat copied to clipboard

Resource busy

Open Nanne118 opened this issue 6 years ago • 5 comments

resourcebusy

On a fresh install of Raspbian stretch with the Dragino GPS / Lora HAT I get this error message: resource busy. How do I resolve this?

Nanne118 avatar May 16 '18 00:05 Nanne118

The lmic-rpi-lora-gps-hat code will try to "unexport" the BCM pins 4, 23 and 24 before "exporting" them again. If there is an issue with "unexporting", then no error message will be printed, as in most cases it is not necessary to "unexport" the pins, if the where not used by another application.

Please try the following:

Check if the pins are already exported. Which subdirectories exist in directory /sys/class/gpio ? Is there a subdirectory named gpio4 ?

ls -l /sys/class/gpio

If there is a gpio4 directory, try to "unexport" it manually. What happens?

echo 4 > /sys/class/gpio/unexport echo 23 > /sys/class/gpio/unexport echo 24 > /sys/class/gpio/unexport

wkl3nk avatar May 16 '18 06:05 wkl3nk

Oddly enough there does not appear to be a subdirectory named gpio 4, though I am sure I installed WiringPi on my Rpi as gpio -v returns the wiringpi prompt. Maybe I am running a wrong version (wrong source) of WiringPi?

resourcebusy2

Nanne118 avatar May 16 '18 11:05 Nanne118

WiringPi has nothing to do with the issue. This GPIO support by means of a directory structure is provided by the Linux kernel.

You get the error message "write error: Invalid argument", so in fact your "pi" user should be permitted to write to this file /sys/class/gpio/unexport. If it NOT had the permission, you would get a "Permission denied" error message. So your "pi" user seems to be in group "gpio". Could you please cross check and find out the groups the user "pi" belongs to by using the "groups" command?

$ groups

Next, let's assume you got the "Invalid argument" error message, because pin 4 wasn't actually exported. Let's try to export these ports by giving these commands:

$ echo 4 > /sys/class/gpio/export
$ echo 23 > /sys/class/gpio/export
$ echo 24 > /sys/class/gpio/export

wklenk avatar May 16 '18 11:05 wklenk

i have had the same issue, the pins in the code are matching the dragino gpsHat v1.4. You just need to check how the hat sits on the pins. if it doesn't sit properly, it makes a short circuit and thus cannot see gpio4.

simortus avatar Jul 11 '20 10:07 simortus

i have had the same issue, the pins in the code are matching the dragino gpsHat v1.4. You just need to check how the hat sits on the pins. if it doesn't sit properly, it makes a short circuit and thus cannot see gpio4.

same issue here , have you solved in other way ?

epasinetti avatar Dec 19 '20 21:12 epasinetti