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

Bbq uarte #186

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Bbq uarte #186

wants to merge 3 commits into from

Conversation

jamesmunns
Copy link
Member

No description provided.

@@ -25,3 +26,6 @@ lto = false
debug = true
lto = true
opt-level = "s"

[patch.crates-io]
Copy link
Member Author

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"] }
Copy link
Member Author

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
Copy link
Member Author

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 {
Copy link
Member Author

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>(
Copy link
Member Author

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]
Copy link
Member Author

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);
Copy link
Member Author

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")]
Copy link
Member Author

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);
Copy link
Member Author

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.

@jamesmunns jamesmunns mentioned this pull request Jul 23, 2020
if error {
self.uarte.events_error.write(|w| w);
}
if rxdrdy {
Copy link

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

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