esl / erlang_ale

Erlang Actor Library for Embedded -- An embedded framework from Erlang Solutions
Apache License 2.0
207 stars 65 forks source link

Gpio interrupt is not working #23

Closed ethrbh closed 9 years ago

ethrbh commented 9 years ago

hello Frank,

I have started to check the Gpio interrupt again, and it looks something is not working again. I have cloned the latest ALE on the main branch, and did the same steps what I did last time when You had asked me to try out your ale2 branch before merge that into the main. So I have made a very simple Gpio connection to verify interrupts. Gpio-27 as input for receive interrupts, Gpio-22 as output for force generate interrupts. Once I have configured both Gpio and the interrupt condition, I started to change logical level of Gpio-22 for generate interrupt, but nothing has printed out in the erlang shell. I have expected something like this "Notif={gpio_interrupt,27,falling}, [<0.67.0>]" when an interrupt has happened.

I remember, at that time when I tried your ale2, the falling and raising conditions was not supported, only enabled, both, nonce an summarize conditions was supported. After a while you have notify me, that you re-enabled falling and raising conditions. I would like to ask you, does it possible that this last changes causes that the interrupt does not works at all? Or did I something wrong?

Please find all logs I made during my test.

    pi@raspberrypi ~/ethrbh/erlang_ale_master $ git clone https://github.com/esl/erlang_ale.git
    Cloning into 'erlang_ale'...
    remote: Counting objects: 900, done.
    remote: Compressing objects: 100% (6/6), done.
    remote: Total 900 (delta 0), reused 0 (delta 0), pack-reused 894
    Receiving objects: 100% (900/900), 641.70 KiB | 443 KiB/s, done.
    Resolving deltas: 100% (417/417), done.
    pi@raspberrypi ~/ethrbh/erlang_ale_master $ ls
    erlang_ale
    pi@raspberrypi ~/ethrbh/erlang_ale_master $ cd erlang_ale/
    pi@raspberrypi ~/ethrbh/erlang_ale_master/erlang_ale $ ls
    c_src  doc  examples  LICENSE  README.md  rebar.config  rebar.lock  src
    pi@raspberrypi ~/ethrbh/erlang_ale_master/erlang_ale $ rebar3 compile
    ===> Verifying dependencies...
    make: Entering directory '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src'
    cc -O3 -finline-functions -Wall -Wextra -Wno-unused-parameter -I /home/pi/ethrbh/tools/lib/erlang/erts-6.3/include/ -I /home/pi/ethrbh/tools/lib/erlang/lib/erl_interface-3.7.20/include  -c -o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/i2c_port.o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/i2c_port.c
    cc -O3 -finline-functions -Wall -Wextra -Wno-unused-parameter -I /home/pi/ethrbh/tools/lib/erlang/erts-6.3/include/ -I /home/pi/ethrbh/tools/lib/erlang/lib/erl_interface-3.7.20/include  -c -o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/gpio_port.o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/gpio_port.c
    cc -O3 -finline-functions -Wall -Wextra -Wno-unused-parameter -I /home/pi/ethrbh/tools/lib/erlang/erts-6.3/include/ -I /home/pi/ethrbh/tools/lib/erlang/lib/erl_interface-3.7.20/include  -c -o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/spi_port.o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/spi_port.c
    /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/spi_port.c: In function âspi_transferâ:
    /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/spi_port.c:105:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/spi_port.c:106:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    cc -O3 -finline-functions -Wall -Wextra -Wno-unused-parameter -I /home/pi/ethrbh/tools/lib/erlang/erts-6.3/include/ -I /home/pi/ethrbh/tools/lib/erlang/lib/erl_interface-3.7.20/include  -c -o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/erlcmd.o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/erlcmd.c
    cc -O3 -finline-functions -Wall -Wextra -Wno-unused-parameter -I /home/pi/ethrbh/tools/lib/erlang/erts-6.3/include/ -I /home/pi/ethrbh/tools/lib/erlang/lib/erl_interface-3.7.20/include  -c -o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/ale_main.o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/ale_main.c
    cc /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/i2c_port.o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/gpio_port.o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/spi_port.o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/erlcmd.o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/ale_main.o  -L /home/pi/ethrbh/tools/lib/erlang/lib/erl_interface-3.7.20/lib -lerl_interface -lei -o /home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/../priv/erlang-ale
    make: Leaving directory '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src'
    make: Entering directory '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src'
    make: '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/../priv/erlang-ale' is up to date.
    make: Leaving directory '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src'
    ===> Compiling erlang_ale
    pi@raspberrypi ~/ethrbh/erlang_ale_master/erlang_ale $ rebar3 shell
    ===> Verifying dependencies...
    make: Entering directory '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src'
    make: '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/../priv/erlang-ale' is up to date.
    make: Leaving directory '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src'
    make: Entering directory '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src'
    make: '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src/../priv/erlang-ale' is up to date.
    make: Leaving directory '/home/pi/ethrbh/erlang_ale_master/erlang_ale/c_src'
    ===> Compiling erlang_ale
    Erlang/OTP 17 [erts-6.3] [source] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]

    Eshell V6.3  (abort with ^G)
    1> {ok,P1}=gpio:start_link(27,input).
    {ok,<0.66.0>}
    2> {ok,P2}=gpio:start_link(22,output).
    {ok,<0.68.0>}
    3> gpio:register_int(P1).
    ok
    4> gpio:set_int(P1,both).
    ok
    5> gpio:write(P2,1).
    ok
    6> gpio:read(P1).
    1
    7> gpio:write(P2,0).
    ok
    8> gpio:read(P1).
    0
    9> erlang:process_info(P1).
    [{current_function,{gen_server,loop,6}},
     {initial_call,{proc_lib,init_p,5}},
     {status,waiting},
     {message_queue_len,0},
     {messages,[]},
     {links,[<0.64.0>,#Port<0.20678>]},
     {dictionary,[{'$ancestors',[<0.64.0>]},
                  {'$initial_call',{gpio,init,1}}]},
     {trap_exit,false},
     {error_handler,error_handler},
     {priority,normal},
     {group_leader,<0.62.0>},
     {total_heap_size,1597},
     {heap_size,610},
     {stack_size,9},
     {reductions,199},
     {garbage_collection,[{min_bin_vheap_size,46422},
                          {min_heap_size,233},
                          {fullsweep_after,65535},
                          {minor_gcs,1}]},
     {suspending,[]}]
    10> erlang:process_info(P2).
    [{current_function,{gen_server,loop,6}},
     {initial_call,{proc_lib,init_p,5}},
     {status,waiting},
     {message_queue_len,0},
     {messages,[]},
     {links,[<0.64.0>,#Port<0.20679>]},
     {dictionary,[{'$ancestors',[<0.64.0>]},
                  {'$initial_call',{gpio,init,1}}]},
     {trap_exit,false},
     {error_handler,error_handler},
     {priority,normal},
     {group_leader,<0.62.0>},
     {total_heap_size,610},
     {heap_size,610},
     {stack_size,9},
     {reductions,116},
     {garbage_collection,[{min_bin_vheap_size,46422},
                          {min_heap_size,233},
                          {fullsweep_after,65535},
                          {minor_gcs,0}]},
     {suspending,[]}]
    11>

thanks for your help, /Robi

ethrbh commented 9 years ago

hello, Upps, I did something wrong :-( There is no issue, interrupt works well. I will close this ticket.

sorry about this, /Robi