Closed qrp73 closed 5 months ago
The gpio api used is deprecated, should be changed to newer API. I don't know if Johan already did this, I have made an update, but still testing it. There are some more kernel changes that need to be checked.
// line 83 add:
static struct gpio_desc *gpio_desc; // top of the file
// line 300 replace gpio part with :
gpio_desc = gpio_to_desc(gpioRxSamplesiPin);
if (!gpio_desc) {
printk("Failed to get GPIO descriptor\n");
return -ENODEV;
}
retval = gpiod_direction_input(gpio_desc);
if (retval) {
printk("Failed to set GPIO pin direction\n");
return retval;
}
printk(KERN_INFO "Radioberry: The rx sample state is currently: %d\n", gpio_get_value(gpioRxSamplesiPin));
// GPIO numbers and IRQ numbers are not the same! This function performs the mapping for us
// Get the IRQ number for the GPIO pin
irqNumber = gpiod_to_irq(gpio_desc);
if (irqNumber < 0) {
printk("Failed to get IRQ number for GPIO pin\n");
return irqNumber;
}
// line 351 replace gpio_unexport with: gpiod_put(gpio_desc);
could you please share all changes?
I tried to apply changes mentioned above to my repository: https://github.com/qrp73/Radioberry-2.x But it don't works, the driver is crashed during system boot. I'm using v8 kernel (aarch64 6.6)
I made a fix for kernel rpi6.6.y it is available in my fork of Radioberry 2.x https://github.com/paulh002/Radioberry-2.x I did not update the installation scripts, because I am not using those also I am not using the pihpsdr software, I use my own. Add the dtoverlay=radioberry is /boot/firmware/config.txt If there are issues you can report them in github on the fork in issues. If all is ok I will create a pull request for Johan.
Copy all the files from SBC/rpi-4/device_driver/driver execute:
cd Radioberry-2.x/SBC/rpi-4/device_driver/driver rm *.ko make sudo cp radioberry.ko /lib/modules/$(uname -r)/kernel/drivers/sdr
sudo dtc -@ -I dts -O dtb -o radioberry.dtbo radioberry.dts sudo cp radioberry.dtbo /boot/overlays
sudo reboot
@paulh002 I tried your changes in radioberry.c and radioberry.dts, with these changes driver is loaded ok and firmware can read gateware version, but it don't send samples to SDR application.
I am not using the firmware in my setup. Make sure the firmware has root privilege or allow access to the driver. I think for test you can run the firmware from commandline like sudo radioberry. Please share the output to analyse
I'm running the firmware from console, it starting as usual and shows correct gateware version. And I can connect with SDR application (pihpsdr and SDR++). But it don't send samples.
I'm using my mod for SDR++ with my HPSDR plugin: https://github.com/qrp73/Radioberry-2.x It allows to see measured downstream sample rate, I added it for debugging purposes. And it shows 0 kS/s. The firmware don't send samples.
I tried to reboot into old kernel image with working driver and it works with exactly the same conditions. I checked I2C it is enabled in Raspberry Pi configuration.
I think something is wrong with pins configuration...
I see that 22, 26, 27, 13, 24 pins config are removed from your version of radioberry.dts file. Is it possible that this is the root of cause why it don't send samples?
Radioberry V2.0
Supports 4 receivers and 1 transmitter.
Build version: 2022.01.24
Have fun Johan PA3GSB
Report requests or bugs to ***@***.***>.
Radioberry gateware version 73-3. No Alex, N2ADR or generic filters interface board connected to radioberry Radioberry amplifier config failed; only a problem if amplifier is installed. Radioberry, Starting packet rx part. Radioberry, Starting packet control part. Radioberry, Starting packet tx part. Discovery packet received SDR Program IP-address 192.168.88.17 Discovery Port 20000 Start Port 20000 SDR Program sends UDP Start command Your Radioberry is registered: http://www.pa3gsb.nl/radioberry/api/read.php
works fine for me. I test now with SDR Console
Op vr 15 mrt 2024 om 13:19 schreef qrp73 @.***>:
I'm running the firmware from console, it starting as usual and shows correct gateware version. And I can connect with SDR application (pihpsdr and SDR++). But it don't send samples.
I'm using my mod for SDR++ with my HPSDR plugin: https://github.com/qrp73/Radioberry-2.x It allows to see measured downstream sample rate, I added it for debugging purposes. And it shows 0 kS/s. The firmware don't send samples.
I tried to reboot into old kernel image with working driver and it works with exactly the same conditions. I checked I2C it is enabled in Raspberry Pi configuration.
I think something is wrong with pins configuration...
— Reply to this email directly, view it on GitHub https://github.com/pa3gsb/Radioberry-2.x/issues/54#issuecomment-1999548299, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIOBYUARV6XX7V56YYNGISTYYLRNHAVCNFSM6AAAAABERNSMKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJZGU2DQMRZHE . You are receiving this because you were mentioned.Message ID: @.***>
Yes, it started ok and shows correct gateware version (which means it can receive it from gateware). But it don't receive any samples from device. The software shows black waterfall and my stat in software shows that there is no EP6 UDP packets from firmware.
I do receive samples. So it has to be something local.
Op vr 15 mrt 2024 om 13:35 schreef qrp73 @.***>:
Yes, it started ok and shows correct gateware version (which means it can receive it from gateware). But it don't receive any samples from device. The software shows black waterfall and my stat in software shows that there is no EP6 UDP packets from firmware.
— Reply to this email directly, view it on GitHub https://github.com/pa3gsb/Radioberry-2.x/issues/54#issuecomment-1999572545, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIOBYUHESZBEM2GBWCWWO3DYYLTH5AVCNFSM6AAAAABERNSMKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJZGU3TENJUGU . You are receiving this because you were mentioned.Message ID: @.***>
it works, I tried to reboot after reinstalling the driver and now it sends samples :) Thanks for help
Yes, it needs a reboot
Op vr 15 mrt. 2024 13:45 schreef qrp73 @.***>:
it works, I tried to reboot after reinstalling the driver and now it sends samples :) Thanks for help
— Reply to this email directly, view it on GitHub https://github.com/pa3gsb/Radioberry-2.x/issues/54#issuecomment-1999591357, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIOBYUD7V7LNB3M4RVCEEEDYYLUPHAVCNFSM6AAAAABERNSMKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJZGU4TCMZVG4 . You are receiving this because you were mentioned.Message ID: @.***>
It works, but I think there is some issue with your code.
I notice that radioberry_init() is called before radioberry_probe() when loading driver on the fly with sudo modprobe radioberry
.
It means that this call:
result = request_irq(irqNumber,
(irq_handler_t) radioberry_irq_handler,
IRQF_TRIGGER_RISING, // Interrupt on rising edge RQF_TRIGGER_RISING
"radioberry_rx_irq", // Used in /proc/interrupts to identify the owner
NULL);
will be executed with not initialized irqNumber. Isn't it?
Probably this is the reason why it didn't send samples in my case. What is your thoughts?
as I read on internet, radioberry_init is called first, before radioberry_probe. That explains why it didn't worked for me. Is it possible to move request_irq() call to radioberry_probe() function?
Also if I understand correctly, gpiod_to_irq(gpio_desc)
can return 0 as valid IRQ. Isn't it?
If this happens, it will not request IRQ due to this condition:
if (irqNumber > 0) {
result = request_irq(irqNumber,
...);
}
is it correct?
Yes, you're right. We have to move the initialization to the probe function. The init is always executed even when probe fails. I will change it'
Op vr 15 mrt 2024 om 14:05 schreef qrp73 @.***>:
as I read on internet, radioberry_init is called first, before radioberry_probe. That explains why it didn't worked for me. Is it possible to move request_irq() call to radioberry_probe() function?
— Reply to this email directly, view it on GitHub https://github.com/pa3gsb/Radioberry-2.x/issues/54#issuecomment-1999624768, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIOBYUEXGVU7VN5P36PW5R3YYLW2RAVCNFSM6AAAAABERNSMKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJZGYZDINZWHA . You are receiving this because you were mentioned.Message ID: @.***>
I moved the code, you can have a look
Op vr 15 mrt 2024 om 14:05 schreef qrp73 @.***>:
as I read on internet, radioberry_init is called first, before radioberry_probe. That explains why it didn't worked for me. Is it possible to move request_irq() call to radioberry_probe() function?
— Reply to this email directly, view it on GitHub https://github.com/pa3gsb/Radioberry-2.x/issues/54#issuecomment-1999624768, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIOBYUEXGVU7VN5P36PW5R3YYLW2RAVCNFSM6AAAAABERNSMKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJZGYZDINZWHA . You are receiving this because you were mentioned.Message ID: @.***>
yes, it works. I also added some minor fixes to radioberry.c, see my repo: https://github.com/qrp73/Radioberry-2.x/blob/master/SBC/rpi-4/device_driver/driver/radioberry.c
I added support for both kernel version, so it can be compiled for old 6.1 and for 6.6 kernel: https://github.com/qrp73/Radioberry-2.x
Here is condition to check kernel version: https://github.com/qrp73/Radioberry-2.x/blob/e4789173aaab3f03c45f8f216095a2aed119c70a/SBC/rpi-4/device_driver/driver/radioberry.c#L255
@qrp73 can you test the latest driver version? We changed to polling instead of interrupts. This solved a stability issue I had using SoapyRadioberry
@paulh002 Test report. I found this thread when my Radioberry went dead after a reboot and the 6.6 kernel took effect. I've tried your repo and instructions, rebooted, then ran pa3qsb's install script and it's working again. I mostly use it with SDRConsole. Thank You.
Thanks!
Op zo 17 mrt 2024 om 02:37 schreef Jayson Bucknell @.***
:
@paulh002 https://github.com/paulh002 Test report. I found this thread when my Radioberry went dead after a reboot and the 6.6 kernel took effect. I've tried your repo and instructions, rebooted, then ran pa3qsb's install script and it's working again. I mostly use it with SDRConsole. Thank You.
— Reply to this email directly, view it on GitHub https://github.com/pa3gsb/Radioberry-2.x/issues/54#issuecomment-2002252301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIOBYUDCVHRY3FT2A5DV4ZLYYTXUHAVCNFSM6AAAAABERNSMKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSGI2TEMZQGE . You are receiving this because you were mentioned.Message ID: @.***>
solved
Today raspberry pi rolled out major apt update which upgrades kernel to 6.6. It breaks radioberry driver and it cannot be compiled anymore for both 32 and 64 versions.
compilation has 3 errors: 1) too many arguments for class_create(): Probably it can be fixed by removing first argument "THIS_MODULE," from the call.
2 and 3) functions gpio_export() and gpio_unexport() are not available anymore. It seems that it requires to use gpiod_export and gpiod_unexport but it uses different argument type and is not clear on how to use it:
Any info on how to fix it?