It looks like you're new here. If you want to get involved, click one of these buttons!
@jks, hi John! How is the PE4312 attenuator controlled in the new KiwiSDR? Directly via GPIO or via FPGA? On Aliexpress, you can purchase a ready-made attenuator board based on HMC472 with the same control as PE4312. But the bits are inverted as I understood. How realistic will it be to use such a board with the old KiwiSDR and adjust the gain using the new KiwiSDR2 software?
Also on Aliexpress there are ready-made boards with an attenuator RE4302, which are analogous to PE4312.
Via the FPGA. But I use the 3-wire serial interface to the PE4312, not the 6-wire parallel interface. The PE4302 and HMC472 are older parts that only have the parallel interface.
That's not to say that we couldn't have a parallel interface option for driving these boards on Kiwi-1, say on the P8 connector. Probably via GPIO since that's how most of the P8 pins are driven now (e.g. for the antenna switch GPIO driver).
Thanks for the answer! However, the PE4302 has a serial control bus. But it doesn't matter now. We won't be able to connect it to the FPGA on the first version of KiwiSDR. Or the new KiwiSDR2 software should have support for an external attenuator.
Okay, I missed that about the PE4302. Well there no reason the serial and/or parallel interface can't be supported on Kiwi-1 via GPIO. It's just a software change. I only did it on Kiwi-2 via FPGA signals so as not to consume any additional GPIOs. The new GPS front end chip has a serial interface as well.
Thank you John! Now there is hope of upgrading KiwiSDR 1. There are attenuators that are controlled via USB. But the price is high.
I'd definitely be interested in an external attenuator that makes use of that RF user setting on the Kiwi.
I have planned on adapting the antenna switch extension to be able to switch a step attenuator, but have yet to get around to it.
I ordered a PE4302 attenuator board on Aliexpress. But, if you look at the photos, unfortunately, it is impossible to use a serial control bus. The leads are soldered to the mass. Therefore, it will be possible to use only a parallel control bus.
But in any case, to connect an external attenuator, John needs to add this function to the software.
To connect the PE4302 parallel bus, you can use an existing I2C bus and a digital output expander. For example PCF8574. Then only 4 wires will be needed to connect an external attenuator.
I got the PE4302 attenuator board. I also have a STM32 blue pill board for management. I have configured everything and now the attenuator is controlled via STM32, which will be connected to KiwiSDR only via USB connector. A virtual COM port is created in Linux. To configure the attenuator, it will be enough to send the command "Gain:25.5" to the COM port. I found that the current gain setting is in the kiwi.json file. Is there a way to get this value without using this file? I don't understand Linux well, but maybe there is some variable that takes the gain value in real time?
Where do you need that variable?
In bash you could do something like
attenuation=`jq '.init.rf_attn' kiwi.json`
# echo $attenuation
Thanks! If I run this command 10 times a second, nothing will break? There will be a constant reading of one file, which may affect reliability.
Well it is read once, so, you would have to define it every time before you read the variable. Or you could do:
jq -r '.init.rf_attn' kiwi.json
One query requires 33 ms CPU time on my BBG, So you might run into a performance problem if you do that 10 times per second.
To save ressources you could test first if the config file changed, I would have to try how much cpu time that requires.
But I guess if John will implement some sort of AGC, he would use a different approach than the config file.
Thank you very much! I think many KiwiSDR users of the first version will want to use an external attenuator. The simplest option is to connect via USB (virtual COM port). It would be great if John added such a feature to the KiwiSDR 2 software. Just something like Serial.print("Att:12.5"). But until this is implemented, I have to act in the wrong ways!
The kiwi.json config file value (init.rf_attn) is not the current attenuator value. It is the initial value of the attenuator if there is no cookie value for the current Kiwi. Just like all the other init.* values. See the top section of the admin config tab.
You don't want to be doing any sort of scheme that involves shell scripts or maybe even device polling as this may severely impact the Kiwi realtime response. Just wait for me to add something to the Kiwi server code to support this for Kiwi 1.
Believe me, now is not the time for me to be looking into this. I've got 5000 other things on my plate at the moment.
John, thank you again for your work! You're doing impossible things! We will not distract you from your main work. I just want to do some research into the work of the attenuator. And so far the only way to get rf_attn values from a json file. Moreover, these values are set and changed by the slider on the admin panel. Thanks again!
Yes, but again, this a value that is used only for first time user initialization. When you move the slider on the user RF tab the kiwi.json value doesn't change (or at least it shouldn't). However, you can obviously use it the way you describe if you want.
It looks like a periodic reading of the kiwi.json file causes the system to crash. I did this with the original KiwiSDR and with a Chinese clone. And I don't want to do it again ))) Well, I will look for other ways.
Can you be more precise about what "the system crashing" means?
The web interface and the admin settings page stopped working on the original Kiwi. At the same time, ssh access was still available. sudo reboot partially solved the problem. But the Internet has become very slow. The web interface opened for about 30 seconds. The admin settings page opened just as slowly. At the same time, two other receivers in the same room did not experience problems with the Internet. The problem with internet speed recovered one day after Kiwi received updates.
After that, I performed the same actions on the Flydog SDR clone and got the same result. The difference is that the web interface continued to work, but the Internet speed dropped significantly and led to the same results as I described above. And at the same time, the other two receivers also continued to work perfectly. Only a complete shutdown and power on restored normal operation.
Most likely reading a kiwi file.json could not cause such a problem and this is a coincidence. But very strange. I am using frpc reverse proxy on all three receivers. Maybe the problem was because of it. I'm not sure.
I place a syslog of clone. It begins in 13:40.
I haven't connected anything to the USB port yet and haven't used any additional software. I bought an esp8266 board. It is cheaper than stm32 and has all the necessary functions. Maybe I'll connect an attenuator in the weekend.
I have everything set up and connected. It works!