Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blinkchain OS process died with status: 1 #29

Open
davydog187 opened this issue May 25, 2020 · 6 comments
Open

blinkchain OS process died with status: 1 #29

davydog187 opened this issue May 25, 2020 · 6 comments

Comments

@davydog187
Copy link

Hello! I'm hoping you can point me in the right direction. I'm having no luck with my first Nerves experience past blinky 😢

I'm running on a rpi4 and was running into this error with my NeoPixel matrix. I was wondering if I had faulty hardware, so I bought a NeoPixel ring to test with as well. I'm getting the same error. I'm wondering if my configuration is bad, or maybe I'm wiring something incorrectly? Any assistance would be helpful.

I've tried setting the dma_channel to 10, moving it to different GPIO ports, with no luck. Any advice for how to debug further?

15:39:19.022 [error] GenServer Blinkchain.HAL terminating
** (RuntimeError) blinkchain OS process died with status: 1
    (blinkchain 1.0.0) lib/blinkchain/hal.ex:192: Blinkchain.HAL.receive_from_port/1
    (blinkchain 1.0.0) lib/blinkchain/hal.ex:113: Blinkchain.HAL.handle_info/2
    (stdlib 3.11.2) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.11.2) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.11.2) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: :init_canvas
State: %Blinkchain.HAL.State{config: %Blinkchain.Config{canvas: %Blinkchain.Config.Canvas{height: 1, width: 12}, channel0: %Blinkchain.Config.Channel{arrangement: [%Blinkchain.Config.Strip{count: 12, direction: :right, origin: {0, 0}, spacing: 1}], brightness: 32, gamma: nil, invert: false, number: 0, pin: 18, type: :grb}, channel1: %Blinkchain.Config.Channel{arrangement: [], brightness: 255, gamma: nil, invert: false, number: 1, pin: 0, type: :gbr}, dma_channel: 5}, port: #Port<0.42>, subscriber: nil}
@davydog187
Copy link
Author

I pushed up my code here https://github.com/davydog187/wire

@mlapping
Copy link

@davydog187, The Blinkchain.HAL.State in your error message appears to define 2 channels, but your config only defines 1. Any idea why that might be?

%Blinkchain.HAL.State{
  config: %Blinkchain.Config{
    canvas: %Blinkchain.Config.Canvas{
      height: 1, 
      width: 12
    }, 
    channel0: %Blinkchain.Config.Channel{
      arrangement: [
        %Blinkchain.Config.Strip{
          count: 12, 
          direction: :right, 
          origin: {0, 0}, 
          spacing: 1
        }
      ], 
      brightness: 32, 
      gamma: nil, 
      invert: false, 
      number: 0, 
      pin: 18, 
      type: :grb
    }, 
    channel1: %Blinkchain.Config.Channel{
      arrangement: [], 
      brightness: 255, 
      gamma: nil, 
      invert: false, 
      number: 1, 
      pin: 0, 
      type: :gbr
    }, 
    dma_channel: 5
  }, 
  port: #Port<0.42>, 
  subscriber: nil
}

My understanding is that Blinkchain will create an OS process for each channel, so the error message you're receiving might be that the process can't communicate with pin0 on :channel1.

I'd be curious what happens when you remove :channel1

@davydog187
Copy link
Author

@mlapping i'm not configuring that channel, it looks like Blinkchain always expects there to be two channels, and that is the default for channel1.

I'll fork Blinkchain and see if removing channel1 fixes the problem

@davydog187
Copy link
Author

Note that it also seems the HAL GenServer also has this expectation

init_channel(1, config.channel1, port)

@edwardzhou
Copy link

Hello! I'm hoping you can point me in the right direction. I'm having no luck with my first Nerves experience past blinky 😢

I'm running on a rpi4 and was running into this error with my NeoPixel matrix. I was wondering if I had faulty hardware, so I bought a NeoPixel ring to test with as well. I'm getting the same error. I'm wondering if my configuration is bad, or maybe I'm wiring something incorrectly? Any assistance would be helpful.

I've tried setting the dma_channel to 10, moving it to different GPIO ports, with no luck. Any advice for how to debug further?

15:39:19.022 [error] GenServer Blinkchain.HAL terminating
** (RuntimeError) blinkchain OS process died with status: 1
    (blinkchain 1.0.0) lib/blinkchain/hal.ex:192: Blinkchain.HAL.receive_from_port/1
    (blinkchain 1.0.0) lib/blinkchain/hal.ex:113: Blinkchain.HAL.handle_info/2
    (stdlib 3.11.2) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.11.2) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.11.2) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: :init_canvas
