Giter Club home page Giter Club logo

Comments (6)

bztsrc avatar bztsrc commented on July 27, 2024

Hey, thank you!
Indeed, that's a duplicate line! I'll check the 0xc6 issue too, because documentation not always up-to-date, and sometimes real hardware works differently. I'll look into that! Thanks again for noticing!

bzt

from raspi3-tutorial.

bztsrc avatar bztsrc commented on July 27, 2024

Ok, checked, it turned out everything is correct.

About 0xC6 in IIR, 6 stands for 2+4, so bits 1 and 2. Accoring to the docs, writing those bits in IIR should clear both the receiver and transmitter FIFO queues. So if you use 0xC0, your code will probably work most of the time (provided you've just turned on your Pi), but could act sometimes "strange" if certain conditions met (when there are leftover bytes in one of the queues, which could happen after a reset through a PM call). The best practice is to clear data registers (FIFO queues in this case) during initialization regardless their state, just to be on the safe side.

Also those IER lines really look like duplicates, but actually they are not. :-) The beauty of low level programming. The first clears the baud rate, the second disables the FIFO interrupts. We change the MMIO / AUX register mapping in line 53 by clearing DLAB bit in LCR when we set 8 bit data mode.

Cheers,
bzt

from raspi3-tutorial.

marcinszajner avatar marcinszajner commented on July 27, 2024

Awww I incorrectly read datasheet. Now I see, it was about read not a write condition.

Hmm DLAB bit in LCR shouldn't be reset state if we not set it somewhere before? If DLAB is set somewhere and we write 0 to IER register that mean we only clear MS 8bits from 16bit baudrate register isn't it?
Low level programing is as good as SoC documentation is good :D

from raspi3-tutorial.

bztsrc avatar bztsrc commented on July 27, 2024

Yes you are right about the DLAB bit. The code only clears MS 8bits after a turn on, after a PM reset DLAB should be 0, and I haven't set it explicitly before the first line. So it is a duplicated line after all :-) We can remove the first one probably, but I'll give it a test just to be sure. (Thankfully it doesn't matter because the code sets the baud rate register by using a different MMIO address too.)

Cheers,
bzt

from raspi3-tutorial.

marcinszajner avatar marcinszajner commented on July 27, 2024

If I find some other bug or something that look for me strange, do you want me to report it?

BTW, nice tutorial. It is really helped me a lot :)

from raspi3-tutorial.

bztsrc avatar bztsrc commented on July 27, 2024

Yes, but of course! Thank you very much, and I'm glad my tutorials were useful! :-)

Cheers,
bzt

from raspi3-tutorial.

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.