Uart receiver pb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-10 10:46 AM
i have established communication with a BLDC (Brushless DC) controller. Initially, i send a message to the controller using the function void sendParameter(uint8_t parameter). Following this transmission, the BLDC controller is expected to respond with a frame. Although the transmission process appears to be functioning correctly, the receiver is not operating as expected. i have confirmed this issue using a logic analyzer.
UART_HandleTypeDef huart1;
uint8_t buffer[10];
uint8_t senddata[4] = {0x66, 0x42, 0x00, 0xA8};
uint8_t transmitAllowed = 1;
-----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_USART1_UART_Init(void)
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
HAL_UART_Receive_IT(&huart1, buffer, 1);
}
void sendParameter(uint8_t parameter)
{
HAL_UART_Transmit_IT(&huart1, senddata, 4);
HAL_Delay(100);
}
*/
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_USART1_UART_Init();
HAL_UART_Receive_IT(&huart1, buffer, 10);
while (1)
{
readParameter(0x42);
}
Solved! Go to Solution.
- Labels:
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-11 08:12 AM
in polling mode, the receiver works well but remains different from what I expect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-11 08:37 AM
You're all over the map. First you post a screenshot that shows your buffer of 10 are all zeros and now you're showing a buffer of 14(?) with data.
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-11 08:41 AM
no first is with interruption mode ..there is no data..but now i'm using polling mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-11 08:56 AM
Sorry, i missed that you wrote polling.
Go back to interrupt mode. See if HAL_UART_ErrorCallback is called. If so, check the error code huart->ErrorCode
Here are the possible error codes
#define HAL_UART_ERROR_NONE 0x00000000U /*!< No error */
#define HAL_UART_ERROR_PE 0x00000001U /*!< Parity error */
#define HAL_UART_ERROR_NE 0x00000002U /*!< Noise error */
#define HAL_UART_ERROR_FE 0x00000004U /*!< Frame error */
#define HAL_UART_ERROR_ORE 0x00000008U /*!< Overrun error */
#define HAL_UART_ERROR_DMA 0x00000010U /*!< DMA transfer error */
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-12 05:01 AM
I looked with a LOgic to analyze the frame sent by stm32 and received by BLDC: I see that when I reduce the delay to 10 ms, I can receive data but not the exact expected frame
void sendParameter(uint8_t parameter)
{
HAL_UART_Transmit_IT(&huart1, senddata, 4);
HAL_Delay(100);//reduce the delay to 10 ms,
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-15 07:04 AM
HELLO,I resolved the problem and I want to share the solution with you: the issue is with the RX is always pulled down by the BLDC,, just I changed the brushless controller and all is ok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-15 09:46 AM
Thanks for sharing - be sure to also share this to your other threads about this problem.
- « Previous
- Next »