Jump to content

Why to create a driver


metRo_

Recommended Posts

Hello all,

I was reading the following topic when question myself about the advantages of write a driver for a device instead of write the SPI communication stuff on my application like vlad59 that use a python script to access the devices.

 

 

Thank you

Link to comment
Share on other sites

2 minutes ago, metRo_ said:

I was reading the following topic when question myself about the advantages of write a driver for a device instead of write the SPI communication stuff on my application like vlad59 that use a python script to access the devices.

It's not about creating a driver. It's about creating a configuration that would allow loading already existing kernel drivers. It doesn't matter much for simple I2C/SPI sensors, but it is required if you want to use advanced features like triggers, interrupts, automatic calculations or want to have better performance and reliability (if you want to read the sensor as many times per second as possible and don't want to rely on userspace code)

Link to comment
Share on other sites

I tried to talk (bitbanging) with a DS18B20 (One Wire temperature sensor) some years ago with a pretty loaded Raspberry pi : I started with Python and it worked 30% of the time, with C 50% of the time. All because of timing issues / preemptive kernel / threads ...

With the kernel module, I had almost no problem. Here I saw a big win with kernel drivers.

With I2C sensors I never had to tweak anything even if I used cpuburn at the same time but I may be lucky.

But I agree with Zador, it heavily depends on your use case, I check the value of ambient temperature every 5 minutes so there's nothing critical here. If we talked about relays it's another story.

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines