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

Fix panics for UART #434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix panics for UART #434

wants to merge 1 commit into from

Conversation

Volkalex28
Copy link
Contributor

  • Default rx/tx_buffer_size in uart_driver_install
    This is necessary because esp-idf requires a non-zero buffer size for the UART (see this issue)

  • Make not covered ResetReason as Unknown
    I believe that this applies to the UART, since for me the only ResetReason that is not covered is a reset via the UART (for example, by pressing Ctrl+R when connected via espflash). I don’t see a problem making this reason as unknown. As for me, panicking when trying to get ResetReason is not the best idea

- Default rx/tx_buffer_size in uart_driver_install
- Make not covered ResetReason as Unknown
esp_reset_reason_t_ESP_RST_BROWNOUT => Self::Brownout,
esp_reset_reason_t_ESP_RST_TASK_WDT => Self::TaskWatchdog,
esp_reset_reason_t_ESP_RST_DEEPSLEEP => Self::DeepSleep,
_ => unreachable!(),
_ => Self::Unknown,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't mind altering it so that Self::Unknown becomes a catch all.

But: you are not fixing the root cause why it panicked in the first place, isn't it?

  • It didn't panic because of esp_reset_reason_t_ESP_RST_UNKNOWN because we have that branch
  • It panicked because of something else

So... how about we map this something else (whatever it is) in the match statement? I mean in addition to the change you introduce here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. I'll look at the reset reason code and add it to the enum. @ivmarkov Did you mean this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes.

src/uart.rs Show resolved Hide resolved
} else {
0
},
UART_FIFO_SIZE * 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

However.... why do we need this? Are you having problems with TX as well, or are you doing it "just in case"? IMO this is not necessary, because the TX assert is slightly different: https://github.com/espressif/esp-idf/blob/a322e6bdad4b6675d4597fb2722eea2851ba88cb/components/driver/uart/uart.c#L1589

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. Cancel changes

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.

2 participants