-
Notifications
You must be signed in to change notification settings - Fork 173
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
Pin Direction Change compiles but does not seem to be working and produces weird Info Log messages that I can not supress: #409
Comments
I can at least help you with the watchdog I think (if you are fine with slight jitter), (Which you might need to do from time to time anyway to not fail out of wifi or other stuff that the os manages in background) |
This messages come from the underlying esp-idf system and are hardcoded log messages. And for whatever reason they decided to have a info log level on a specifc api call we do. You can reduce the loglevel either at compile time via sdkconfig entry or in your code calling the esp-idf log api. The former is simpler and can be done via the different LOG options by either reducing the default log level or the maximum level. ( add
There are logs that come from our api and there are logs that come from the esp-idf system itself. In your case you are seeing esp-idf system logs. You can find out more in the offfical esp-idf doc
They are, you just don't see it in the logs. The reason is: on a state transition (for example from output -> input) we need to reset the pin to a known good state, than applying the new state. The logs only show you the "resetting" part where everything seams to be off but not the new state part. From memory you would see the other transaction if you would increase the log level to debug. |
@empirephoenix Why is the unsafe function vTaskDelay any better than just having the delay.delay_ms(18); either way it has to be outside the tight loop or it would mess up our timing. Also do you have a complete main.rs showing how to use this along with the cargo changes. There is also FreeRtos::delay_ms(1000); which I think may call vTaskDelay. What I have found out of experimental testing is that anything less than 18ms yields timeouts and it doesn't seem to matter which delay function I call. What I really want is what I had in TI MSP430 SDK and AVR SDK which was the equivalent to resetWatchDog() it is just a counter so it should not require any delay other than the time to change the counter value. On the ESP IDF Page It mentions esp_task_wdt_reset() I think this is what we need. I am hoping that somebody has either written the safe wrappers for this or can at least give me a quick main.rs that demonstrates it use through unsafe calls. |
@Vollbrecht Thanks for the Hint. The actual CONFIG_LOG_MAXIMUM_LEVEL_WARN=y did not remove the offensive log entries but you got me looking in the right direction. The code started working correctly when I updated the file sdkconfig.defaults with the following lines: Thanks for the help, I really appreciate it. |
It is not better, but basically there are only two ways for a delay, busy loop or suspending the task and returning to freertos. the delay object will switch between both ways, based on the threshold it has configured. Since you are using the default threshold, is why you need to use a rather long delay to feed the watchdog. You can either set that threshold lower, or just directly tell the os, that you want to delay for only as short as possible (vTaskDelay(1) , tho no guarantees that it will not be longer if some other task blocks the cpu). Also check what you use for CONFIG_FREERTOS_HZ as that determines the minimum delay you can archive Anyway since you are on one of the dual core esp32 you can also just do |
we go of topic here but i want to still clarify this: each core has its own IDLE task. Resetting the watchdog from a higher prio task than the idle task itself is fighting a symptom not a cause. You can increase the time till a watchdog will trigger, and you dont need to delay in every itteration of your hot loop. You just need to give up some cpu execution time in the total time intervall ( E.g every 5 sec on default iirc). The idle task itself has also some other housekeeping stuff todo besides just updating the watchdog, so its good practice to give it a chance to run, For further info you can read on the official docu in esp-idf about the IDLE task. Also for general question please use the matrix chat channel we provide. |
The source-code below compiles but produces a informational log entry every time I try to change the pin direction
I tried to suppress it in the code with feature flags in the TOML and on the command line.
You can see logger config commented out. I also tried with the command line
RUST_LOG=none cargo run --release
which had no affect.If I understand the log message below it should be cycling state between inputEn:1 and OutputEN:1 as I toggle
the pin direction back and forth. Since it is not doing so I am guessing the change from input to output mode is
failing.
Please Help:
as I use the csense_in.into_output()?; and cout.into_input()?;
SAMPLE OF LOG MESSAGES I CAN NOT DISABLE
Sample Source
from https://github.com/joeatbayes/embedded-rust-examples/tree/main/ex-gpio-change-pin-direction-var-cap-read-1-pin
CARGO FILE
Arduino Sketch that works with Same Logic on Same Hardware and Same Circuit
The text was updated successfully, but these errors were encountered: