If I am using both UARTs on an SFR paged device, do I have to set SFRPAGE everytime I call printf()?
When both UARTs are used, the correct SFRPAGE must be set before any STDIO.h function (printf(), putchar(), scanf(), getchar(), etc.) is called, to ensure that the correct UART is accessed. Note that the SFRPAGE only needs to be set once when sequential STDIO.h functions are called to access the same UART. For example, if a printf() to UART0 is followed by a scanf() from UART0, the SFRPAGE only needs to be set before the printf(). However, if a printf() to UART1 is followed by a printf() to UART0, SFRPAGE must be set before each printf() call.
// STDIO calls to UART0 only SFRPAGE = UART0_PAGE; printf('Hello UART0'); printf('Goodbye UART0'); // STDIO call to UART0 followed by STDIO call to UART1 SFRPAGE = UART0_PAGE; printf('Hello UART0'); SFRPAGE = UART1_PAGE; printf('Hello UART1');
What customization options are available for the CP210x?
The CP210x device and drivers can be customized.
The PC uses the VID (vendor ID), PID (product ID), and serial number of a USB device to 'address' the device on the USB bus. Every device should have a unique combination of the three.
The AN220 USB Driver Customization software allows customization of the displayed device strings (Device Manager), VID/PID of the driver, and the associated driver file names. It is important that all of these be customized, as it will avoid conflicts with other products. AN220 can customize either a USBXpress driver or a VCP driver.
Silicon Laboratories offers to allocate a PID under the Silicon Laboratories VID free of charge, as owning a VID from the USB-IF organization costs a sizable annual fee. It is strongly recommended that each product (or family of products) from a company use a unique PID instead of using the default VID/PID. This will not only ensure that the product's customized driver will prevent conflict with other drivers in the market, but it will also prevent the driver from being accidentally uninstalled by another product's installer/uninstaller. The PID request information can be found in the article in the 'Related Articles' section.
The CP210x device must have the same VID and PID as the associated driver. Xpress Configurator in Simplicity Studio provides a means to change these values to match the driver as well as modify other options available in the CP210x EEPROM. AN721 USBXpress™ Device Configuration and Programming Guide provides more information on using Xpress Configurator and CP21xx Device Customization software.
For some CP210x devices, the AN205 Baud Rate Aliasing software customizes the supported baud rates and how the CP210x buffers data to the PC (USB Receive Timeout).
Furthermore, the AN223 Port Configuration and GPIO Customization software can define default settings for the CP210x GPIO on supported devices.
These device customization settings can be programmed in a production environment using the DLLs provided with the application notes. Silicon Labs can also pre-program devices with a minimum order of 1000 pieces (should be requested when ordering). Please contact your local Silicon Labs distributor for more information on device customization. To locate your local Silicon Labs distributor, click on the 'Buy or Sample' tab on the main Silicon Laboratories website and select your location after clicking on the 'Distributors' link.
All Application Notes can be found on the Silicon Laboratories Applications webpage: https://www.silabs.com/support/resources.ct-application-notes
How do I set the UART baud rate?
For an 'N/16' UART (example: UART0 on the C8051F12x), the minimum clock divisor for baud rate generation is 16.
The UART baud rate is determined by the overflow rate of the selected timer. Depending on the device, the available timers for baud rate generation my vary. The UART baud rate will be equal to the selected timer overflow rate divided by 16 when the 'SMODn' bit for the UART is equal to '1'. If 'SMODn' for the UART is equal to '0', the UART baud rate will be equal to the selected timer overflow rate divided by 32.
For example, to configure the UART for a baud rate of 9600 bps using Timer 2 as the baud rate source, you could configure the overflow rate of Timer 2 to equal 9600 * 16 = 153.6 kHz, and set 'SMODn' to '1'.
How do I set the UART baud rate?
For an 'N/2' UART (example: UART1 on the C8051F12x), the minimum clock divisor for baud rate generation is 2.
The UART baud rate is determined by the overflow rate of Timer 1. Specifically, the UART baud rate is equal to the Timer 1 overflow frequency divided by 2.
For example, to configure the UART for a baud rate of 9600 bps, you would configure the overflow rate of Timer 1 to equal 9600 * 2 = 19.2 kHz.
What is the difference between devices with a JTAG debug interface and a C2 debug interface?
JTAG is an industry-standard 4-wire interface. It is found on many of Silicon Labs' MCU devices in large pin-count packages, such as the C8051F12x family. The JTAG interface on all but the C8051F20x/22x/23x families includes full boundary scan capability for in-circuit testing. While the C8051F20x/22x/23x do not have boundary scan capabilities, they can still participate in a boundary scan chain in 'BYPASS' mode.
The JTAG standard requires four dedicated pins for functionality. On devices which have only a few pins, implementing a JTAG interface is not feasible. It is for this reason that the C2 interface was developed.
The C2 interface is a proprietary 2-wire serial debug interface used primarily on Silicon Labs' MCU devices in low pin-count packages, such as the C8051F30x family. The C2 debug interface shares its two serial pins with other device pins (normally /RST and a GPIO pin) to minimize the amount of hardware 'used up' by the debug interface.
The Debug Interface specific to your device can be set in the Silicon Labs IDE in the Tools -> Debug Interface menu. This setting must be correct in order to connect to a device using the IDE. A schematic for each target board, which contains hardware information on using these interfaces, can be found in the appropriate Development Kit User's Guide.