Keyboard Shortcuts
Likes
Search
WSJT-X 2.2.2
I've written custom firmware for the uBITX 6 and got the CAT interface working well with WSJT-X 2.1.2, using the FT817 configuration. I just tried WSJT-X 2.2.2 and it no longer works.? I see in the release notes that they updated Hamlib to a newer version and one of the specific notes was to make it work with the uBITX.
I didn't have time to fully debug the interface as I was setting up for the RTTY RU contest, but I notice that it's using a few more undocumented FT817 commands. Even after adding those commands to my CAT interface, I still had trouble getting it working. I had it working fairly well as long as I didn't restart the uBITX after uploading the sketch. It seems that uploading firmware resets something in the serial interface that isn't done after a normal power up. With 2.1.2, I was able to get the uBITX to reset by setting DTR high on the interface, but it looks like 2.2.2 is using DTR differently as my uBITX resets several times instead of once with 2.1.2. 73, Mark, N8ME |
Hi Mark -?
Chasing down a similar (same) problem over here -?[email protected] | Arduino, PC, Serial Communications / CAT What platform are you running WSKTX on Windows or Linux??? If you don't already know about it there is a command line program in the Hamlib distribution called "rigctl"? I find it very useful - in it's verbose debug mode it shows you every byte it sends and receives.? ? My observations is that it thinks it is sending but nothing arrives at the Arduino - unless I open and close the Arduino IDE serial monitor before running the program - then it all works fine - including WSJTX (with DTR un-checked). I am Interested in collaborating on this - it would be good to get Arduino / Hamlib communications to be reliable. 73, Dean |
Hi Doug -
Yes? 2.2.2 uses the latest update to the hamlib libraries.? I'm not sure what all they have changed My experience is that CAT communication with our Arduino based rigs has never been super reliable - except with Ham Radio Deluxe 5 which has been super reliable.? That hasn't been updated since 2012! As a programmer my goal is to have it "just work"? and not vary between programs and version and not require mystic incantations! 73, Dean KK4DAS |
¿ªÔÆÌåÓýDean, ? WSJT-X is running on Windows. ? Thanks for the pointer on rigctl. I see ?a rigctl-wsjtx executable file in the WSJT-X installation. I guess it does the same thing.? Is there a way to configure rigctl to sit between WSJT-X and the uBITX and monitor the communications or do you have to enter Hamlib commands into rigctl directly? ? I wrote my own Python script to monitor the communication. I create a virtual serial port pair. I point WSJT-X to one half of the virtual pair. The Python script connect to the other half of the virtual pair and to the hardware port connected to the uBITX. The program copies everything it gets on one port to the other and to the screen. It does a little decoding so that it can display commands it knows about in text rather than just hex which is the default. ? I¡¯ve seen an issue with WSJT-X not communicating unless I upload a script. I suspect that opening and closing the serial monitor does the same thing to the serial port that makes it work. Communications works fine with my Python script in the middle, but I see the uBITX screen flash when I start the script, so I think the script toggles DTR behind the scenes. ? I wish I knew what¡¯s in the DTR reset that makes the serial port on the Nano work. I would think that there would be a way to reset the serial port when a sketch starts up. ? I¡¯d be glad to collaborate. FWIW, currently my CAT is having problems with FLDIGI, even when I have FLDIGI configured to use Hamlib. ? 73, Mark, N8ME ? From: Dean Souleles
Sent: Monday, January 4, 2021 12:48 PM To: [email protected] Subject: Re: [BITX20] WSJT-X 2.2.2 ? Hi Mark -? ? |
Mark,
I hadn't seen the that WSJTX supplied it. That's great because it will be built of the same library version as the WSJTX suite rigctl-wsjtx.exe -m 1022 -r com4 -P RIG -D NONE -s 38400 -vvvvv -m is the hamlib rig number.? 1022 is for the FT-857D (1020 is the FT-817)? - that is with the latest hamlib - they were previously 122 and 120.? -vvvvv is the super debug option that shows you everything.? My CAT control library is built off the FT-857 specs but I think the command architecture between the 817 and the 857 is identical.?? I just tested it with my build.? It works the same as I described before.? First run rigctl "thinks" it is sending, but the the Arduino doesn't see any data and rigctl reports a timeout.? Open and close the serial monitor and it works fine business.? And then after it is working with rigctl I can run WSJTX, FLRIG or FLDIGI and they work fine.? Interestingly the Arduino does not reset on rigctl connecting. Fascinating that one program running and exiting affects the state of the com port for the next program. Where are the Windows USB gurus? Would you car to share your Python monitoring script? 73, Dean KK4DAS Is there a way to configure rigctl to sit between WSJT-X and the uBITX and monitor the communications or do you have to enter Hamlib commands into rigctl directly? I don't think so - rigctrl is a command line interface -? here is how I run it - cd "C:\Program Files (x86)\hamlib-w64-3.3\bin" ? |
Is it possibly a delay time difference between when DTR is asserted and when the CAT program(s) start trying to communicate and/or expects a response/ACK between these different CAT programs/versions?
Assert DTR and reset is pulsed low (asserted) through a capacitively coupled circuit. The Arduino goes into bootloader/programming mode when Reset is negated, it doesn't go into "application" mode until after the bootloader timeout. When you upload a new sketch and stay powered-up, the Nano is in application mode. When you have your Python serial port snooper running, the Nano is in application mode. Opening up the Arduino IDE serial monitor also resets the Arduino.? It also resets when you close the serial monitor. (I expect most terminal programs assert DTR by default when started) One possible way to help debug the idea / problem is to remove the bootloader overhead. (if your CAT programs(s) don't have an obvious time out variable / setting) With a bootloader in place,? It takes ~ 1 second to go from reset negate to user code running.? ?I get past One MISSISSIPPI after negating reset to LED on for the Blink Demo. Rgds, Gary |
I found a bug in my code based on a misunderstanding of the Arduino Serial library. I rewrote my code to take that into account and it looks like WSJT-X 2.2.2 (with the newer Hamlib) is working. That's when I choose the FT857 setup. I still have an issue when I use the FT817 with rigctl-wsjtx that it doesn't seem to send any messages or commands to the radio.
73, Mark, N8ME |
Hi Mark -
Glad you got it working.? Mine still won't connect from a clean boot.? ?Curious what you did - can you post the extract of your serial code.... This is mine... in setup... void ft857d::begin(long br, int mode) {
? ? Serial.begin(br, mode);
? ? Serial.flush();
}
from the main loop... void ft857d::check() {
? ? // do nothing if it was disabled by software
? ? if (!enabled) return;
?
? ? // first check if we have at least 5 bytes waiting on the buffer
? ? byte i = Serial.available();
? ? if (i < 5) return;
?
? ? // if you got here then there is at least 5 bytes waiting: get it.
? ? for (i=0; i<5; i++) {
? ? ? ? nullPad[i] = Serial.read();
? ? }
? ?// do something useful...
? ?// and eventually... ? ?Serial.write(ACK); } That is it.? Is yours any different? Thanks, Dean KK4DAS |
On Mon, Jan 4, 2021 at 03:36 PM, Gary Anderson wrote:
Is it possibly a delay time difference between when DTR is asserted and when the CAT program(s) start trying to communicate and/or expects a response/ACK between these different CAT programs/versions?Hi Gary - DTR reset is an issue.? When I start Ham Radio Deluxe the Arduino resets and and HRD tries twice to get the frequency - but the timing is such that it always works the second time.? WSJTX doesn't expose timeout and retry intervals.? And it doesn't explain why after a fresh boot of the Arduino -? meaning I plug it into to the USB port, it powers up and the sketch starts running.? ?So no bootloader is involved.? This happens:
73, Dean KK4DAS |
Dean,
My code is a little different. In setup(), it calls Serial.begin() and Serial.flush() like your code. My CAT handling is done in a Serial.event() function. This is called whenever there is a character available to read (or so says the documentation).? void?serialEvent(void)?{
??long?frequency;
??byte?temp1,?temp2;
??int?c?=?Serial.read();
??if?(c?>?-1)?{
????cmd_buffer[cmd_byte_ct++]?=?(byte)?c;
??}
??if?(cmd_byte_ct?==?5)?{
????cmd_byte_ct?=?0;
?
Then process the command. cmd_buffer is a 5 element byte array. cmd_byte_ct is a global variable initially set to 0. My original code was like yours in that it assumed that if Serial.available() returned 5 or more that Serial.read would always be able to read 5 bytes (I actually used Serial.readbytes(buffer, 5), but the way my program behaved, I'm not sure that was a valid assumption.? With a few hours testing WSJT-X versions 2.1.2 and 2.2.2 and with FLDigi (using hamlib) it seems to work, after a firmware upload or after a power cycle.? It was a little less reliable until I added the Serial.flush() in setup(). Thank you for that idea. 73, Mark, N8ME 73, Mark, N8ME |
Hi Mark -?
Thanks.? That's curious. I wouldn't have thought that would make a difference.? Despite its name serialEvent is not interrupt driven.? It is implemented using Serial.available so the behavior should be pretty close to identical.? If you want to dive deeper? take a look at the Arduino main.cpp - in the main loop it calls your sketch loop() and then calls serialEventRun() which is implemented in HardwareSerial.cpp.? serialEventRun() checks Serial.available and then calls your serialEvent if defined.? The way you have coded it you are only getting one byte each time through the loop anyway - and there may be more in the input buffer.?? You can find the Arduino source here...??C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino If I get a chance I'll play around with it today. 73, Dean KK4DAS |
Hi Dean.
You can use a programmer to load the sketch. With this method, the bootloader portion will not be present. program the Nano from the Arduino IDE ? ? Sketch ->? Upload Using Programmer For my programmer, I use an Uno R3 with the Example:ArduinoISP" sketch loaded.? You can always put the bootloader back.? I did a write up on this ~31Dec20. However when you burn a new bootloader, the EEPROM is zeroed. I keep a backup of factory EEPROM and for anything that I have 'tuned'.? Use avrdude to read and write. With Nano clones so affordable, I learn / play with additional boards and keep working 'Golden Units'. I realize that not having a bootloader on the Nano is not the end solution, but it may aid in debugging the problem. I also understand that the behaviors described by you and Mark and interpreted by me don't identify the exact source / correction of the problem. It is nebulous to me what is going on with the ports/ buffers and further complicated by USB.? e.g. does the putty session get this all in order. Then you have a delay between closing putty (DTR)? and opening WSJTX without DTR. My understanding is that If the bootloader is programmed, it is always involved. Out of reset, waiting to see if it should upload a new program, timeout if nothing to upload, then proceed to the sketch. Without the bootloader, the sketch starts right out of reset.? So this will reduce the time between a reset (DTR) and when the serial port on the Nano is ready for communication. Rgds, Gary |
I didn't know that about serialEvent. I hadn't looked past the name.
So that really begs the question why my code is working. The only thing I see is that I am checking for Serial.read() to return -1 and ignoring that. The -1 return means that the read timed out, which doesn't make sense since you (and my old) code was only calling Serial.read() when Serial.available() indicated data was available. As a test, you could check your calls to Serial.read() for a -1 return. 73, Mark, N8ME |
Does Serial.available work?
Thanks for letting me know. I just ordered some Nano Every's (should arrive Thursday). I went ahead and download the board setup for the Nano Every and tried to compile my sketch.? It looks like I need to redo my timer setup (I was writing directly to the timer setup bytes) and the board setup is missing the macro digitalPinToPCMskbit.? It's starting to sound like the software designers only worried about getting the high-level features working. 73, Mark, N8ME |
Update -?
I now believe I have serial I/O for CAT control working seamlessly on the Arduino Nano Every.? ?In short, the default parameters for the Nano Every serial port are 115200, N81? - if I set that in the firmware and set that in WSJTX and any other PC program, then? communication comes up and works fine.? Apparently what happens is if the firmware is set to anything other than that there is a serial port reset that occurs and that was apparently causing WSJTX to hang.? I still can't account for 100% of the behavior but limited testing so far - everything is working as expected.? ? Thanks to everyone that contributed to the discussion? - sorry I kind hijacked Mark's thread.? See this post and replies for more details ...?/g/SoftwareControlledHamRadio/message/10062 Back to building radios... 73, Dean KK4DAS |