Skip to content
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

[TW#13144] uart_set_line_inverse() can not set mask back to 0 #673

Closed
zelll opened this issue Jun 6, 2017 · 8 comments
Closed

[TW#13144] uart_set_line_inverse() can not set mask back to 0 #673

zelll opened this issue Jun 6, 2017 · 8 comments

Comments

@zelll
Copy link
Contributor

zelll commented Jun 6, 2017

As mentioned in #489 , uart_set_line_inverse() does not allow a 0 mask. Then there is not a way to clear line inverse. Is it a bug?

UART_CHECK((((inverse_mask & ~UART_LINE_INV_MASK) == 0) && (inverse_mask != 0)), "inverse_mask error", ESP_FAIL);

@hwmaier
Copy link
Contributor

hwmaier commented Jun 6, 2017

What would be the use case for having it to clear again?

I would have thought for a given hardware you either set it or don't depending on your physical layer hardware but never have to change it after you done your hardware initialisation.

@negativekelvin
Copy link
Contributor

Possibly if you were talking on a multidrop rs485 bus and switching between different phy settings?

@hwmaier
Copy link
Contributor

hwmaier commented Jun 6, 2017

Ok, if you have to change phys during run-time, then it is useful.

Looking at the code it is intended to work, and uart_set_line_inverse(port, 0) does work and clears it.

@zelll
Copy link
Contributor Author

zelll commented Jun 6, 2017

I'm adding IDF uart driver to nodemcu. I think someone may want to re-configure uart. Maybe a 485 bus, may be uart controlled by switches...

@hwmaier I added some logs to uart_set_line_inverse(), it does return before clearing the register.

    ESP_LOGE(UART_TAG, "### 1");
    UART_CHECK((((inverse_mask & ~UART_LINE_INV_MASK) == 0) && (inverse_mask != 0)), "inverse_mask error", ESP_FAIL);
    ESP_LOGE(UART_TAG, "### 2");

outputs:

[0;31mE (2952) uart: ### 1[0m
[0;31mE (2952) uart: uart_set_line_inverse(195): inverse_mask error[0m
[0;32mI (2992) uart: queue free spaces: 3[0m

@hwmaier
Copy link
Contributor

hwmaier commented Jun 6, 2017

You are right, this appears to be a bug. I think the logic should be:

 UART_CHECK((((inverse_mask & ~UART_LINE_INV_MASK) == 0) || (inverse_mask == 0)), "ixnverse_mask error", ESP_FAIL);

@negativekelvin
Copy link
Contributor

Isn't that redundant though because if inverse_mask=0 the first test will be true

@hwmaier
Copy link
Contributor

hwmaier commented Jun 6, 2017

Yes, so the test could be even more simplified.

@FayeY FayeY changed the title uart_set_line_inverse() can not set mask back to 0 [TW#13144] uart_set_line_inverse() can not set mask back to 0 Jun 9, 2017
igrr pushed a commit that referenced this issue Jul 5, 2017
1. uart_set_line_inverse API issue, #673
2. tx buffer length issue, #710
igrr pushed a commit that referenced this issue Jul 7, 2017
1. uart_set_line_inverse API issue, #673
2. tx buffer length issue, #710
@FayeY
Copy link
Collaborator

FayeY commented Aug 1, 2017

Hi @zelll , is this problem solved now? Can we close this issue?

@zelll zelll closed this as completed Aug 3, 2017
0xFEEDC0DE64 pushed a commit to 0xFEEDC0DE64/esp-idf that referenced this issue May 5, 2021
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

No branches or pull requests

4 participants