Welcome to my tail of woe.
What seems like a long time ago now, back in April, I stopped using ATmega micro controllers and settled on using ESP32 for everything. SEE: https://robs-blog.net/2020/04/08/esp32-with-dual-vfos/ . Back then, i made note that some had been reporting issues with Jason Mildrum’s Etherkit library and ESP32. I did not have this problem, thankfully. Until, today that is and now everything is broken.
I think the reason why I never had any issues like the guys have reported here: https://github.com/etherkit/Si5351Arduino/issues/66 was because my ESP32 install was a rather old one, I think it was even from before espressif took over things. And then I switched over to using PlatformIO SEE https://robs-blog.net/2020/11/27/programming-with-platformio/ and a bunch of things got updated and my old very working implementation got screwed up.
I have tried to narrow down what the issue is, but its beyond my skills as a pretend programmer. So I started to try and rule things out. Its not an actual hardware issue, because other I2C things all work fine. and I can get the SI5351 to work using other libraries, like the one from Adafruit and the one I am now using above from Pavel Milanes SEE: https://github.com/pavelmc/Si5351mcu . So after losing days screwing about with this and chasing my tail, I now get to go and rewrite a whole bunch of code that no longer works. So the crap on my bench actually works again.
So tonight, i want to get the code working on the WSPR brick again so that tomorrow I can fix the PA i destroyed and then get it on the air over the Xmas/New Years break and ro also get the receiver thats part build on the protoboard working also. Cant make a receiver without a bloody signal source LOL. No family for Xmas this year because of covid. So tomorrow I will work on stuff in my office.
Go me, I got this one working in pretty quick time. I am actually rather happy now. One more to do for the VFO on the protoboard and
So sometime ago I stopped using the Arduino environment for programming micro controllers and started using PlatformIO. It offers a lot of advantages over the former and anyone who has programmed before using other environments will like the fact that you can use a really well featured IDE.
Programming for me was something I learned over 20 years ago, as a game developer for MUDS, which were text based roll playing games, written in C on linux. Mostly I was using the Kdevelopment IDE, but at other times I have used Netbeans and Eclipse when dabbling with languages like Ruby and LUA.
The great thing about PlatformIO is that its platform independent and supports over 800 different boards and you are not locked into using a particular IDE, you can use pretty much whatever IDE you like. I am using Visual Studio, but it supports about a dozen other IDE so you can choose what you like to work with.
The major benefits of using platformIO is that you have a propper debugger built in and that you have greater control over where your libraries are installed. If you look in the navigation pane to the left of the IDE, you will see that the non core libraries that I used are all installed in a directory called LIB within the project. This means when you do backups of your projects, you keep everything together where it needs to be.
For me, this means I have code, schematic, board layout, test documents and datasheets for the one project all together in one place and if i chance something, i have it tracked. There are a few things that work differently than with the Arduino IDE, like there are no drop down menus for selecting things, but once you get your head around using and editing the ini file, you will find that you have a lot more control over the things you are trying to do. And often, that level of control is very useful to have.
If you are looking to graduate from Arduino, give platformIO a go, I think you will be pleasantly surprised and enjoy your coding for ham radio projects just that little bit more.
So i am on the 4th iteration of this board and I have just about got it right. Kind of sad that its taken me so many goes to get this right, but what can i say. LOL. There is still one bodge wire on the backside of the board because I somehow left off a trace joining one row of push buttons off the 5v line. I am also not sure about the 5V regulator, its running very hot and it should not because its should only have about 300ma running thought it and there is no short to ground anywhere i can find, to explain it running so hot. By hot im guessing its hitting over 60 Deg C as its painful to touch.
Anyway, back to the point of this post. I have gotten back into coding things up and am making inroads. It mostly works now. Pressing the mode button will cycle through LSB, USB and CW. The band button will cycle through 80, 40, 20 and 15m the 4 bands that this radio will support, selecting the appropriate filter banks for both Low Pass and Band Pass filter boards as well as change the IF filter to a narrow CW filter in that mode.
The logger button will put it into logging mode, which along with a keyboard will make log entries and save them to SD Card in ADIF format. The logger is loosely based on my old arduino logger code which can be found in the menu bar above. Though, the code that is going into this is much more refined and polished and fixes most of the clunkyness that was in the earlier versions. I am a much improved programmer now than i was a few years ago when i wrote that code.
The VFO button will exit the logger and put the radio back into VFO mode. I still need to add in a couple more push buttons, one to change the Attenuation setting and the final one to allow changing the TX RX offset. At the moment it is hard coded for a 600hz offset for CW operation, but, i am going to make that variable for real split operation in SSB as well.
Anyway, that is where I am at with this at the moment. When i get things closer to being done, I will probably make a video of all the functions in action to put on youtube. But that is likely to be a couple of weeks away yet. Lots of work to be done in the mean time.
So while working on the code for the control board part of the receiver project, I came across an interesting conflict. The keyboard and the rotary encoder did not want to play nice with each other than and the compiler was spitting out an error about a vector conflict. Keyboard worked fine by itself and the rotary encoder worked fine by itself but put the code for both into the once program and the compiler went bonkers.
So i set about learning everything i could about interrupts on the Mega 2560. And this was where the fun began and i ended up going down a rabbit hole from which i was lucky to escape. Well i did survive and i did actually learn about interrupt vectors, pin change interrupts and external interrupts and a little about library conflicts along the way.
So this is not really a tutorial on using interrupts or the differences between pin change or external, but rather a rant about the 2 hours I spent last night reading and trying to understand what I had done and why there was a conflict. In the end it was because i programmed the rotary encoder to use pin change interrupts and it was the library i used that was in conflict with the keyboard library. I did not know that was what i had done, i had assumed that using pins 18 and 19 on the mega, being the external interrupt pins just worked in one way only. But no no no, they can be either external or pin change interrupts depending on how you code for it. Yes, a very rookie mistake.
So after finally working out what I had done wrong, or in reality why the libraries were in conflict, i changed 2 lines of code and had the rotary encoder working as it should be with the keyboard and everyone is happy. So at the moment I have a working keyboard, rotary encoder and VFO and now that my work week is done, I will hit the code hard tomorrow and make some real inroads into getting features in there that I want in my radio. Its not going to be as pretty as the Nextion vfo codes that are floating about the internet, but its going to be all mine. And sometimes, its good to know you have rolled your own and it does what you want.