2017-07-03 07:49 AM
Hello again community !
I have next problem with my stm32F030RCT6. Problem is with receiving data from UART. In my project I am using all 6 UART’s that is why I can’t use DMA for all UART’s (this Mcu has no enough DMA channels). Problem is with about 30 % received frames by HAL_UART_Receive_IT() . With DMA receiving has no problem. While receiving bytes sometimes occurs faults. I am receiving one byte by one. For example USART settings:
Baud Rate: 115200 Word Length: 8 Bits Parity: NoneStop Bits: 1
Data Direction: Receive and Transmit
Over Sampling: 16 Samples
Single Sample: DisablePolarity: High
Assertion Time: 0 Sample Time Unit
Deassertion Time: 0 Sample Time Unit
...
Overrun: Enable
DMA on RX Error: Enable
MSB First: Disable
------------------------------ CLOCK -----------------------------
RCC: HSE - Crystal/Ceramic Resonator
LSE - Disable
When Baud Rate is set to 9600 everything is ok, there are no faults.
I did measurement by osciloscope:
Chanel 2: time spend in HAL_UART_Receive_IT() <-- one byte processing
Chanel 3: time when fault occurs (time spend in HAL_UART_ErrorCallback)
Chanel 4: UART RX pin
On screenshot You can see:
1. first byte of my frame 0x55 <-- this byte is processed correct - first peak on chanel 2
2. second byte of my frame 0x10 <-- with this byte is problem, because after it has no interrupt
3. third byte of my frame 0x02 <-- after this byte interrupt occurs, but in this time occurs also fault - second peak on chanel 2 and first peak on chanel 3
4. fourth byte of my frame 0x01 <-- after this byte and all other there are no faults, but all received frame is incorrect.
...
In received buffer are bytes: 0x55, 0x02, 0x01, 0x76, 0x00.... (there is no second byte --> 0x10) This time was problem with second byte, it is random...
While I am sending 100 that frames, faults have about 30% (70% are correct).
HAL_UART_GetError(); returns Overrun error, but not all time when fault occurs. When overrun error will appear USART 1 does not work any longer...
I did this measurement, because i want to know how long I am in
HAL_UART_Receive_IT() and when faults occurs...
Where is the problem ? What can I check ? What should I do ?Please help..
Dawid
Solved! Go to Solution.
2017-07-03 08:57 AM
Any potential for it to be in other interrupts of higher priority?
Can you have the transmitter of the data use 2 stop bits?
Are you viewing the USART internal state in a debugger?
2017-07-03 08:57 AM
Any potential for it to be in other interrupts of higher priority?
Can you have the transmitter of the data use 2 stop bits?
Are you viewing the USART internal state in a debugger?
2017-07-04 01:53 AM
Problem was with interrupts priority of course. I had no configured IRQ's priorities.
THANK YOU Clive One for fast answer and of course huge HELPPROBLEM SOLVED. TOPIC CLOSED FOR ME.