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!
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.
"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?
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 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 ;)
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.
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.
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.
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.
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.
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.
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.
Thanks for the shout out. Your new RPi is looking good!
Yes, and it is really quite a bit faster then the old one ;)
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!
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.
Hi Johannes. Can you give some detail at time point 16.32 about how this serdev works.Thanks
Great work! Good
19:17 can you explain which uart is chosen by your driver?
"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?
Hi Johannes :) Did you read the linux device drivers book (3rd edition) ? If yes, how helpful is it ? Is it very outdated ?
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 :)
@@johannes4gnu_linux96 how you have learn drivers
@@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 ;)
How can I change the buffer size in Linux on a Raspberry Pi to 65536 instead of the default 4096? Thank you.
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.
Good, question. I honestly don't know. Maybe you can check if an interrupt for the module is registered in /proc/interrupts.
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.
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.
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.
Hi ! How do you print the dashed fonts ?
Hi,
I use figlet to do this. You can find it in most standard repos.
@@johannes4gnu_linux96 thanks for the reply,I will test and reply here
Can this code be used for beagle bone black?
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.
this code work on the beagle bone back ???????????
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.
Please make a video on how to write a Linux framebuffer driver!
I will put it on my list and when I find some good material about it, I will do a video.
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.
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.
Hi, Can you please write UART driver based on DMA?
Hi, I will do a video about DMA in the future. But after my USB series.
@@johannes4gnu_linux96 Sure Thanks, waiting for extended part of UART driver data transfer through DMA.