Carbide

Overview

Carbide is an open-hardware development board designed to make prototyping and hacking with libtungsten easier. It embeds a 64-pin version of the SAM4LS microcontroller (offering 48 GPIOs) and a complete power supply chain allowing easy battery integration :

Pin muxing

As explained in the Pin muxing tutorial, the microcontroller allows a modular mapping of peripheral functions to output pins. The different functions available for each pin are summed up below.

Select all / none

All those pins use 3.3V logic levels and are not 5V compatible. Make sure you do not apply a voltage greater than 3.3V on any pin as you could damage the microcontroller.

Some of the pins are marked with a warning sign, which means that they are internally connected to another signal or peripheral and that you should be careful when using them. Here is the complete list :

• PA00 : red LED, affects line impedence
• PA01 : green LED, affects line impedence
• PA02 : blue LED and 82k pullup, affects line impedence
• PA03 : JTAG TMS / SWDIO line, flashing and debugging may fail if connected externally while using a JTAG/SWD adaptor
• PA04 : onboard user button with 82k pullup, affects line impedence and is forced to GND when the button is pressed
• PA23 : JTAG TDO, theorically unused for SWD but some SWD adaptors don't release this line properly; flashing and debugging may fail if connected externally while using a JTAG/SWD adaptor
• PA24 : JTAG TDI, theorically unused for SWD but some SWD adaptors don't release this line properly; flashing and debugging may fail if connected externally while using a JTAG/SWD adaptor
• PA25 : USB D-, do not connect externally when a USB data cable is plugged in; be especially careful not to apply a voltage greater than 5V on this pin as you could damage your computer's USB port! Using this pin is discouraged unless strictly necessary.
• PA26 : USB D+, do not connect externally when a USB data cable is plugged in; be especially careful not to apply a voltage greater than 5V on this pin as you could damage your computer's USB port! Using this pin is discouraged unless strictly necessary.

Embedded peripherals

Carbide features 3 LEDs (red, green and blue) and a push button in order to make prototyping easier. They are connected as follows :

• Red LED : PA00
• Green LED : PA01
• Blue LED : PA02
• Push button : PA04 (not PA03)

A 32.768kHz quartz is connected to the XIN32 and the XOUT32 lines on the MCU and serves as a moderately precise clock reference for the clock signals used internally. The data lines of the USB connector are connected to PA25 and PA26 (which can be mapped to the internal USB controller).

Debug interface

The 10-pin connector on the right side of the board is a standard SWD connector for flashing and debugging. See the JTAG/SWD vs Bootloader tutorial for more information.

Power chain

The board can be powered either from USB, from a battery, or from an external 3.3V power supply. The power chain is able to use a single cell LiPo battery (connected either to the standard JST connector or the VBAT pinheader) with an embedded charger, undervoltage protection and polarity protection. When a battery is connected the circuit will use it as the power source for the board; when an USB cable is plugged in the circuit will automatically switch to use the USB as the power source and start recharging the battery. The two LEDs next to the USB connector indicate the charging state : red when charging, green when finished.

The VBAT signal is directly connected to the + side of the JST battery connector. If your battery doesn't have a JST connector you can plug it to the VBAT header instead. In any case, when a battery is plugged in, make sure not to short-circuit the VBAT line, because it will short-circuit the battery. In order to be on the safe side, it is recommended to use a battery with an embedded PCM (Protection Circuit Module), such as the cheap 503035 batteries that you can find on eBay.

The maximum battery voltage admissible is 5.5V, which is well suited for a single cell LiPo battery. The embedded charger is only able to handle single cell batteries anyway. This voltage is routed through a simple polarity protection circuit, then through an undervoltage detector that will cut the power when the battery voltage falls below 3.0V. A power multiplexer is then used to switch between the USB voltage and the battery voltage according to what is available (with the USB having priority), and its output is given to a 3.3V LDO regulator to power the board. This voltage is available on the 3V3 header in order to power external peripherals and logic, however, keep in mind that the current limit for the 3.3V power source is 300mA.

When embedding a Carbide into a larger system, it is possible to power it directly through the 3V3 header using an external 3.3V power supply. However, make sure not to connect a USB cable or a battery at the same time, as the internal LDO regulator will conflict with the external power supply and this could damage one or both of them.

The Carbide module

The library offers a Carbide module inside carbide.cpp and carbide.h with helper functions to get you started quickly. In order to use it, make sure that you have defined CARBIDE=true in your Makefile.

Your main should start with a call to Carbide::init(). This will take care of the complete initialization of the board for you, including calling the mandatory Core::init(), switching the CPU to a faster 12MHz clock, and initializing the GPIOs for the LEDs and the push button.

See the Carbide module reference for more information.