OH1KK / KiwiSDR-antenna-switch-extension

KiwiSDR antenna switch extension
MIT License
27 stars 13 forks source link

KiwiSDR antenna switch extension init after restart failed #19

Closed dl2sba closed 7 years ago

dl2sba commented 7 years ago

I found one issue with this extension.

After restart of the Kiwi server (for example after FW update) the extension isn't working. You have to reboot the beagle bone to get it working.

In the web interface the buttons can be clicked, but they stay white and no change on the GPIO pins.

Running v1.128

dl2sba commented 7 years ago

With latest v1.132 still the same problem.

OH1KK commented 7 years ago

GPIO things are defined in /root/extensions/ant_switch/backends/ant-switch-backend-beagle-gpio file. There are line

SAFEGPIOS=(45 44 23 26 47 46 27 65 22 61)

Which defines what GPIO's are used by atenna switch.

P8 pin 11 - GPIO_45 - Antenna 1 P8 pin 12 - GPIO_44 - Antenna 2 P8 pin 13 - GPIO_23 - Antenna 3 P8 pin 14 - GPIO_26 - Antenna 4 P8 pin 15 - GPIO_47 - Antenna 5 P8 pin 16 - GPIO_46 - Antenna 6 P8 pin 17 - GPIO_27 - Antenna 7 P8 pin 18 - GPIO_65 - Antenna 8 P8 pin 19 - GPIO_22 - Antenna 9 P8 pin 26 - GPIO_61 - Antenna 10

Some of those GPIO's most likely conflict with KiwiSDR on boot time. Unfortunately I do not have spare KiwiSDR hardware to debug this problem. My only KiwiSDR is "on production" and located offsite.

There a are discussions about safe GPIO's on http://valentfx.com/vanilla/discussion/590/kiwisdr-antenna-switch-extension-and-beaglebone-black-green-gpios

If you have hardware on our hands, you can try modify /root/extensions/ant_switch/backends/ant-switch-backend-beagle-gpio file and change used GPIO pins

SAFEGPIOS=(45 44 23 26 47 46 27 65 22 61)

GPIO's 39 - 46 might have confict with boot, so you could try for example

SAFEGPIOS=(23 26 47 46 27 65 22 61)

Please tell if this works better?

dl2sba commented 7 years ago

Tnx Kari for feedback

I think the reboot is not the problem, because all works fine when I completely reboot the device.

The init fails, when only the Kiwi-SW is restarted - i.e. in case of an firmware upgrade.

This looks for me more as an init problem of the extension - your thoughts?

OH1KK commented 7 years ago

I use MS-S7-WEB backend and I do not have problems in update. So this must somehow to be related gpio backend.

Maybe KiwiSDR restart changes GPIO settings (direction out->in). I don't know. I tried to change AntSW_Initialize() function. Could you try this one?

https://raw.githubusercontent.com/OH1KK/KiwiSDR-antenna-switch-extension/master/backends/ant-switch-backend-beagle-gpio

dl2sba commented 7 years ago

Now I get this in the log

Sat Oct 28 11:35:53 2017 0:01:33 0... ### ant_switch_msgs RX0 Sat Oct 28 11:35:53 2017 0:01:34 0... ### ant_switch_msgs RX0 Sat Oct 28 11:35:53 2017 0:01:34 0... ant_switch_queryantenna BAD STATUS? <?0> Sat Oct 28 11:35:56 2017 0:01:37 0... ### ant_switch_msgs RX0 Sat Oct 28 11:35:56 2017 0:01:37 0... ### ant_switch_msgs RX0 Sat Oct 28 11:35:56 2017 0:01:37 0... ant_switch_queryantenna BAD STATUS? <?0>

and now its even not working after complete system reboot ...

OH1KK commented 7 years ago

Strange. I cannot reproduce problem. Does antenna swiching work from ssh console? Do you see errors?

/root/extensions/ant_switch/frontend/ant-switch-frontend s /root/extensions/ant_switch/frontend/ant-switch-frontend 1

dl2sba commented 7 years ago

Shame on me - I just forgot chmod 755: - /

Now it works, but I want to watch it during the next days.