Jim

Jim

Elixir_ale question - do I need an interrupt driven solution?

Hi All…

I started an embedded project last year and got taken off it, and now I need to jump in again. This project, among many other things, needs to talk to a CAN bus. I’m prototyping on a Raspberry Pi 3 B+ and I have a CAN card that interfaces using SPI.

Having read through some posts, there is an implication that elixir_ale is not interrupt driven. I assume that my code would need to poll the SPI controller. In general, does this work, or will I need an interrupt driven solution?

If I do need an interrupt driven solution, I assume that means a kernel driver. Is there one available or would I have to write one?

Thanks very much…

Most Liked

fhunleth

fhunleth

Co-author of Nerves

Elixir is far enough away from hardware that I’m not sure interrupt-driven vs. non-interrupt-driven is going to be the main issue. You can poll GPIOs with elixir_ale or tell elixir_ale to send a message when the GPIO changes. The latter way is “kind of” interrupt-driven since nothing in the system is actively polling the GPIO. There’s a lot of software between the hardware and your Elixir code, so it won’t work as well as you’d expect. I think that it’s passable for event rates under 100 per second.

I’d personally look for a Linux kernel driver for this. Linux kernel drivers just work so much better when dealing with the low-level details of reacting to a GPIO changing and initiating SPI transactions. When the messages are fully received, Elixir makes handling the messages really convenient and is pretty efficient.

Just to add here, there was some work to make a NIF version of elixir_ale. An initial prototype worked really well - it was a couple orders of magnitude faster than elixir_ale. I had been helping someone out on it, but I think they’ve long since lost interest/gotten busy with other things. It would be another option if the kernel driver option won’t work for you and unfinished code doesn’t scare you.

Frank

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

We're in Beta

About us Mission Statement