Open schurwanzn-stabl opened 1 year ago
Can you actually contribute a Pr that fixes this? I admit I did not review carefully the RMT driver at the time, and it was a contribution.
Fixing the code seems a bit more involved and we currently do not use the non-blocking function. Thus I can't contribute a fix for now, sorry.
When
TxRmtDriver::write_items
is called withblock = false
https://github.com/esp-rs/esp-idf-hal/blob/29806afcd3fc87759825d4da6895e473ca0c4e68/src/rmt.rs#L607-L613 the called functionrmt_write_items
will keep reading from the passed pointer until the transmission is completed. The borrow on theS: Signal
though "expires" oncewrite_items
returns. For example when calling theTxRmtDriver::start
function https://github.com/esp-rs/esp-idf-hal/blob/29806afcd3fc87759825d4da6895e473ca0c4e68/src/rmt.rs#L589-L597 the ESP-IDF may access dropped memory.Aside from that the documentation of
rm_write_items
states to "please [?] do not use the memory allocated from psram when calling rmt_write_items". This restriction is not enforced either. Should I create a separate issue for this?