This LinkSprite PWM shield adds 27 independent PWM channels to Arduino or pcDuino by using a dedicated PWM generation MCU: STM32F103C8T6. All the PWM pins of STM32 can support up to 5V.
The total number of PWM channels is 27. The duty cycle can be adjusted. The channel number is labeled on the shield as below:
The four jump headers next to pwm 27 are for the selection of communication ports, such as SPI, UART and I2C. Right now, the sample code we provide has only SPI interface.
The external power supply is specified to be between 7V to 24V. The three pins header SWD is for firmware download to STM32.
The PWM shield has 27 PWM channels in total. Among these 27 channels, the 16 channels implemented by hardware in STM32 are 2, 3, 4, 7, 8, 9, 10, 11, 17, 18, 19, 20, 22, 23, 24 ,25, and are divided into four groups. The channels within the same group has same output frequency, but with different adjustable duty cycles. Channels 2, 3, 4, and 7 are in the same group, channels 8, 9, 10, 11 are in the same group, 17, 18, 19, 20 are in the same group, and 22, 23, 24, 25 are in the same group. The other channels are implemented by software, and each channel has its own frequency, but the higher the frequencies, the worse the resolution.
The communication protocol is as following:
/****************************Message format***************************************
index Byte1 Byte2 Byte3 Byte4 Byte5 Byte6
mean START CMD INDEX VALUE_L VALUE_H CHECK_SUM
********************************************************************************/
The command has 6 bytes in total:
The command starts with a first byte “0x87”.
The second byte is the commands that need to be executed. The supported one are following:
#define CMD_SET_ON_OFF 0x01 (Turn on or off)
#define CMD_SET_POLARITY 0x02 (Polarity of the signal)
#define CMD_SET_FREQ 0x03 (Frequency of the signal)
#define CMD_SET_DUTY 0x04 (Duty cycle of the signal)
Description of the parameters:
1. The range of the duty cycle is between 0-10000, which corresponds to 0-100%.
2. The precision of the channels implemented by software is 5uS, and the ones implemented by hardware is 0.5uS.
Leave a Reply
You must be logged in to post a comment.