Let's code a Linux Driver - 24: Serial (UART) Driver

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ธ.ค. 2024

ความคิดเห็น • 34

  • @steffenyount
    @steffenyount 2 ปีที่แล้ว +2

    Thanks for the shout out. Your new RPi is looking good!

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  2 ปีที่แล้ว

      Yes, and it is really quite a bit faster then the old one ;)

  • @fghoussen
    @fghoussen หลายเดือนก่อน

    What is the preferred way to process data in RT received by `receive_buf`? tasklet seems to be preferred to softirq, tasklets are deprecated, so it seems one should use threaded IRQ but it needs an IRQ nb/ID and I am not sure how to get the IRQ ID associated to the `receive_buf` callback... Any hint would be great!

  • @AMITKUMAR-ys4oe
    @AMITKUMAR-ys4oe ปีที่แล้ว

    Thanks. I was looking for serial device access from kernel and got this one. Also it is similar to platform drivers which helped me in easy understading.

    • @AMITKUMAR-ys4oe
      @AMITKUMAR-ys4oe ปีที่แล้ว

      Hi Johannes. Can you give some detail at time point 16.32 about how this serdev works.Thanks

  • @simonedallai48
    @simonedallai48 2 ปีที่แล้ว +1

    Great work! Good

  • @williamzhang907
    @williamzhang907 ปีที่แล้ว

    19:17 can you explain which uart is chosen by your driver?

  • @HungNguyen-gl2xt
    @HungNguyen-gl2xt 2 หลายเดือนก่อน

    "return serdev_device_write_buf(serdev, buffer, size);". In this line of your code. I think it intend to send the data back to your device like "Type something: " right?

  • @mehdidjait608
    @mehdidjait608 2 ปีที่แล้ว +2

    Hi Johannes :) Did you read the linux device drivers book (3rd edition) ? If yes, how helpful is it ? Is it very outdated ?

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  2 ปีที่แล้ว +2

      Hi, I have to admit, I didn't read the whole book, but parts of it. For example before writing PCI drivers, I read the chapter about PCI drivers. The book is quite good to get the idea and to understand the concepts. But sometimes the functions are outdated. For the PCI drivers, the function still exists, but only the old unmanaged functions and it is better to use the managed functions.
      There are newer books available, but I haven't read them. Overall the book is still good to understand the concepts and I would still recommend it :)

    • @savansanghavi7465
      @savansanghavi7465 2 ปีที่แล้ว

      @@johannes4gnu_linux96 how you have learn drivers

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  2 ปีที่แล้ว

      @@savansanghavi7465 I did my first steps with this (german) book:www.hanser-elibrary.com/doi/book/10.3139/9783446413627
      It only has a small driver chapter but it got me till creating device files. Some of my other sources you can find in my replay to a comment to this video: th-cam.com/video/Fflgq73bm58/w-d-xo.html
      Under most videos I have posted links to the sources I used.
      But I have to admit, a lot of times it was try and error ;)

  • @_Node_
    @_Node_ ปีที่แล้ว

    How can I change the buffer size in Linux on a Raspberry Pi to 65536 instead of the default 4096? Thank you.

  • @houchien8683
    @houchien8683 4 หลายเดือนก่อน

    I use it on beaglebone black to connect with putty, it shows "type something:" but when I type some characters, putty doesn't show anything, the kernel doesn't receive any characters either. Can you tell me where I'm wrong? I've fixed the device tree for beaglebone black.

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  4 หลายเดือนก่อน

      Good, question. I honestly don't know. Maybe you can check if an interrupt for the module is registered in /proc/interrupts.

    • @yusuftahaatalay4614
      @yusuftahaatalay4614 หลายเดือนก่อน

      Hello, I've been able to replicate this tutorial on my BBB. I set the baud rate to 115200, used UART1 in the DTS, and added /lib/firmware/BB-UART1-00A0.dtbo along with the overlay file from the tutorial. Then, on my main computer, I monitored ttyUSB0.

  • @AMITKUMAR-ys4oe
    @AMITKUMAR-ys4oe ปีที่แล้ว

    Will this driver not interfere with existing driver for this UART peripheral. The existing driver for this UART peripheral might have acquired the UART region.

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  ปีที่แล้ว +1

      Yes. And this is why you have to add the device tree overlay in the config.txt file so it is loaded on startup. After adding the overlay, the /dev/serialx device file of the uart used by your driver will not appear any longer, as this UART is used by the driver exclusively.

  • @RahulSharma-oi4es
    @RahulSharma-oi4es 2 ปีที่แล้ว +1

    Hi ! How do you print the dashed fonts ?

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  2 ปีที่แล้ว +2

      Hi,
      I use figlet to do this. You can find it in most standard repos.

    • @RahulSharma-oi4es
      @RahulSharma-oi4es 2 ปีที่แล้ว

      @@johannes4gnu_linux96 thanks for the reply,I will test and reply here

  • @anushbijoor3415
    @anushbijoor3415 ปีที่แล้ว

    Can this code be used for beagle bone black?

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  ปีที่แล้ว

      Yes, it should also work on the beaglebone. Maybe you have to change some names or numbers in the device tree overlay, but in general it should work.

  • @sanketwarhade3325
    @sanketwarhade3325 7 หลายเดือนก่อน

    this code work on the beagle bone back ???????????

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  7 หลายเดือนก่อน

      The code should work just fine. The only thing you must adopt is the device tree overlay as on the beagle bone maybe the serial port device you want to use has a different name.

  • @Architector120
    @Architector120 2 ปีที่แล้ว

    Please make a video on how to write a Linux framebuffer driver!

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  2 ปีที่แล้ว +1

      I will put it on my list and when I find some good material about it, I will do a video.

  • @lis6502
    @lis6502 2 ปีที่แล้ว +1

    Honestly speaking, i think that such tutorial would be more easy to understand and overall useful for averge Joe if you'd show how to make "/dev/rgb_led". Of course said Joe has to be into C and devices, however for me personally such driver for ws2812 addressable led, even driven internally via UART would be "more tactile" than serial echo device.
    Imagine simple arduino sketch: on input takes 9600 uart triplet of 8 bit values for each rgb channel and sends over to ws2812 led these values.
    then, device driver on linux would take 24bit input echoed to /dev/rgb_led and would send it over to arduino.
    i know, it's silly.

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  2 ปีที่แล้ว

      I choose the echo device, because for it you don't need any additional hardware but your Pi and an USB-UART Adapter. And this example covered both sending and receiving without making it too complicated.
      Maybe later I will do another video about a serial device. Maybe an Atmega with some buttons and leds.
      But I hope this video helped you anyway.

  • @ImSubodhPandey
    @ImSubodhPandey 2 ปีที่แล้ว

    Hi, Can you please write UART driver based on DMA?

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  2 ปีที่แล้ว

      Hi, I will do a video about DMA in the future. But after my USB series.

    • @ImSubodhPandey
      @ImSubodhPandey 2 ปีที่แล้ว

      @@johannes4gnu_linux96 Sure Thanks, waiting for extended part of UART driver data transfer through DMA.