Keyboard Shortcuts
Likes
Search
Firmware : transmits band limits
Pierre Guillot
Is it possible to set limits in the firmware to prohibit transmission outside of ham bands limits as some countries like Thailand do not authorize the use of transceivers which can transmit outside of the ham bands. For exemple 80m goes from 3.5 to 3.6Mhz and 40m from 7.0 to 7.2Mhz, the other bands being more usual.
|
Pierre,
There is using KD8CEC software.? For the v6, this would mean changing the screen to a Nextion and then using the Memory Manager to set the required bands.? The Nextion Display would add approximately $28 US to the cost of the radio.? There are also some small hole enlargements of the Nextion Display to allow it to fit the stock case supplied with the full kit.? Then the software changes. One question back, how do these countries handle building your own transmitters?? With the KD8CEC software, I could go back and remove the restrictions with a simple change of one value.? 73 Evan AC9TU AC9TU |
toggle quoted message
Show quoted text
On Mar 26, 2021, at 19:20, Pierre Guillot <jb.gallauziaux@...> wrote:
|
Pierre Guillot
Another question about KD8CEC software : le last 1.20 supports uBITX v5 and the current kit is v6. Is the new v6 version supported by KD8CEC? My questions may look quite unwise to hams, who know perfectly this project but I'm quite lost with such an enormous amount of data. What I would like to do is to have a uBITX transceiver in which I could set limits to the bands in which I can transmit.
73 - Pierre - FK8IH |
Pierre Guillot
Gordon,
Thanks for your answer. I understand I could code it in myself as it is pretty easy. I looked at the github afarhan//ubitx and its KD8CEC fork but did not find which .ino or .h or .cpp file I should modify to set usable hambands and their edges. Could you help and show me which file(s)? 73 - Pierre - FK8IH |
开云体育Sorry. The last time I looked at this code was probably two years ago and I’ve only looked at the standard code from Ashhar; but dive in there, and modify it however you need. It’s sort of a limited version of C and with a bit of reading and experimentation you can figure it out. That’s the beauty of this kind of a radio, you can adjust it however you need.On Mar 27, 2021, at 03:40, Pierre Guillot <jb.gallauziaux@...> wrote:
|
Pierre,
First off, can you tell us which version of the ?BITX you have? Regardless, I do believe that all of the software versions have a startTX(byte txMode) function in the main tab of the program. Here is the section from the v6 code: =============================================================================================== void startTx(byte txMode){
? unsigned long tx_freq = 0;??
? ??
? digitalWrite(TX_RX, 1);
? inTx = 1;
??
? if (ritOn){
? ? //save the current as the rx frequency
? ? ritRxFrequency = frequency;
? ? setFrequency(ritTxFrequency);
? }
? else?
? {
? ? if (splitOn == 1) {
? ? ? if (vfoActive == VFO_B) {
? ? ? ? vfoActive = VFO_A;
? ? ? ? isUSB = isUsbVfoA;
? ? ? ? frequency = vfoA;
? ? ? }
? ? ? else if (vfoActive == VFO_A){
? ? ? ? vfoActive = VFO_B;
? ? ? ? frequency = vfoB;
? ? ? ? isUSB = isUsbVfoB;? ? ? ??
? ? ? }
? ? }
? ? setFrequency(frequency);
? }
======================================================================================= That is not the complete function code, just enough to get you started. The KD8CEC software does not work with the stock v6 display.? It does work with all of the other versions, so IF you have a version prior to v6, then KD8CEC is the way to go.? There is a program that runs on a pc called Memory Manager that is used to set and save calibration and configuration values in EEPROM.? Band limits are one of the options that are included in configuration management.? Here are the links to the two archives needed: Memory Manager Nano code If you have a v6, then here is a link on how to upgrade to a Nextion screen with the KD8CEC firmware: Hope the above helps. 73 Evan AC9TU |
开云体育Thanks, Evan !! ?I remember way back to the bitx40 where I managed to put in Lowpass filters and get it to work on 80 m. ? A little effort, a little learning and you can do incredible things.?On Mar 27, 2021, at 07:37, Evan Hand <elhandjr@...> wrote:
|
This is how I use the LPF setup for non-hams usage.
toggle quoted message
Show quoted text
void setTXFilters(unsigned long freq){ ? ? if (freq >= 21000000L){? // the default filter is with 35 MHz cut-off ??? digitalWrite(TX_LPF_A, 0); ??? digitalWrite(TX_LPF_B, 0); ??? digitalWrite(TX_LPF_C, 0); ? } ? else if (freq >= 14000000L){ //thrown the KT1 relay on, the 30 MHz LPF is bypassed and the 14-18 MHz LPF is allowd to go through ??? digitalWrite(TX_LPF_A, 1); ??? digitalWrite(TX_LPF_B, 0); ??? digitalWrite(TX_LPF_C, 0); ? } ? else if (freq >= 4500000L){ ??? digitalWrite(TX_LPF_A, 0); ??? digitalWrite(TX_LPF_B, 1); ??? digitalWrite(TX_LPF_C, 0);??? ? } ? else { ??? digitalWrite(TX_LPF_A, 0); ??? digitalWrite(TX_LPF_B, 0); ??? digitalWrite(TX_LPF_C, 1);??? ? } } Rafael On 3/27/21 8:39 AM, Gordon Gibby wrote:
Thanks, Evan !! ?I remember way back to the bitx40 where I managed to |
Rafael,
toggle quoted message
Show quoted text
You have your cut-off frequencies set rather low, this will result in a strong second harmonic in some transmissions. The 80m filter is also meant to cover 60m.? Transmission between 60m and 40m has not been evaluated. The 40m filter is also meant to cover 30m.? Transmission between 30m and 20m has not been evaluated. The 20m filter is also meant to cover 17m.? Transmission between 17m and 15m has not been evaluated. The 15m filter is also used for 12m and 10m. Cheating on the above will give slightly more power to the antenna in some cases, but far worse harmonic suppression. To be clear,? the transmit LPF's are not used when receiving. So for those interested in receiving signals out of the ham bands, nothing need be done here. Another issue, Rafael's code is aimed at the v5 and v6. The v3 and v4 require slightly different 3 bit codes to the control the relays. Here's what my most recent code for the filters looks like, it has not been tested on a v5,v6. Note that when it returns a 1, the code using it should emit an error message and block the transmission. //########? ? TX Lowpass Filters and Band Check? ?############################ // If out of the ham bands (or within 500hz of the edge) return 1,
// If within the ham bands, set LPF relays appropriately and return 0
// The band limits should be correct for US hams with Extra Class privileges
// In USA, 60m transmissions must be on five specified USB channels
// Could add this entry if an external LPF for 160m is installed:
//? ? ((f >? 1800)? &&? (f <? 2000))? ||? // 160m, external LPF
?
char? setTXFilters(uint32_t? freq){? ? ?// Adapted from VU2ESE's code
? ? uint16_t f = (freq+500)/1000;? ? ? ? ? ? ? ?// Only 16 bits needed if in khz
? ? if (
? ? ? ? ((f >? 3500)? &&? (f <? 4000))? ||? ? // 80m
? ? ? ? ((f >? 5275)? &&? (f <? 5450))? ||? ? // 60m
? ? ? ? ((f >? 7000)? &&? (f <? 7300))? ||? ? // 40m
? ? ? ? ((f > 10100)? &&? (f < 10150))? ||? ? // 30m
? ? ? ? ((f > 14000)? &&? (f < 14350))? ||? ? // 20m
? ? ? ? ((f > 18068)? &&? (f < 18168))? ||? ? // 17m
? ? ? ? ((f > 21000)? &&? (f < 21450))? ||? ? // 15m
? ? ? ? ((f > 24890)? &&? (f < 24990))? ||? ? // 12m
? ? ? ? ((f > 28000)? &&? (f < 29700))? ? )? ?// 10m
? ? {
#if V3V4
? ? ? ? if (f >= 21000) {? ? ? ? ? ? ? ?// Default filter, above 21mhz
? ? ? ? ? ? digitalWrite(TX_LPF_A, 0);
? ? ? ? ? ? digitalWrite(TX_LPF_B, 0);
? ? ? ? ? ? digitalWrite(TX_LPF_C, 0);
? ? ? ? }
? ? ? ? else if (f >= 14000) {? ? ? ? ? // 14-21mhz
? ? ? ? ? ? digitalWrite(TX_LPF_A, 1);
? ? ? ? ? ? digitalWrite(TX_LPF_B, 0);
? ? ? ? ? ? digitalWrite(TX_LPF_C, 0);
? ? ? ? }
//########################################? ? ? ? else if (f >= 7000) {? ? ? ? ? ?// 7-14mhz
? ? ? ? ? ? digitalWrite(TX_LPF_A, 1);
? ? ? ? ? ? digitalWrite(TX_LPF_B, 1);
? ? ? ? ? ? digitalWrite(TX_LPF_C, 0);
? ? ? ? }
? ? ? ? else {? ? ? ? ? ? ? ? ? ? ? ? ? // 3-7mhz
? ? ? ? ? ? digitalWrite(TX_LPF_A, 1);
? ? ? ? ? ? digitalWrite(TX_LPF_B, 1);
? ? ? ? ? ? digitalWrite(TX_LPF_C, 1);
? ? ? ? }
#elif V5V6
? ? ? ? if (f >= 21000) {? ? ? ? ? ? ? ?// Default filter, above 21mhz
? ? ? ? ? ? digitalWrite(TX_LPF_A, 0);
? ? ? ? ? ? digitalWrite(TX_LPF_B, 0);
? ? ? ? ? ? digitalWrite(TX_LPF_C, 0);
? ? ? ? }
? ? ? ? else if (f >= 14000) {? ? ? ? ? // 14-21mhz
? ? ? ? ? ? digitalWrite(TX_LPF_A, 1);
? ? ? ? ? ? digitalWrite(TX_LPF_B, 0);
? ? ? ? ? ? digitalWrite(TX_LPF_C, 0);
? ? ? ? }
? ? ? ? else if (f >= 7000) {? ? ? ? ? ?// 7-14mhz
? ? ? ? ? ? digitalWrite(TX_LPF_A, 0);
? ? ? ? ? ? digitalWrite(TX_LPF_B, 1);
? ? ? ? ? ? digitalWrite(TX_LPF_C, 0);
? ? ? ? } else {? ? ? ? ? ? ? ? ? ? ? ? ? // 3-7mhz
? ? ? ? ? ? digitalWrite(TX_LPF_A, 0);
? ? ? ? ? ? digitalWrite(TX_LPF_B, 0);
? ? ? ? ? ? digitalWrite(TX_LPF_C, 1);
? ? ? ? }
#endif
? ? ? ? return(0);? ? ? ? ? ? ? ? ? ? ? ?// success, an apparently legal transmission
? ? } else return(1);? ? ? ? ? ? ? ? ? ? // failed, out of band
}
Jerry, KE7ER On Sat, Mar 27, 2021 at 07:47 AM, Rafael Diniz wrote:
This is how I use the LPF setup for non-hams usage. |
Jack, W8TEE
Hi Rafael: First, I'm really happy to see you use the data suffix on your constants. However, you might want to change: ? if (freq >= 21000000L){ to ? if (freq >= 21000000UL){ to more accurately describe the data type being tested. Also, I tried refactoring your code and, with the debug statement removed, you might find it easier to read. This is a complete sketch so you can test it. #define TX_LPF_A 1 #define TX_LPF_B 2 #define TX_LPF_C 3 / ? Purpose: To toggle the appropriate LPF based on the frequency ? Parameter List: ??? unsigned long freq??????????? the current frequency in use ? Return value: ??? void / void DoFilters(unsigned long freq){ ? int whichIndex; ? int whichFilters[4][3] = {??????????????????????? // Which filter to turn on based on freq ??? {0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}? }; ? if (freq >= 21000000UL) {???????? // the default filter is with 35 MHz cut-off ??? whichIndex = 0; ? } ? else if (freq >= 14000000UL) {??? //thrown the KT1 relay on, ??? whichIndex = 1; ? } ? else if (freq >= 4500000UL) { ??? whichIndex = 2; ? } ? else { ??? whichIndex = 3; ? } ? digitalWrite(TX_LPF_A, whichFilters[whichIndex][0]); ? digitalWrite(TX_LPF_B, whichFilters[whichIndex][1]); ? digitalWrite(TX_LPF_C, whichFilters[whichIndex][2]); ? ? // Debug stuff to show what was done... ? Serial.print("whichIndex = "); ? Serial.println(whichIndex); ? Serial.print("?? TX_LPF_A = "); ? Serial.println(whichFilters[whichIndex][0]); ? Serial.print("?? TX_LPF_B = "); ? Serial.println(whichFilters[whichIndex][1]); ? Serial.print("?? TX_LPF_C = "); ? Serial.println(whichFilters[whichIndex][2]); } void setup() { ? // put your setup code here, to run once: ? Serial.begin(9600); ? while (!Serial)??????????? // Needed for fast processor ??? ;} void loop() { ? int c; ? static int promptFlag = 0; ? unsigned long freq; ? if (promptFlag == 0) { ??? promptFlag = 1; ??? Serial.println("\nEnter a frequency index (0-3):"); ??? while (true) { ????? if (Serial.available() > 0) { ??????? c = Serial.read() - '0';??????????? // Make it an int ??????? if (c < 0 || c > 3) { ????????? Serial.println("Must be 0 to 3. Re-enter."); ????????? promptFlag = 1; ??????? } else { ????????? switch (c) { ??????????? case 0: ????????????? freq = 21000001UL; ????????????? break; ??????????? case 1: ????????????? freq = 14000001UL; ????????????? break; ??????????? case 2: ????????????? freq = 4500001UL; ????????????? break; ??????????? case 3: ????????????? freq = 3500001UL; ????????????? break; ????????? } ????????? DoFilters(freq);??????????????????? // Your rewritten code... ????????? promptFlag = 0;????????? break; ??????? } ????? } ??? } ? } }
On Saturday, March 27, 2021, 10:48:01 AM EDT, Rafael Diniz <rafael@...> wrote:
This is how I use the LPF setup for non-hams usage. void setTXFilters(unsigned long freq){ ? ? if (freq >= 21000000L){? // the default filter is with 35 MHz cut-off ??? digitalWrite(TX_LPF_A, 0); ??? digitalWrite(TX_LPF_B, 0); ??? digitalWrite(TX_LPF_C, 0); ? } ? else if (freq >= 14000000L){ //thrown the KT1 relay on, the 30 MHz LPF is bypassed and the 14-18 MHz LPF is allowd to go through ??? digitalWrite(TX_LPF_A, 1); ??? digitalWrite(TX_LPF_B, 0); ??? digitalWrite(TX_LPF_C, 0); ? } ? else if (freq >= 4500000L){ ??? digitalWrite(TX_LPF_A, 0); ??? digitalWrite(TX_LPF_B, 1); ??? digitalWrite(TX_LPF_C, 0);??? ? } ? else { ??? digitalWrite(TX_LPF_A, 0); ??? digitalWrite(TX_LPF_B, 0); ??? digitalWrite(TX_LPF_C, 1);??? ? } } Rafael On 3/27/21 8:39 AM, Gordon Gibby wrote: > Thanks, Evan !! ?I remember way back to the bitx40 where I managed to > put in Lowpass filters and get it to work on 80 m. ? A little effort, > a little learning and you can do incredible things.? > > >> On Mar 27, 2021, at 07:37, Evan Hand <elhandjr@...> wrote: >> >> ?Pierre, >> >> First off, can you tell us which version of the ?BITX you have? >> >> Regardless, I do believe that all of the software versions have a >> *startTX(byte txMode)* function in the main tab of the program. >> >> Here is the section from the v6 code: >> =============================================================================================== >> void startTx(byte txMode){ >> ? unsigned long tx_freq = 0;?? >> ? ?? >> ? digitalWrite(TX_RX, 1); >> ? inTx = 1; >> ?? >> ? if (ritOn){ >> ? ? //save the current as the rx frequency >> ? ? ritRxFrequency = frequency; >> ? ? setFrequency(ritTxFrequency); >> ? } >> ? else? >> ? { >> ? ? if (splitOn == 1) { >> ? ? ? if (vfoActive == VFO_B) { >> ? ? ? ? vfoActive = VFO_A; >> ? ? ? ? isUSB = isUsbVfoA; >> ? ? ? ? frequency = vfoA; >> ? ? ? } >> ? ? ? else if (vfoActive == VFO_A){ >> ? ? ? ? vfoActive = VFO_B; >> ? ? ? ? frequency = vfoB; >> ? ? ? ? isUSB = isUsbVfoB;? ? ? ?? >> ? ? ? } >> ? ? } >> ? ? setFrequency(frequency); >> ? } >> ======================================================================================= >> >> That is not the complete function code, just enough to get you started. >> >> The KD8CEC software does not work with the stock v6 display.? It does >> work with all of the other versions, so IF you have a version prior >> to v6, then KD8CEC is the way to go.? There is a program that runs on >> a pc called Memory Manager that is used to set and save calibration >> and configuration values in EEPROM.? Band limits are one of the >> options that are included in configuration management.? Here are the >> links to the two archives needed: >> Memory Manager >> >> <> >> Nano code >> >> <> >> >> If you have a v6, then here is a link on how to upgrade to a Nextion >> screen with the KD8CEC firmware: >> >> <> >> >> Hope the above helps. >> 73 >> Evan >> AC9TU >> > -- Jack, W8TEE |
The term "cut-off" was used incorrectly in my last post, would be better had I said: On Sat, Mar 27, 2021 at 08:25 AM, Jerry Gaffke wrote:
You have your cut-off frequencies set rather low, this will result in a strong second harmonic in some transmissions. |
Jack has some strong opinions.
toggle quoted message
Show quoted text
I'm at least as stubborn, and am quite happy with my code of this post:? ? ? /g/BITX20/message/87222 But there are some interesting issues along these lines. For a start, here's a program compiled with gcc under Ubuntu linux, it gives the results one might expect. ######################## #include <stdio.h>
void main() {
? long va, vb, vc;
? va = 1000*1000;
? vb = 1000000;
? vc = 1000L*1000;
? printf("va:%ld? vb:%ld? vc:%ld \n", va, vb, vc);
?
? short vd = -3;
? unsigned short ve = 4;
? long vf;
? vf = vd*ve;
? printf("vf:%ld? short:%ld? long:%ld \n", vf, sizeof(short), sizeof(long));
}
// The above code prints the following:
//? ? ?va:1000000? vb:1000000? vc:1000000
//? ? ?vf:-12? short:2? long:8
#############################
Contrast that with the following code for the Arduino Nano: ############################# void setup() {
? ? Serial.begin(9600);
?
? ? long va, vb, vc;
? ? va = 1000*1000;
? ? vb = 1000000;
? ? vc = 1000L*1000;
? ? Serial.println(va);
? ? Serial.println(vb);
? ? Serial.println(vc);
?
? ? Serial.println();
?
?
? ? short vm3 = -3;
? ? unsigned short vp4 = 4;
? ? long vd= 0;
? ? vd = vm3 * vp4;
? ? Serial.println(vd);
? ? Serial.println("Done");
?
? ? while (1) ;
}
?
void loop() {}
// The above code prints the following to the Arduino IDE's serial monitor:
// 16960
// 1000000
// 1000000
//
// 65524
// Done
#########################
Where the gcc code printed 1000000 for the value of va, this one prints 16960 And where the gcc code printed -12 for the value of vd, this one prints 65524 Looks to me that the Arduino compiler is operating according to the C99 spec. The gcc compiler likely has a flag somewhere (which I haven't yet found reason to look for) that would make it strictly conform to the C99 spec instead of doing what normal people expect. Hint:? This has nothing to do with the 64 bit longs under gcc, 32 bit longs under Arduino. Just a matter of how signed and unsigned multiplies work. And how dumb the compiler can be at times. Weird stuff. But adding L's to big numbers doesn't help. Only to small ones, such as that "1000L*1000". Jerry, KE7ER On Sat, Mar 27, 2021 at 09:07 AM, Jack, W8TEE wrote:
First, I'm really happy to see you use the data suffix on your constants. However, you might want to change: |
Pierre Guillot
On Sat, Mar 27, 2021 at 08:25 AM, Jerry Gaffke wrote:
Jerry, could you give me the name of this code file in order that I could find it in all the files foubd in github? 73 - Pierre - FK8IH
|
Pierre,
toggle quoted message
Show quoted text
I've never made my uBitx code public, it isn't on github. I am thinking of cleaning it up and making it available as a debug aid. Might be easier to calibrate the Si5351 than some of the firmware folks are using now, can use it to figure out filter shapes, both audio and RF signal generators coming out of the Nano. Then cook up step by step debug notes for?debugging transmit and receive using?a minimum set of tools. But until it is truly useful and easy enough to read,? posting my code would just waste everybody's time. Including my own. Jerry, KE7ER On Sat, Mar 27, 2021 at 02:56 PM, Pierre Guillot wrote:
On Sat, Mar 27, 2021 at 08:25 AM, Jerry Gaffke wrote: |
As you may know, the Arduino IDE is also using the gcc compiler.
toggle quoted message
Show quoted text
But it is apparently configured differently by default under Ubuntu. The differences may be due to how the hardware on an x86 processor? differs from an ATMega328 processor. But I'm betting it's mostly in how the compiler is configured. Much of the weirdness can be figured out by printing in hex. But the exact reason for the difference between the values for vd of -12 and 65524 may be unexpected, even for experienced C programmers. ?? Jerry, KE7ER On Sat, Mar 27, 2021 at 02:04 PM, Jerry Gaffke wrote:
Looks to me that the Arduino compiler is operating according to the C99 spec. |