Cannot get Heartbeat app to work

Hello - I am new to this so not sure if I’m missing something or not…
so I installed the heartbeat app onto my MangOH Red and it is running… but the LED on the board is not flashing, and the push button is not doing anything either
Here is the link to the app: https://github.com/mangOH/Heartbeat
Here are the apps that are running:
root@swi-mdm9x15:~# app status
[running] atService
[running] audioService
[running] avcCompat
[running] avcService
[running] cellNetService
[running] dataConnectionService
[running] dataRouter
[running] devMode
[stopped] drTool
[running] fwupdateService
[running] gpioService
[running] modemService
[running] mqttClient
[running] positioningService
[running] powerMgr
[stopped] redSensorToCloud
[running] secStore
[stopped] smsInboxService
[running] socialService
[stopped] spiService
[stopped] tools
[stopped] voiceCallService
[stopped] wifi
[stopped] wifiApTest
[stopped] wifiClientTest
[running] wifiService
[stopped] wifiWebAp
[stopped] sms
[stopped] asimpleblinky
[running] cf3GpioControl
[running] heartbeatRed
[running] gpioExpanderServiceRed

Any help would be great! Let me know if I need to clarify something!

Please take a look at this post and make sure that the relevant GPIOs are owned by Linux.

not sure what I am looking at here but:
root@swi-mdm9x15:~# microcom -E /dev/ttyAT
at+wiocfg?
+WIOCFG: 2,16,0,0,1,0,0
+WIOCFG: 6,16,0,0,1,0,0
+WIOCFG: 7,16,0,0,1,0,0
+WIOCFG: 8,16,0,0,1,0,0
+WIOCFG: 13,16,0,0,1,0,0
+WIOCFG: 21,16,0,0,1,0,0
+WIOCFG: 22,16,0,0,1,0,0
+WIOCFG: 23,16,0,0,1,0,0
+WIOCFG: 24,16,0,0,1,0,0
+WIOCFG: 25,16,0,0,1,0,0
+WIOCFG: 28,0,0,0,1,0,0
+WIOCFG: 29,0,0,0,1,0,0
+WIOCFG: 30,0,0,0,1,0,0
+WIOCFG: 31,0,0,0,1,0,0
+WIOCFG: 32,16,0,0,1,0,0
+WIOCFG: 33,16,0,0,1,0,0
+WIOCFG: 34,0,0,0,1,0,0
+WIOCFG: 35,16,0,0,1,0,0
+WIOCFG: 36,0,0,0,1,0,0
+WIOCFG: 37,0,0,0,1,0,0
+WIOCFG: 42,16,0,0,1,0,0

OK

on the sample code, it seems like the generic button and LED are on pins 14 and 34. I tried at+wiocfg=34,14 but that gave me an error

Hey,

I had the same problem as you. Running at+wiocfg=34,16 (not 34,14) seems to be working (LED blinks). Have not tried the button yet.

After talking with @dfrey, I have been informed that on the Red the GPIO Expander and the IoT Expander conflict. Therefore currently it is needed to remove the dependency on the button. This is done by making three changes.

In the ADEF under bindings the first one (mangoh_button) should be commented out.

In the CDEF under API the first line (mangoh_button) should be commented out.

In the source file the function “PushButtonHandler” should be commented out. Also in the function “ConfigureGpios” the section “Set the push-button as GPIO as input” should be commented out (approximately 4 lines of code).

This issue stems from a conflict between the kernel module for the IoT expander and the userspace controller for the GPIO expander. This issue may be resolved later but currently only limits the use of a few things (one being the push button) connected to the GPIO expander.

Kas

Hello Kas,

I’m not a software guy and I’m trying to build experience on the mangOH red.
I thought toggling an LED would be a nice exercise to learn to create a project app, compile and download. I’m using developer studio.
I’ve tried to use GPIOConfig or Heartbeat samples but no success so far.
I’m using legato 17.6 on dev studio and also 17.6 on the WP85.

About Heartbeat:
I followed your instructions (comment out the press-button stuff) but still do not see my LED toggling.
The console also reports a binding issue with “heartbeat.heartbeatComponent.mangoh_led -> gpioService.le_gpioPin34”

