Topics

NO LIBRARIES! Coding wisdom from AA0ZZ


Bill Meara
 


Reed N
 

I disagree with a number of the statements, but each ham can do what they want, as long as they're enjoying the hobby.


Reed


Shirley Dulcey KE1L
 

Straight assembler vs C and libraries is a tradeoff between performance and development time. Doing your project in assembler can squeeze more out of any given processor, but it will take longer to develop and debug your code.

When all we had to work with were things like the ATMega328P (and that was already a big step up from earlier microcontrollers; I remember developing for the PIC16, and farther back the 8051, and stuff before that...), that kind of optimization was important. If you're going to make a lot of units of something it's still important; things like microwave ovens use very minimal and cheap microcontrolllers. But if you're doing a small volume project for yourself or a few hams it's often a better plan to go to a higher end part, and it may not even cost more than the somewhat long in the tooth ATMega. ARM-based microcontollers are very inexpensive now, and even a lowly Cortex-M0 will be 10x faster than the AVR in many applications. (The big gain comes from being able to do 32 bit arithmetic natively instead of having to piece it together with multiple instructions.) And that doesn't come at a high cost: a Blue Pill is about $3 from Asian sources (but caveat emptor, some don't have original STM microcontrollers) and a Seeeduino Xiao (from China, but an original design from a reputable company) is $5.

For more demanding applications, stepping up to a Cortex-M4F may be 100x faster than the AVR because it also has native floating point. And if you really need a bludgeon there is the Cortex-M7 as found in the Teensy 4.0 (about $20); that's what I'd pick if I were going to do something with DSP because it would bring a lot more capability and therefore better processing.

Some people enjoy the challenge of squeezing a lot out of very little. The QCX and the uSDX are good examples; the QCX crams a lot of capabilities in, and the uSDX actually does DSP transmit and receive. (The ATMega328P was a fine choice when Hans originally designed the QCX, and I applaud the fact that he has continued to upgrade that firmware so existing owners can get new capabilities. But I doubt he would choose that processor if the QCX did not yet exist and he was doing a brand new design now. The uSDX design was originally a modification of the QCX and was therefore constrained to the same hardware; it's one of those "do it for the challenge" designs.) For the rest of us, save yourself some headaches, throw a bit more hardware at the problem, and make as much use as you can of code that already exists.

And unless you're trying to put together something ultra-miniature, design a development board into your project like the Raduino did. It saves you a nasty bit of soldering (those SMD parts with tiny leads like modern microcontrollers are a challenge), and you can buy a Nano clone or a low end ARM board for less than it would cost to buy the parts on it in small quantities. Look at the Xiao as an example. The microcontroller is $2.50. The USB-C connector will cost you $2 if you can even find a distributor that has them in stock. Good luck buying the circuit board for the remaining 50 cents, let alone the other parts on it. (You say you don't need the USB connector? How do you plan to get the firmware into it or update it later? And these days you want a USB interface on your rig anyway so you can do CAT and have it talk to your logging program.)


Gordon Gibby
 

Hi, can you explain exactly what a development board is?

“ design a development board into your project like the Raduino did.”

On Sep 23, 2020, at 13:02, Shirley Dulcey KE1L <mark@...> wrote:

design a development board into your project like the Raduino did.


Shirley Dulcey KE1L
 

The Arduino Nano, which is connected to the Raduino board in the BITX20 and uBITX, is one example. Other Arduino boards or anything with "Duino" in its name are others, and many more exist with non-Duino names like the STM32-based Blue Pill. It's a small self-contained board with all the necessary components for running microprocessor code. Older designs supported serial programming; newer ones use USB.

