Skip to content

uartEnd: Unlock mutex before detaching rx and tx #554

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

Merged
merged 2 commits into from
Aug 4, 2017

Conversation

Raienryu97
Copy link
Contributor

This should solve the device freezing issue when Serial.end() is called

This should solve the device freezing issue when Serial.end() is called
@Raienryu97
Copy link
Contributor Author

Verified with the following code:

void setup(){
  Serial.begin(9600);
  delay(2000);
  Serial.println("Hello");
  Serial.begin(115200);
}

void loop(){
  Serial.println("Hello Again");
  delay(1000);
}

Serial Output

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0010,len:4
load:0x3fff0014,len:708
load:0x40078000,len:0
load:0x40078000,len:12168
entry 0x40078a68
������������� !⸮⸮⸮⸮⸮Again
Hello Again
Hello Again
Hello Again
Hello Again
Hello Again
Hello Again
Hello Again
Hello Again

@everslick
Copy link
Contributor

Ahh seems to be the issue with #513 as well...

@everslick
Copy link
Contributor

This indeed fixes my problem with Serial.end(), so im closing #513 ...

@@ -227,12 +227,12 @@ void uartEnd(uart_t* uart)
while(xQueueReceive(uart->queue, &c, 0));
vQueueDelete(uart->queue);
}
UART_MUTEX_UNLOCK();

uartDetachRx(uart);
uartDetachTx(uart);

uart->dev->conf0.val = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave this line inside the lock ;)

* Thanks to @me-no-dev for pointing it out that
   uart->dev->conf0.val can be inside mutex lock
@Raienryu97
Copy link
Contributor Author

Done @me-no-dev :)

@me-no-dev me-no-dev merged commit 41e36a7 into espressif:master Aug 4, 2017
Raienryu97 added a commit to Raienryu97/arduino-esp32 that referenced this pull request Aug 4, 2017
* uartEnd: Unlock mutex before detaching rx and tx

This should solve the device freezing issue when Serial.end() is called

* Unlock UART MUTEX only for detaching Rx and Tx

* Thanks to @me-no-dev for pointing it out that
   uart->dev->conf0.val can be inside mutex lock
@Raienryu97 Raienryu97 deleted the upstream branch August 4, 2017 09:13
Raienryu97 added a commit to Raienryu97/arduino-esp32 that referenced this pull request Aug 6, 2017
* uartEnd: Unlock mutex before detaching rx and tx

This should solve the device freezing issue when Serial.end() is called

* Unlock UART MUTEX only for detaching Rx and Tx

* Thanks to @me-no-dev for pointing it out that
   uart->dev->conf0.val can be inside mutex lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants