Comments (4)
Do you still miss bytes if you busyloop, instead of sleeping? I.e. what happens if you comment out the thread::sleep
line?
from esp-idf-hal.
Do you still miss bytes if you busyloop, instead of sleeping? I.e. what happens if you comment out the thread::sleep line?
Yes. And watchdog gets triggered
from esp-idf-hal.
i think i got it to work the following way:
let start = SystemTime::now();
const magic_buffer_size_plus_10: usize = 130;
const ticks_to_wait: u32 = 1;
let mut buffer : [u8; magic_buffer_size_plus_10] = [0; magic_buffer_size_plus_10];
while start.elapsed().unwrap().as_secs() < timeout {
match unsafe { uart_read_bytes(self.port, &mut buffer as *mut u8 as *mut _, magic_buffer_size_plus_10 as u32, ticks_to_wait) } {
-1 => /* error */,
val => {
for i in 0..val {
data.push(buffer[i as usize]);
}
}
};
}
I am still not 100% sure what is going on exactly but I suspect that current implementation of Read for Rx is inadequate when dealing withe spurs of data sent over a short period of time (600 bytes over just a few milliseconds in my particular case)
from esp-idf-hal.
With those kinds of bursts, in general, it is best to use the DMA, or at the very least interrupt-driven. Even when you busy loop the scheduler will swap out the task that your code is running in and you will easily lose data this way. I don't think the DMA has support in Rust just yet, but that may be something you wish to look at.
Thanks for issue! Closing as this doesn't seem to be a bug.
from esp-idf-hal.
Related Issues (20)
- One Wire Interface HOT 6
- Is there example for continuous ADC? HOT 4
- [Add] UART RS485 mode HOT 4
- Controlling a WS2812 LED HOT 8
- SPI Driver apparently not working as expected HOT 1
- Annotate configuration structs & enums with #[non_exhaustive]; add Enum::Other catch-all to configuration enums HOT 2
- Get actual running duty from LedcDriver?
- SDIO Support? HOT 2
- [Description fix] spi.rs DMA support description HOT 3
- UART read timeout? HOT 1
- [BUG] SPI sleep die at `async fn with_completion()` HOT 1
- Cannot open libclang.dll, LoadLibraryExW failed HOT 4
- Use SPI Bus for multiple Devices HOT 4
- Broken ADC readings on esp32c3 with `read_raw()` and `read()` HOT 6
- Panic on Peripherals access from concurrent async tasks HOT 2
- CAN issue on C6
- UartDriver as `embedded_io::Read` blocks until buffer is full HOT 3
- Sharing a SpiDriver between multiple Devices with different configs HOT 5
- Unable to find libclang: libclang.dll could not be opened: LoadLibraryExW failed HOT 1
- ESP32-C3-FH4 How to use gpio12 - 17 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-idf-hal.