(There is another class of development boards: the ones with more capable hardware that can run large scale operating systems such as Linux. The Raspberry Pi is the best known of those. They also have many uses in ham radio, but you're not as likely to be designing one into a project.)

A typical board will have a USB port (for interfacing with a host computer during development and/or to talk to peripheral devices when being used standalone), a bunch of general purpose digital and analog pins, and on-board interfaces for serial, I2C, and SPI devices (the latter two are specialized protocols for communication between microcontrollers and peripherals). They usually have an easy way to get code onto the board built in, either serial or USB. And the board will have a few blinky lights to give you a clue about what it's doing.

Although I described them as self-contained, you won't normally be using one all by itself except for trivial projects. More often you will be connecting it to one or many things. Often they are designed into a device (embedded) like that Arduino Nano on the Raduino board, which in turn becomes a part of the BITX as a whole.

The point is that by incorporating a board like that, you get a bunch of work done for you. You don't have to solder all those small fiddly parts, and you get something that already has programming support. All you have to do is hook it up to your computer and load the right software, and these days that software is usually available at no cost. And amazingly it often saves money; you can buy an Arduino Nano clone for less than you can buy the parts on it in small quantities.

A similar approach can apply to other parts. A lot of recent ham designs are using the Si5351A programmable clock generator as a frequency synthesizer; it's not the chip's original intended purpose but it works well. The Si5351A only comes in a couple of very small packages that are difficult to solder. You can dodge that problem by buying a breakout board that already has the chip and its associated passive components in place. (The most popular one is $8 from Adafruit, or under $3 for clones of it from Asia.) Again, the price is reasonable and you save some soldering hassles. Before that chip came along some hams were doing designs with the AD9850 or AD9851 DDS chips; again, you can buy boards with those chips already soldered for you. (And for a while, they sold for less than the price of the DDS chip in quantity one.)


On Wed, Sep 23, 2020 at 2:09 PM Gordon Gibby <docvacuumtubes@...> wrote:
Hi, can you explain exactly what a development board is?

“  design a development board into your project like the Raduino did.”
> On Sep 23, 2020, at 13:02, Shirley Dulcey KE1L <mark@...> wrote:
>
> design a development board into your project like the Raduino did.






Jack, W8TEE
 

Reed:

I do too. Unless profiling shows a bottleneck at some point, assembler is really not necessary 99% of the time. Today's compilers are really much better than they were even 10 years ago and they extra effort is rarely worth it. On the other side, if you enjoy coding in assembler, no reason not to.

Jack, W8TEE

On Wednesday, September 23, 2020, 11:52:37 AM EDT, Reed N <greenkid336600+groupsio@...> wrote:


I disagree with a number of the statements, but each ham can do what they want, as long as they're enjoying the hobby.


Reed

--
Jack, W8TEE


Gordon Gibby
 

Thnks for the expanded explanation!
Gordon


On Wed, Sep 23, 2020 at 2:40 PM Shirley Dulcey KE1L <mark@...> wrote:
The Arduino Nano, which is connected to the Raduino board in the BITX20 and uBITX, is one example. Other Arduino boards or anything with "Duino" in its name are others, and many more exist with non-Duino names like the STM32-based Blue Pill. It's a small self-contained board with all the necessary components for running microprocessor code. Older designs supported serial programming; newer ones use USB.

(There is another class of development boards: the ones with more capable hardware that can run large scale operating systems such as Linux. The Raspberry Pi is the best known of those. They also have many uses in ham radio, but you're not as likely to be designing one into a project.)

A typical board will have a USB port (for interfacing with a host computer during development and/or to talk to peripheral devices when being used standalone), a bunch of general purpose digital and analog pins, and on-board interfaces for serial, I2C, and SPI devices (the latter two are specialized protocols for communication between microcontrollers and peripherals). They usually have an easy way to get code onto the board built in, either serial or USB. And the board will have a few blinky lights to give you a clue about what it's doing.

Although I described them as self-contained, you won't normally be using one all by itself except for trivial projects. More often you will be connecting it to one or many things. Often they are designed into a device (embedded) like that Arduino Nano on the Raduino board, which in turn becomes a part of the BITX as a whole.

The point is that by incorporating a board like that, you get a bunch of work done for you. You don't have to solder all those small fiddly parts, and you get something that already has programming support. All you have to do is hook it up to your computer and load the right software, and these days that software is usually available at no cost. And amazingly it often saves money; you can buy an Arduino Nano clone for less than you can buy the parts on it in small quantities.

A similar approach can apply to other parts. A lot of recent ham designs are using the Si5351A programmable clock generator as a frequency synthesizer; it's not the chip's original intended purpose but it works well. The Si5351A only comes in a couple of very small packages that are difficult to solder. You can dodge that problem by buying a breakout board that already has the chip and its associated passive components in place. (The most popular one is $8 from Adafruit, or under $3 for clones of it from Asia.) Again, the price is reasonable and you save some soldering hassles. Before that chip came along some hams were doing designs with the AD9850 or AD9851 DDS chips; again, you can buy boards with those chips already soldered for you. (And for a while, they sold for less than the price of the DDS chip in quantity one.)

On Wed, Sep 23, 2020 at 2:09 PM Gordon Gibby <docvacuumtubes@...> wrote:
Hi, can you explain exactly what a development board is?

“  design a development board into your project like the Raduino did.”
> On Sep 23, 2020, at 13:02, Shirley Dulcey KE1L <mark@...> wrote:
>
> design a development board into your project like the Raduino did.






Arv Evans
 

Assembler does have its place, particularly if space is tight or if timing is critical.
I agree with Jack that today's highly optimizing compilers are quite good but much 
the same can be accomplished with an assembly language IDE that supports 
building and using macros.  

Arv
_._


On Wed, Sep 23, 2020 at 12:48 PM Jack, W8TEE via groups.io <jjpurdum=yahoo.com@groups.io> wrote:
Reed:

I do too. Unless profiling shows a bottleneck at some point, assembler is really not necessary 99% of the time. Today's compilers are really much better than they were even 10 years ago and they extra effort is rarely worth it. On the other side, if you enjoy coding in assembler, no reason not to.

Jack, W8TEE

On Wednesday, September 23, 2020, 11:52:37 AM EDT, Reed N <greenkid336600+groupsio@...> wrote:


I disagree with a number of the statements, but each ham can do what they want, as long as they're enjoying the hobby.


Reed

--
Jack, W8TEE