1
votes

I'm writing a custom Raspberry Pi UART module for a school project and I think that my module is somehow conflicting with the default UART driver. Every time I write something into ttyAMA0 using fwrite, it returns a value equal to the length of the data I wrote, even though my module's write function always returns zero. Furthermore, when I make a new ttyAMA1 file using mknod and try writing into it, my module responds, but also returns the length of the data. So, my question would be how to disable the default RPI UART driver/module?

Module and test application code (transmit funcionality only): https://github.com/mixr26/sppurv-projekat

Any help would be much appreciated!

1
Not sure, but this might be what you need: raspberrypi.org/forums/viewtopic.php?t=55043 - Fiddling Bits
Raspi-config does the same thing, I've tried it, but it doesn't work. Thanks anyway. - Mihailo
You don't have anything close to direct access to your module (if it's even installed) from userland. See the diagrams in this article. Use the system log (e.g. the dmesg command) to get info about installed drivers. BTW your driver is ill behaved, i.e. it doesn't call request_mem_region() before using ioremap() " my question would be how to disable the default RPI UART driver/module?" -- How is your kernel configured: board file or DT? - sawdust
I don't think request_mem_region() has to be called, since the registers are memory mapped. Readin from and writing to registers is working as it should be. Raspbian is DT configured, at least for the external interfaces. - Mihailo
"I don't think..." -- If you prefer to argue rather than learn, why are you asking for advice? - sawdust

1 Answers

1
votes

I found the solution to the problem. Disabling serial interface in raspi-config disables the Raspbian driver (AMBA-PL011), but it also disables UART pins (GPIO14 and GPIO15) and that's why my module didn't work. I had to manually set the function of UART pins by changing the GPFSEL register in my module. After that, I could safely call request_mem_region() and register_irq(), without any errors. – Mihailo