rt-thread / rtthread-nano Goto Github PK
View Code? Open in Web Editor NEWnano version of RT-Thread
License: Apache License 2.0
nano version of RT-Thread
License: Apache License 2.0
根据官方文档,在 Ubuntu 上自行编译 RT-Thread Nano 中的例程 bsp/stm32f103-msh
,发现串口无法正常输入。
然后,测试 RT-Thread v4.0.3,使用例程 bsp/stm32/stm32f103-mini-system
,发现工作正常。
最后自行研究了两天,发现问题出在 Nano 版本的 bsp/stm32f103-msh/drivers/board.c
文件,原来代码是这样的:
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if (huart->Instance == USART2)
{
__HAL_RCC_USART2_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
/**USART2 GPIO Configuration
PA2 ------> USART2_TX
PA3 ------> USART2_RX
*/
GPIO_InitStruct.Pin = USART_TX_Pin | USART_RX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
}
改为:
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if (huart->Instance == USART2)
{
__HAL_RCC_USART2_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = USART_TX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* Configure USART Rx as alternate function push-pull */
GPIO_InitStruct.Pin = USART_RX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
}
然后再测试,就能正常输入了。
PS. 似乎串口的 Rx 必须设置为 GPIO_MODE_INPUT
我正在尝试将rtthread-nano移植到卡在系统时钟配置上的risc-v e310
配置系统时钟Created rt_hw_board_init()来调用开发板提供的功能来配置64MHz(如果我正确的话)
我被困在执行操作系统节拍
`void rt_hw_board_init()
{
...
rt_hw_timer_init(); //使用硬件计时器来实现时钟滴答,通常命名为rt_hw_timer_init()
...
}
int rt_hw_timer_init(void)//函数实现自身并需要加载中断服务程序
{
...
rt_hw_interrupt_install(IRQ_PBA8_TIMER2_3,rt_hw_timer_isr,RT_NULL,“ tick”);
rt_hw_interrupt_umask(IRQ_PBA8_TIMER2_3);
}
/ 中断服务程序 /
静态void rt_hw_timer_isr(int向量,void *参数)
{
rt_interrupt_enter();
rt_tick_increase();
rt_interrupt_leave();
}`
IRQ_PBA8_TIMER2_3是int类型的中断向量
我需要添加一些东西才能得到它。是开发板附带的api函数还是rtthread函数?
I am trying to port rtthread-nano to risc-v e310 stuck on the system clock configuration
Configure the system clock Created rt_hw_board_init () to call the function provided by the development board to configure 64MHz (if I am right)
I am stuck at implementing the OS beat
`void rt_hw_board_init ()
{
...
rt_hw_timer_init (); // use hardware timer to realize clock tick, generally named rt_hw_timer_init ()
...
}
int rt_hw_timer_init (void) // function implements itself and needs to load interrupt service routine
{
...
rt_hw_interrupt_install (IRQ_PBA8_TIMER2_3, rt_hw_timer_isr, RT_NULL, "tick");
rt_hw_interrupt_umask (IRQ_PBA8_TIMER2_3);
}
/ * Interrupt service routine * /
static void rt_hw_timer_isr (int vector, void * param)
{
rt_interrupt_enter ();
rt_tick_increase ();
rt_interrupt_leave ();
} `
IRQ_PBA8_TIMER2_3 is an interrupt vector of type int
I need to add something before to get it. Is it the api function or rtthread function that comes with the development board?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.