-
Notifications
You must be signed in to change notification settings - Fork 140
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
Bbq uarte #186
base: master
Are you sure you want to change the base?
Bbq uarte #186
Conversation
@@ -25,3 +26,6 @@ lto = false | |||
debug = true | |||
lto = true | |||
opt-level = "s" | |||
|
|||
[patch.crates-io] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hack and should be reverted
nrf52832-hal = { version = "0.11", features = ["rt"], optional = true } | ||
nrf52840-hal = { version = "0.11", features = ["rt"], optional = true } | ||
|
||
nrf-hal-common = { version = "0.11", features = ["bbq-uarte"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: I need to plumb this feature to the hals
@@ -0,0 +1,7 @@ | |||
target remote :2331 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be deleted
let (rxd_prod, rxd_cons) = self.rxd_buf.try_split().map_err(|e| Error::Bbqueue(e))?; | ||
|
||
// hmmm | ||
let hw_timer = match Timer::INTERRUPT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should probably add a better way to do this
OutgoingLen: ArrayLength<u8>, | ||
IncomingLen: ArrayLength<u8>, | ||
{ | ||
pub fn try_split<Timer: TimerInstance, Channel: Ppi + ConfigurablePpi, Uarte: UarteInstance>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty gross API
@@ -0,0 +1,132 @@ | |||
#![no_std] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Document this is for the DWM1001-DEV
// This is overly restrictive. See (similar SPIM issue): | ||
// https://github.com/nrf-rs/nrf52/issues/17 | ||
if rx_buffer.len() > u8::max_value() as usize { | ||
return Err(Error::TxBufferTooLong); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error was wrong. I did fix it below.
@@ -368,9 +386,18 @@ pub enum Error { | |||
BufferNotInRAM, | |||
} | |||
|
|||
pub trait Instance: Deref<Target = uarte0::RegisterBlock> {} | |||
pub trait Instance: Deref<Target = uarte0::RegisterBlock> { | |||
#[cfg(feature = "bbq-uarte")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put this behind a flag because it's technically a breaking change I guess? I could be convinced it isn't though
|
||
/// Stop an unfinished UART read transaction and flush FIFO to DMA buffer | ||
pub(crate) fn uarte_cancel_read<T: Instance>(uarte: &T) { | ||
uarte.events_rxto.write(|w| w); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: I added this line, but I don't know why. I need to re-read the datasheet and make sure I wasn't just debugging something odd.
if error { | ||
self.uarte.events_error.write(|w| w); | ||
} | ||
if rxdrdy { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RX FIFO is only flushed if !endrx, but the rxrdy will still be cleared if set.
If e.g. more than block_size but less than 2*block_size is received, rxdrdy will be cleared and therefore will not be flushed on the following timeout
No description provided.