Skip to content

UART7 causes Nucleo F091RC to lock up #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TT-ZX opened this issue Jun 2, 2018 · 7 comments
Closed

UART7 causes Nucleo F091RC to lock up #260

TT-ZX opened this issue Jun 2, 2018 · 7 comments
Assignees
Labels
bug 🐛 Something isn't working
Milestone

Comments

@TT-ZX
Copy link

TT-ZX commented Jun 2, 2018

When I try to use Serial.print over UART7 on the Nucleo F091RC the MCU locks up.
Here is the code to demonstrate the issue:

HardwareSerial mySerial(PC7,PC6);

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  mySerial.begin(9600);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  mySerial.println("Hello World!");
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

The LED will turn on and stay on. Nothing is received from UART7
I am using V1.2.0 of STM32 Cores. I've tried earlier version but the result is the same. I am using version 1.8.5 of the Arduino IDE on Gentoo.

Can anyone else confirm this issue or know of a work around?

Thanks,
Justin

@fpistm
Copy link
Member

fpistm commented Jun 2, 2018

Hi, I will check next week with a F091.

Edit: It is well USART7.

@fpistm fpistm added the bug 🐛 Something isn't working label Jun 2, 2018
@TT-ZX
Copy link
Author

TT-ZX commented Jun 2, 2018

Is that something I can easily change and try or is it quite involved?

@TT-ZX
Copy link
Author

TT-ZX commented Jun 2, 2018

I tried UART3 - UART8 and got the same problem. Only UART1 and UART2 work for me.

@fpistm
Copy link
Member

fpistm commented Jun 2, 2018

F091 is a bit specific for UART.
I think issue is probably linked to uart irq handler.

#if defined(STM32F091xC) || defined (STM32F098xx)

Maybe you can try comment here:

if (__HAL_GET_PENDING_IT(HAL_ITLINE_USART7)!= RESET)

this test:
//if (__HAL_GET_PENDING_IT(HAL_ITLINE_USART7)!= RESET)

@TT-ZX
Copy link
Author

TT-ZX commented Jun 3, 2018

This works for all but UART6 and only works for one UART at a time. If I comment more that one of those tests, only the last UART works.

@fpistm
Copy link
Member

fpistm commented Jun 3, 2018

Ok thanks for the test. I will test and try to fix it for the next release.

@fpistm fpistm self-assigned this Jun 14, 2018
@fpistm fpistm added this to the 1.3.0 milestone Jun 14, 2018
@fpistm
Copy link
Member

fpistm commented Jun 14, 2018

Hi, @TT-ZX
I've found the issue.
__HAL_GET_PENDING_IT() read IT line status in SYSCFG register which required to be clocked.

This set of registers is implemented only on STM32F09x to collect all pending interrupt sources associated with each interrupt line into a single register.
This allows users to check by single read which peripheral requires service in case more than one source is associated to the interrupt line.

I've tested also with several USART in the same sketch:

HardwareSerial Serial7(PC7,PC6);
HardwareSerial Serial4(PA1,PA0);
HardwareSerial Serial3(PB_11,PB_10);

void setup() {
Serial3.begin(115200);
Serial4.begin(115200);
Serial7.begin(9600);
}

void loop() {
Serial3.println("Hello World I'm USART3!");
Serial4.println("Hello World I'm USART4!");
Serial7.println("Hello World I'm USART7!");
}

@fpistm fpistm closed this as completed Jun 14, 2018
@fpistm fpistm reopened this Jun 14, 2018
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this issue Jun 14, 2018
__HAL_GET_PENDING_IT() read IT line status in
SYSCFG register which required to be clocked.

This set of registers is implemented only on STM32F09x
to collect all pending interrupt sources associated with
each interrupt line into a single register.
This allows users to check by single read which peripheral
requires service in case more than one source is associated
to the interrupt line.

Fix stm32duino#260

Signed-off-by: Frederic Pillon <[email protected]>
@fpistm fpistm mentioned this issue Jun 14, 2018
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this issue Jun 15, 2018
__HAL_GET_PENDING_IT() read IT line status in
SYSCFG register which required to be clocked.

This set of registers is implemented only on STM32F09x
to collect all pending interrupt sources associated with
each interrupt line into a single register.
This allows users to check by single read which peripheral
requires service in case more than one source is associated
to the interrupt line.

Fix stm32duino#260

Signed-off-by: Frederic Pillon <[email protected]>
benwaffle pushed a commit to benwaffle/Arduino_Core_STM32 that referenced this issue Apr 10, 2019
__HAL_GET_PENDING_IT() read IT line status in
SYSCFG register which required to be clocked.

This set of registers is implemented only on STM32F09x
to collect all pending interrupt sources associated with
each interrupt line into a single register.
This allows users to check by single read which peripheral
requires service in case more than one source is associated
to the interrupt line.

Fix stm32duino#260

Signed-off-by: Frederic Pillon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants