6. Embedded Programming - Landon, Ryan, David¶
This is the group project site for Landon Broadwell, Ryan Zhou, and David Vaughn. The assignment for this week was two parts: skim through the datasheet of our main assigned chip, the SAMD, and explain the workflow for the creation of the microcontroller board. Individual documentation on the creation of the board can be found within the respective people’s groups. Additionally, we worked heavily with the other group that had the SAMD to create the board.
Datasheet¶
We skimmed through the Atmel ICE SAM D11 Microcontroller datasheet to find important aspects of the microcontroller. Though overly extensive, this datasheet provided insights into how the chip worked and the different parts of its inner mechanisms.
Main Characteristics:
Characteristic | Value |
---|---|
Pins | 14 |
General Purpose I/O Pins | 12 |
Flash | 16KB |
SRAM | 4KB |
Timer Counter | 2 |
Direct Memory Access Controller | 6 |
USB Interface | 1 |
Serial Communication Interface | 2 |
Analog-to-Digital Converter Channels | 5 |
Analog Comparators | 2 |
Digital-to-Analog Converter | 1 |
Ordering Information (page 5):
We found this ordering information diagram on page 5, which showed what the different parts of the chip’s name signified. For the SAMD11C14A, as shown by the diagram, SAMD is the name of the product family, 11 is the specific series of products that the chip is a part of, C is the pin count, being 14 pins for this chip, 14 shows the 16KB of flash memory density (which seems counterintuitive), and A meant that the chip was the default device variant. The remaining three values are all related to aspects of the chip’s package. Page 5
Pinouts (page 8):
This image shows the pinout diagram for the SAMD11CA14. It displays the different types of pins, the names of each, and the orientation of the chip indicated by the dot in the top left. This diagram was very important in the programming of the board, as it allowed us to know what pin to put into the Arduino IDE to program it.
Power Supply Considerations (page 17):
-
The SAMD11 chips use single power supply pins
-
Voltage should be between 1.62V and 3.63V
-
The diagram below shows the recommended power supply connection
Physical Memory Map (page 21):
These charts show the physical memory map of the SAMD11 chips as well, including their addresses and memory sizes. These addresses never change. According to the ATtiny’s datasheet, (not the SAMD’s), flash memory is defined as “On-Chip In-System Reprogrammable Flash memory for program storage”. In other words, flash memory is where your uploaded programming is stored.
Product Mapping (page 20):
The above charts are based on this diagram showing how the embedded flash, SRAM, and peripheral bridges are mapped.
Register Summary (page 386):
This table shows the register summary for the I/O pins, and this data assists if one is trying to do bare metal programming because it shows where certain functionalities of the chip are built according to the memory of the microcontroller. Page 386
Peripherals (page 27):
This chart displays all of the peripheral sources included on the SAMD11. Peripheral sources are components integrated into a microcontroller that allows it to communicate and interact with external devices. These can be used in various ways, such as reading inputs from buttons, switches, sensors, sliders, and wheels, converting analog inputs to digital, and sending outputs such as controlling LEDs, displays, and accurately controlling timers. All of the aforementioned interaction capabilities and many others are included in the SAMD11 microcontroller.
Idle and Standby Modes (page 120):
This chart shows how a SAMD11C microcontroller enters and is woken from both Idle Mode and Standby Mode. Idle Mode and Standby Mode are both modes that the microcontroller can go into to conserve power by disabling different clocks. Clocks are used to coordinate the execution of coding and tasks within a microcontroller and are necessary to produce desired results because of their very accurate timing. However, when many functions of the microcontroller are not in use, disabling some of these clocks can conserve power. The Idle Mode has three sub-categories as shown in the chart, and it activates automatically when the microcontroller is solely doing a small task such as analog-to-digital conversion. Conversely, the Standby Mode is only activated by the user through a set of instructions. Below is a chart showing at which stages different clocks within the SAMD11C are active or disabled.
Performance Comparison:
-
The SAMD chips appear to have a much larger embedded flash size than the ATtiny412, making it better suited for multi-purpose applications and code that takes up more memory
-
SAMD has 16K bytes whereas the ATtiny has 4K bytes
-
SAMD chips also have much more SRAM
-
4K bytes for the SAMD and only 256 bytes for the Attiny
-
SAMD chips have 22 programmable I/O pins whereas the ATtiny only has 6
-
For some reason, the ATtiny chips appear to require a more powerful power supply than the SAMD chips on average
-
SAMD needs 1.62V-3.63V whereas the ATtiny needs 1.8V-5.5V
-
Overall, the SAMD11C14A seems more capable and powerful than the ATtiny412, with more flash memory, SRAM, and programmable I/O pins. Additionally, the SAMD chip appears to not require as large of a power supply as the ATtiny412(???). However, based on personal experiences with both chips, the ATtiny is much easier to program through an RP2040 chip, even if it has less memory overall.
-
ATtiny is simpler and can perform basic tasks well enough (blinking LEDs)
-
SAMD has more memory and, because of that, it can handle more memory-intensive tasks
Design Workflow¶
Milling:
-
Get a PCB board and put nitto tape on the back
-
Take off the backing of the nitto tape and secure the board to the bed of the milling machine
-
Get the .nc or .brd file you need for milling (in our case, we had to turn a png into a .nc file)
-
Open Bantam and import the file
-
Follow a workflow to set up your file and machine before actually milling. A very simple general workflow is shown below. This workflow assumes certain settings.
-
After importing your file, choose what bits to use on it
-
Home and load the bit you chose
-
Change x, y, and z offsets if you need to
-
Perform a z-axis probe
-
Start milling!
-
If necessary, switch out bits during the job when prompted to
Soldering:
-
Check what components you need to solder onto your board (most likely available in a parts list)
-
Gather the parts needed
-
Open a schematic/.brd file on your computer so you can see which parts go where on the board as well as check for polarity
-
Take proper safety precautions and measures relative to the working environment
-
Begin soldering, there shouldn’t be many complications past this step
Programming (directly, not with RP2040):
-
Copy the following link: https://raw.githubusercontent.com/qbolsee/ArduinoCore-fab-sam/master/json/package_Fab_SAM_index.json
-
Open Arduino IDE, go to “Preferences” under the File dropdown, and paste the link into the “Additional Boards URLs” menu
-
Now, go to “Board” under the Tools dropdown menu and select “Boards Manager”, then type in Fab Sam Core.
-
Back in the Tools dropdown, select “Generic D11C14A” under “Board”
-
In the same dropdown menu as where you selected your board, go to “Bootloader Size” and choose “4KB_BOOTLOADER”
-
Again, in the same dropdown menu, go to Programmer and select “CMSIS-DAP”
-
Now, open your computer’s terminal (preferably Powershell) and enter some variation of the following (i.e. the -e, -b, etc. might be swapped): .\edbg-windows-r61.exe -b -p -v -e -t samd11 -f .\sam_ba_Generic_D11C14A_SAMD11C14A.bin
-
Write and upload code to your SAMD chip (make sure it’s plugged in first)
Comparison to ATtiny412 Workflow:¶
Milling:
- Very few differences besides the obvious fact that the files are different
Soldering:
- Different boards so different components, but overall procedure the same
- Connecting the SAMD to the computer does not require a UPDI connector board
Programming:
-
Instead of requiring JTAG and UPDI to turn the ATtiny412 into a programmable chip, the SAMD11CA14 requires the debugger edbg and the files that go with it. As such, it also does not require the use of an Arduino UNO board to boot JTAG onto the board.
-
The RP2040 does not need to be incorporated into the process.
-
A female-to-male USB cable needs to be used, meaning that a USB-c cable is unnecessary.
-
Different libraries used in Arduino IDE.
** File Downloads The files for the SAMD11C and accompanying data sheet can be downloaded here.