Did you encounter a similar binding issue? Were you able to solve it? Is the app correctly toggling the LED on your mangOH red?

Thanks in advance!!

Gilles

Hello @Gilles,

I would suggest checking that you can write to that GPIO first, the instructions for this are as such:

SSH into the target and then do the following steps:

  1. cd /sys/class/gpio
  2. echo 34 > export
  3. cd gpio34
  4. cat direction (should be set to out, so we’ll change it)
  5. echo out
  6. cat value (should be set to 0, LED off to so we’ll turn it on)
  7. echo 1 > 1 (at this point the LED should be on, you can use 0 to turn it off)

Let me know if this works. I did for me when I worked through it the first time, I’m currently getting an error but I’m assuming it’s a permission thing I would need to resolve. Maybe @dfrey can weigh in on this error.

root@swi-mdm9x15:/sys/devices/i2c-0/0-003a/swimcu-gpio/gpio/gpio34# echo 1 > value
sh: write error: Operation not permitted

I hope this gets you moving in the right direction.

Kas

Thanks a lot Kas, wil give it a try and keep you informed!
Gilles

yes I’m receiving the same error
root@swi-mdm9x15:/sys/class/gpio# echo 34 > export
sh: write error: Operation not permitted

and under Dev Studio I get a missing biding “gpioCf3Demo.gpioCf3PinComponent.le_gpioPin34 → gpioService.le_gpioPin34” which I had declared in adef. Must be related to the same error.

@dfrey I used your fix Controlling WP_GPIO_1 / GPIO22 problem - #7 by nilsarve , It didn’t t help. I am using legato 17.6 framework and also on target (mangoh red WP85).
If it can help you can TeamViewer on my environment.

Cheers. Gilles

Hello Gilles,

have you tried using

microcom -E /dev/ttyAT (exit this mode using ctrl+x)
at+wiocfg?

if you see that “+WIOCFG: 34,16,0,0,1,0,0” then I’m not sure. But if the second number is not 16 then run “+wiocfg=34,16” and reattempt the steps mentioned above. Let me know if this helps or not.

Kas

1 Like

good morning Kas,

sending
at+wiocfg?
returns
+WIOCFG: 34,0,0,0,1,0,0

once I send a +wiocfg=34,16, the USB2 interface seems to crash, no answer or prompt anymore!?

I assume you mean that you are doing all of this in on the target (after SSHing into it). I also assume you mean to type “AT+wiocfg-34,16”.

From what I understand this should not affect the USB (I’d have to double check the schematics but it shouldn’t) as this is basically telling the OS that you want to allow GPIO 34 to be controlled by user space.

I would try power cycle the unit and try the commands again to see if you can get GPIO 34 to be under user control.

Kas

Kas,

I am connected to the mangOH with 2 USB connections:

  • USB console: on “top” (same side than WP) through Putty and to which I send AT-commands
  • USB CF3 on other side connecting to legato/dev studioenvironment.

I now tried to send the commands from the CF3 connector (using the SSH connect) and it seems to work!
I can do a “at+wiocfg=34,16” and it returns "“+WIOCFG: 34,16,0,0,1,0,0” so I can “set” the 16.

What would be the next AT-command to turn the LED ON?
I have tried about everything “at+wiocfg=34,16,1,1,1”, “at+wiocfg=34,16,1,1,3”, “at+wiocfg=34,16,1,0,1”, “at+wiocfg=34,16,1,0,3” but still no LED ON!?

Kas,
latest update, LED finally blinking :=)
“AT+wiocfg=34,16” seems to make the difference.
Now will have to understand how to add this into the code.
Thanks so much for your support!! :ok_hand::raised_back_of_hand:

@Gilles,

You should not need to add this to your code. Once set it should work from then on. I’m not sure how an update affects this but at the least its not something that should come up for a long while. Therefore you shouldn’t need to include it into your code .

Happy programing and project building
Kas

great thanks so much for your help on all this!

At+wiocfg=34,16 work fine for me too.
Without my app seems to be frozen when I use this output to drive the led.

Is not possible to set it by software ?

1 Like

Francis,
yes At+wiocfg=34,16 also works fine here!
Gilles