State: %Blinkchain.HAL.State{config: %Blinkchain.Config{canvas: %Blinkchain.Config.Canvas{height: 1, width: 12}, channel0: %Blinkchain.Config.Channel{arrangement: [%Blinkchain.Config.Strip{count: 12, direction: :right, origin: {0, 0}, spacing: 1}], brightness: 32, gamma: nil, invert: false, number: 0, pin: 18, type: :grb}, channel1: %Blinkchain.Config.Channel{arrangement: [], brightness: 255, gamma: nil, invert: false, number: 1, pin: 0, type: :gbr}, dma_channel: 5}, port: #Port<0.42>, subscriber: nil}

this issue could be unrecognized hwver by ws281x library. check it out in remote iex shell (ssh nerves.local)

iex> filename = "/srv/erlang/lib/blinkchain-1.0.0/priv/blinkchain"
iex> args =  ["10", "18", "60", "grb", "0", "0", "gbr"]
iex> port =
     Port.open({:spawn_executable, filename}, [
         {:args, args},
         {:line, 1024},
         :use_stdio,
         :stderr_to_stdout,
         :exit_status
      ])

iex> flush

that is, if you got following output

{#Port<0.110>,
 {:data,
  {:eol,
   'blinkchain: ws2811_init failed: -3 (Hardware revision is not supported)'}}}
{#Port<0.110>, {:exit_status, 1}}

I have looked into rpi_ws281x source code. in rpihw.c

...

static const rpi_hw_t rpi_hw_info[] = {
    //
    // Raspberry Pi 4
    //
    {
        .hwver = 0xA03111,
        .type = RPI_HWVER_TYPE_PI4,
        .periph_base = PERIPH_BASE_RPI4,
        .videocore_base = VIDEOCORE_BASE_RPI2,
        .desc = "Pi 4 Model B - 1GB"
    },
    {
        .hwver = 0xB03111,
        .type = RPI_HWVER_TYPE_PI4,
        .periph_base = PERIPH_BASE_RPI4,
        .videocore_base = VIDEOCORE_BASE_RPI2,
        .desc = "Pi 4 Model B - 2GB"
    },
    {
        .hwver = 0xC03111,
        .type = RPI_HWVER_TYPE_PI4,
        .periph_base = PERIPH_BASE_RPI4,
        .videocore_base = VIDEOCORE_BASE_RPI2,
        .desc = "Pi 4 Model B - 4GB"
    },
    //
    // Model B Rev 1.0
    //
    ....

there are two probable issues, one is absent of "Pi 4 Model B - 8GB", the other is the .hwver is changed for the latest Pi4 devices.

I have two Pi4 versions (2GB and 8GB)

#  2GB version

ex> cat "/proc/cpuinfo"

Hardware	: BCM2835
Revision	: b03114
Serial		: 10000000fe99db45
Model		: Raspberry Pi 4 Model B Rev 1.4

# 8GB version

iex> cat "/proc/cpuinfo"

Hardware	: BCM2835
Revision	: d03114
Serial		: 1000000068680c0c
Model		: Raspberry Pi 4 Model B Rev 1.4

for 2GB version, the hwver is changed to b03114, but the it is defined as b03111 in rpihw.c.

fix the revisions in rpihw.c

static const rpi_hw_t rpi_hw_info[] = {
    //
    // Raspberry Pi 4
    //
    {
        .hwver = 0xA03114,
        .type = RPI_HWVER_TYPE_PI4,
        .periph_base = PERIPH_BASE_RPI4,
        .videocore_base = VIDEOCORE_BASE_RPI2,
        .desc = "Pi 4 Model B - 1GB"
    },
    {
        .hwver = 0xB03114,
        .type = RPI_HWVER_TYPE_PI4,
        .periph_base = PERIPH_BASE_RPI4,
        .videocore_base = VIDEOCORE_BASE_RPI2,
        .desc = "Pi 4 Model B - 2GB"
    },
    {
        .hwver = 0xC03114,
        .type = RPI_HWVER_TYPE_PI4,
        .periph_base = PERIPH_BASE_RPI4,
        .videocore_base = VIDEOCORE_BASE_RPI2,
        .desc = "Pi 4 Model B - 4GB"
    },
    {
        .hwver = 0xD03114,
        .type = RPI_HWVER_TYPE_PI4,
        .periph_base = PERIPH_BASE_RPI4,
        .videocore_base = VIDEOCORE_BASE_RPI2,
        .desc = "Pi 4 Model B - 8GB"
    },
    //
    // Model B Rev 1.0
    //
   

recompile the project, it works for my case.

@edwardzhou
Copy link

Frankly speaking, exchanging data via STDIO is an inefficient, workaround solution. expecting the more native way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants