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

Uart driver for peripherals #429

Open
Firstyear opened this issue Jul 11, 2023 · 3 comments
Open

Uart driver for peripherals #429

Firstyear opened this issue Jul 11, 2023 · 3 comments

Comments

@Firstyear
Copy link

Hi there,

I have recently been using an atmega328p with avr-rs. I have a seeduino MR24HPC1 human presence sensor, which I would like to use with this board. However, the communication of the MR24HPC1 is over uart, and the atmega328p appears to only support uart on pins 0 and 1 - which are not exposed on the board, and are already used for usb-uart communication.

So provided I haven't missed something hugely wrong, from what I can see currently there is no way to use uart peripherals via avr-rs with boards like this. Curiously it works in arduino, likely via a software uart driver rather than a hardware one.

Is there a way that I can solve the problem? Does avr-rs support software uart? Or is there a way I have missed to assign extra pins to be supported for uart peripherals?

Thanks!

@SPanner0
Copy link

SPanner0 commented Oct 24, 2023

I have the exact same issue. I'm writing a driver for a sensor that uses UART as its only communication method but it's blocked on boards with only one hardware serial pin used for USB communication. The USART struct seems to be locked into using the default hardware serial pins with no way to use other pins.

From what I can tell, a library probably has to be written to support a software serial feature, similar to the official Arduino library.

However, I'm not sure if that's a feasible thing to achieve. Perhaps someone more experienced and familiar with the matter could chime in?

Thank you.

Edit: I found this crate that provides bit banging functionality, including for serial communication. It seems to have collected a bit of dust, though. I'll check it out and report back.

@stappersg
Copy link
Contributor

I'll check it out and report back.

"Stop procrastinating"

And for those that did not get the joke:

image

@SPanner0
Copy link

LOL! So sorry for taking so long. I've been trying bitbang_hal but I got stuck trying to create a serial object from the crate and I was too embarrassed to admit it.

Apparently, it requires something that impls CountDown and Periodic defined in embedded_hal, but I couldn't find anything like that in arduino_hal (I'm using the Arduino Uno board to test).

I figured it wasn't wise to spend so much time on a mere school project since I'm on a time limit. However, if anyone can help me get past this issue. I'd be happy to give it another shot.

Cheers.

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

No branches or pull requests

3 participants