Hi,
I m using STM32F303xx. I configured STM_HAL for UART and it is working indepedent. But if ported same in chibi os then initilization is gettting complete, but uart is not sending any data to pc.
i checked many times but the result is same.
ST_HAL is not working in CHIBI_OS
Moderator: RoccoMarco
-
ep.hobbyiest
- Posts: 94
- Joined: Sun Jun 26, 2016 5:22 pm
- Has thanked: 4 times
- Been thanked: 1 time
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: ST_HAL is not working in CHIBI_OS
I would look into differences in IRQ vector names.
No enough info for any other meaningful suggestion.
Giovanni
No enough info for any other meaningful suggestion.
Giovanni
-
ep.hobbyiest
- Posts: 94
- Joined: Sun Jun 26, 2016 5:22 pm
- Has thanked: 4 times
- Been thanked: 1 time
Re: ST_HAL is not working in CHIBI_OS
Following is code i was trying in. I didn't used interrupt fot that.
I didn't change any IRQ vector address or other thing.
mcuconf.h
Code: Select all
void MX_USART1_UART_Init(void)
{
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7)); /* USART1 TX. */
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7)); /* USART1 RX. */
RCC->APB2ENR |= 0x00002000;
huart1.Instance = USART1;
huart1.Init.BaudRate = 19200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
huart1.Init.OneBitSampling = UART_ONEBIT_SAMPLING_DISABLED ;
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
HAL_UART_Init(&huart1);
HAL_UART_Transmit(&huart1,"Hello",5,1000);
}
I didn't change any IRQ vector address or other thing.
mcuconf.h
Code: Select all
#define STM32_UART_USE_USART1 FALSE
#define STM32_UART_USE_USART2 FALSE
#define STM32_UART_USE_USART3 FALSE
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: ST_HAL is not working in CHIBI_OS
I would check how the baud rate is calculated.
You are mixing HAL and ST HAL, that scenario is not supported, you should make a choice or be ready to address the possible issues.
Giovanni
You are mixing HAL and ST HAL, that scenario is not supported, you should make a choice or be ready to address the possible issues.
Giovanni
-
ep.hobbyiest
- Posts: 94
- Joined: Sun Jun 26, 2016 5:22 pm
- Has thanked: 4 times
- Been thanked: 1 time
Re: ST_HAL is not working in CHIBI_OS
Hi,
i was comfortable with STM HAL. So, i chose that.
following is the method , how baud rate is calculated.
baudrate = 19200;
are PCLK2 and APB2 same?
if yes, then it is 36Mhz.
i was comfortable with STM HAL. So, i chose that.
following is the method , how baud rate is calculated.
baudrate = 19200;
Code: Select all
//huart->Instance->BRR = clock / bau_rate;
huart->Instance->BRR = (uint16_t)(__DIV_SAMPLING16(HAL_RCC_GetPCLK2Freq(), huart->Init.BaudRate));
are PCLK2 and APB2 same?
if yes, then it is 36Mhz.
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: ST_HAL is not working in CHIBI_OS
ep.hobbyiest
Unfortunately Chibi HAL does not work with ST_HAL.
And I doubt Giovanni would do anything about that until STM come to him and pay for such work. That would be my dream
Unfortunately Chibi HAL does not work with ST_HAL.
And I doubt Giovanni would do anything about that until STM come to him and pay for such work. That would be my dream
-
ep.hobbyiest
- Posts: 94
- Joined: Sun Jun 26, 2016 5:22 pm
- Has thanked: 4 times
- Been thanked: 1 time
Re: ST_HAL is not working in CHIBI_OS
Hi,
Following is the what i tried but unfortunately same result.
Now i am trying with configuring register without STM_HAL.
So this time also not working. I am configuring USART register then also it is showing unchanged in register window.
here is my configuration.
here is attached snapshot.

Following is the what i tried but unfortunately same result.
Now i am trying with configuring register without STM_HAL.
So this time also not working. I am configuring USART register then also it is showing unchanged in register window.
here is my configuration.
Code: Select all
#define PCLK2_FREQ 36000000
#define BAUD_RATE 19200
#define USART_CR1_RE ((uint32_t)0x00000004) /*!< Receiver Enable */
#define USART_CR1_TE ((uint32_t)0x00000008) /*!< Transmitter Enable */
#define UART_OVERSAMPLING_16 ((uint32_t)0x0000)
#define UART_PARITY_NONE ((uint32_t)0x0000)
#define UART_WORDLENGTH_8B ((uint32_t)0x00000000)
#define USART_CR1_UE ((uint32_t)0x00000001) /*!< USART Enable */
#define UART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
void init(void)
{
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7)); /* USART1 TX. */
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7)); /* USART1 RX. */
// utils_sys_lock_cnt();
RCC->APB2ENR |= 0x00002000;
USART1->CR1 = (UART_WORDLENGTH_8B | UART_PARITY_NONE | UART_MODE_TX_RX | UART_OVERSAMPLING_16);
USART1->CR2 = UART_STOPBITS_1;
USART1->CR3 = (UART_HWCONTROL_NONE | UART_ONEBIT_SAMPLING_DISABLED);
USART1->BRR = PCLK2_FREQ/BAUD_RATE;
USART1->CR1 |= (USART_CR1_UE | 0x00000020);
}
here is attached snapshot.