Giter Club home page Giter Club logo

Comments (8)

sajattack avatar sajattack commented on June 2, 2024

I think @keithduncan had a similar issue. I'll do some digging.

from atsamd.

sajattack avatar sajattack commented on June 2, 2024

Try commenting line 190 w.rxc().set_bit of hal/src/sercom/uart.rs and let me know if that fixes it.

from atsamd.

mogenson avatar mogenson commented on June 2, 2024

Thanks for the suggestion. The above loopback example works if the INTSET.RXC bit is not set during init.

                        // sercom.usart().intenset.modify(|_, w| {
                        //     w.rxc().set_bit()
                        //     //w.txc().set_bit()
                        //     //w.dre().set_bit()
                        // });

Does the atsamd crate define a SERCOM0 interrupt handler somewhere I can't find? Or does the first SERCOM0 interrupt go to the cortex-m-rt default handler infinite loop?

How can I define my own interrupt handler? The following didn't work for me.

use hal::interrupt;

#[interrupt]
fn SERCOM0() {
}

from atsamd.

sajattack avatar sajattack commented on June 2, 2024

Nah, I don't think you need to define an interrupt handler, I think I accidentally turned it on when I shouldn't have.

from atsamd.

mogenson avatar mogenson commented on June 2, 2024

Fixed with 06aa04d

from atsamd.

keithduncan avatar keithduncan commented on June 2, 2024

I found I had to use interrupts due to receives being asynchronous, it will depend on what you’re connecting to on the other end and whether it sends you any unsolicited bytes. You might run in to a receive overrun error if you don’t read the received bytes quick enough.

I’ve copied a serial example I used to test the sercom configuration into a gist.

I’m using interrupt reads in my project and am happy to keep this in my fork. Maybe the interrupt mode in use should be an argument to the UART constructor?

from atsamd.

keithduncan avatar keithduncan commented on June 2, 2024

I also had to use the external crystal for reliable communication with my modem (GenericClockController::with_external_32kosc).

I also ended up hiding the UART serial interface behind a ring buffer. This made it easier to consume the asynchronous byte stream in the rest of my program and might be worth adding to the hal or another crate.

from atsamd.

sajattack avatar sajattack commented on June 2, 2024

I'd welcome improvements to the hal's uart rx routine.

from atsamd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.