一直都觉得115200bps的波特率低,这种感觉像极了当年觉得9600bps太慢而升级到了115200bps的前夜。 雅特力AT32F437官方的数据手册说明串口最高波特率高达9Mbps!我想试试! 以串口发送为例,主要是我没有其它硬件设备可以发送9Mbps的能力,我们再通过示波器来观察串口的波特率。 串口发送的代码我们参考官方示例库中的usart里的polling工程,源代码如下: - static void usart1_init(void)
- {
- gpio_init_type gpio_init_struct;
- crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
- crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
- gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
- gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
- gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
- gpio_init_struct.gpio_pins = GPIO_PINS_9 | GPIO_PINS_10;
- gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
- gpio_init(GPIOA, &gpio_init_struct);
- gpio_pin_mux_config(GPIOA, GPIO_PINS_SOURCE9, GPIO_MUX_7);
- gpio_pin_mux_config(GPIOA, GPIO_PINS_SOURCE10, GPIO_MUX_7);
- usart_init(USART1, 9000000, USART_DATA_8BITS, USART_STOP_1_BIT);
- usart_parity_selection_config(USART1, USART_PARITY_NONE);
- usart_transmitter_enable(USART1, TRUE);
- usart_receiver_enable(USART1, TRUE);
- usart_enable(USART1, TRUE);
- }
- static void usart1_send_bin(uint8_t dat)
- {
- while (usart_flag_get(USART1, USART_TDBE_FLAG) == RESET)
- {
- ;
- }
- usart_data_transmit(USART1, dat);
- }
可以看到雅特力AT32F437平稳地发出了9Mbps的串口数据0x55。
好吧!我承认,我仅仅希望其能稳定工作在1Mbps波特率上。
|