Date   

Re: micro:bit GPIO read always returning 1

Martin Woolley <mwoolley@...>
 

As easy as that? 😊

 

OK, apparently I don’t understand what the documentation says for the flags:

 

GPIO_INT

GPIO pin to trigger interrupt.

GPIO_INT_EDGE

Do Edge trigger.

 

So, what I’m concluding is that you need to specify GPIO_INT to enable interrupts on the pin and then another flag like GPIO_INT_EDGE to say when in the signal processing you want the interrupt to occur? If so... makes sense (now). I thought saying GPIO_INT_EDGE was enough to enable interrupts *and* to say they should occur on edge. My bad.

 

Works anyway, thanks once again. Works even better with GPIO_INT_DEBOUNCE as well.

 

All the best

 

Martin

 

From: Vitor [mailto:vitor@...]
Sent: 22 February 2018 12:40
To: Martin Woolley <mwoolley@...>; zephyr-users@...
Subject: Re: [Zephyr-users] micro:bit GPIO read always returning 1

 

Hi Martin,

 

On Thu, Feb 22, 2018 at 6:06 AM, Martin Woolley <mwoolley@...> wrote:

thanks a lot for your guidance. Changing my pin config to

 

gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN );

 

without changing the circuit, now produces the behaviour I wanted.

 

Great!

 

If instead of polling, I want to use interrupts to trigger a call back when the pin goes either high or low, what should my pin config be? I’m getting no call back with the following:

 

  gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH );

  gpio_init_callback(&gpio_trigger_cb, triggered, BIT(PIN_0));

  gpio_add_callback(gpiob, &gpio_trigger_cb);

  gpio_pin_enable_callback(gpiob, PIN_0);

 

 

Just add this flag GPIO_INT on gpio_pin_configure():

gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH );

BR,

iha

 

 

 


Re: micro:bit GPIO read always returning 1

Vitor Massaru Iha
 

Hi Martin,


On Thu, Feb 22, 2018 at 6:06 AM, Martin Woolley <mwoolley@...> wrote:

thanks a lot for your guidance. Changing my pin config to

 

gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN );

 

without changing the circuit, now produces the behaviour I wanted.


Great!
 

If instead of polling, I want to use interrupts to trigger a call back when the pin goes either high or low, what should my pin config be? I’m getting no call back with the following:

 

  gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH );

  gpio_init_callback(&gpio_trigger_cb, triggered, BIT(PIN_0));

  gpio_add_callback(gpiob, &gpio_trigger_cb);

  gpio_pin_enable_callback(gpiob, PIN_0);

 


Just add this flag GPIO_INT on gpio_pin_configure():

gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH );

BR,
iha




Re: BLE reason codes

Carles Cufi
 

Hi Johannes,

 

Right, I see. No particular reason, feel free to send a pull request with the missing ones (at least the ones relevant to BLE).

 

Regards,

 

Carles

 

From: Johannes Hutter [mailto:johannes@...]
Sent: 22 February 2018 11:05
To: Cufi, Carles <Carles.Cufi@...>; zephyr-users@...
Subject: Re: [Zephyr-users] BLE reason codes

 

Hey Carles,

my question is whether there is a reason why not all of them are defined. Especially all the connection related errors (0x08: Connection Timeout, 0x0B Connection Already Exists etc.) are not defined but they are helpful if I want to change the application behavior based on the disconnection raeson.

Best regards,
Johannes

On 22.02.2018 10:35, Cufi, Carles wrote:

Hi Johannes,

 

Here they are:

 

https://github.com/zephyrproject-rtos/zephyr/blob/master/include/bluetooth/hci.h#L93

 

You can find the rest in the Bluetooth Specification, Vol 2. Part D.

 

Regards,

 

Carles

 

From: zephyr-users-bounces@... [mailto:zephyr-users-bounces@...] On Behalf Of Johannes Hutter
Sent: 22 February 2018 10:32
To: zephyr-users@...
Subject: [Zephyr-users] BLE reason codes

 

Hello Zephyr community,

 

if the connection between a BLE peripheral running Zephyr and a central device is lost, the "disconnected" callback is fired that passes the "reason code". I can't find any definitions of those disconnect reasons in the included bluetooth headers, but as I understand it they are part of the HCI error codes. Is there a reason not all of the possible error codes are defined in hci.h?

 

Thanks and best regards,

Johannes

--

Johannes Hutter | Embedded Software Engineer
Mail: johannes@...

Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320

 


Re: BLE reason codes

Johannes Hutter
 

Hey Carles,

my question is whether there is a reason why not all of them are defined. Especially all the connection related errors (0x08: Connection Timeout, 0x0B Connection Already Exists etc.) are not defined but they are helpful if I want to change the application behavior based on the disconnection raeson.

Best regards,
Johannes


On 22.02.2018 10:35, Cufi, Carles wrote:

Hi Johannes,

 

Here they are:

 

https://github.com/zephyrproject-rtos/zephyr/blob/master/include/bluetooth/hci.h#L93

 

You can find the rest in the Bluetooth Specification, Vol 2. Part D.

 

Regards,

 

Carles

 

From: zephyr-users-bounces@... [mailto:zephyr-users-bounces@...] On Behalf Of Johannes Hutter
Sent: 22 February 2018 10:32
To: zephyr-users@...
Subject: [Zephyr-users] BLE reason codes

 

Hello Zephyr community,

 

if the connection between a BLE peripheral running Zephyr and a central device is lost, the "disconnected" callback is fired that passes the "reason code". I can't find any definitions of those disconnect reasons in the included bluetooth headers, but as I understand it they are part of the HCI error codes. Is there a reason not all of the possible error codes are defined in hci.h?

 

Thanks and best regards,

Johannes

--

Johannes Hutter | Embedded Software Engineer
Mail: johannes@...

Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320


 


Re: BLE reason codes

Carles Cufi
 

Hi Johannes,

 

Here they are:

 

https://github.com/zephyrproject-rtos/zephyr/blob/master/include/bluetooth/hci.h#L93

 

You can find the rest in the Bluetooth Specification, Vol 2. Part D.

 

Regards,

 

Carles

 

From: zephyr-users-bounces@... [mailto:zephyr-users-bounces@...] On Behalf Of Johannes Hutter
Sent: 22 February 2018 10:32
To: zephyr-users@...
Subject: [Zephyr-users] BLE reason codes

 

Hello Zephyr community,

 

if the connection between a BLE peripheral running Zephyr and a central device is lost, the "disconnected" callback is fired that passes the "reason code". I can't find any definitions of those disconnect reasons in the included bluetooth headers, but as I understand it they are part of the HCI error codes. Is there a reason not all of the possible error codes are defined in hci.h?

 

Thanks and best regards,

Johannes

--

Johannes Hutter | Embedded Software Engineer
Mail: johannes@...

Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320

 


BLE reason codes

Johannes Hutter
 

Hello Zephyr community,


if the connection between a BLE peripheral running Zephyr and a central device is lost, the "disconnected" callback is fired that passes the "reason code". I can't find any definitions of those disconnect reasons in the included bluetooth headers, but as I understand it they are part of the HCI error codes. Is there a reason not all of the possible error codes are defined in hci.h?


Thanks and best regards,

Johannes

--

Johannes Hutter | Embedded Software Engineer
Mail: johannes@...


Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320


Re: Bluetooth mesh support of ble 5 features

Johan Hedberg
 

Hi Ashish,

On Thu, Feb 22, 2018, ashish.shukla@corvi.com wrote:
I want to know, does present version of mesh support features of bluetooth
5 such as long range?

If yes, how can I control transmitting power of radio, to limit or extend
range of signal ?
The 1.0 version of the Bluetooth Mesh Profile specification is built for
4.0 or newer Bluetooth versions, and as such any later features are not
part of it. That said, there are some benefits you get with HCI-based
stacks using Bluetooth 5.0 controllers, such as a lowered minimum
advertising interval (20ms in 5.0 compared to 100ms in earlier
versions).

Johan


Bluetooth mesh support of ble 5 features

ashish.shukla@corvi.com <ashish.shukla@...>
 

Hi Johan,

I want to know, does present version of mesh support features of bluetooth 5 such as long range?

If yes, how can I control transmitting power of radio, to limit or extend range of signal ?

--
Warm regards,
Ashish Shukla
Jr. Embedded Engineer
Research & Development


Please consider the environment before printing this e-mail or its attachments.

Disclaimer: The information contained herein (including any accompanying documents) is confidential and is intended solely for the addressee(s). If you have erroneously received this message, please immediately delete it and notify the sender. Also, if you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this message or any accompanying document is strictly prohibited and is unlawful. The organization is not responsible for any damage caused by a virus or alteration of the e-mail by a third party or otherwise. The contents of this message may not necessarily represent the views or policies of Corvi


Re: micro:bit GPIO read always returning 1

Vitor Massaru Iha
 

Hi Martin,

On Wed, Feb 21, 2018 at 10:08 AM, Martin Woolley <mwoolley@...> wrote:

Zephyr newbie question. I’m trying to poll an external pin on a micro:bit. I have a rocker switch with pull up resistor connected to it and the circuit works (tested with code written with microbit-dal APIs). My Zephyr GPIO reads always return 1, however. What am I doing wrong?



In order for the resistor to function as a pullup it must be placed before the switch, ie between PIN_0 and the VCC.
But note that you configured the GPIO port with the pullup flag, And the switch is connected between PIN_0 and VCC.
So the expected result is always 1.

Try to set the the GPIO port this way:

1)
gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN );
Without the resistor, It should work with the resistor, but that way it's unnecessary.

2) or
gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN);
And connect the resistor between PIN_0 and GND;

There're other options, but I think you understand.

BR,
iha


Re: Unable to find the Kconfig program 'conf'

Martin Woolley <mwoolley@...>
 

Ah OK, thanks a lot. That explains it 😊 I was following the Getting Started Guide which I think still recommends just using the Windows cmd shell: http://docs.zephyrproject.org/getting_started/installation_win.html

 

I’m generally a Cygwin user so MSYS2 should be a pleasure.

 

From: Cufi, Carles [mailto:Carles.Cufi@...]
Sent: 21 February 2018 16:51
To: Martin Woolley <mwoolley@...>; zephyr-users@...
Subject: RE: Unable to find the Kconfig program 'conf'

 

Hi Martin,

 

Native Windows builds (i.e. without using MSYS2) were not supported in 1.10.

If you need to build 1.10 on Windows you need to use MSYS2, and the instructions are here:

 

http://docs.zephyrproject.org/getting_started/installation_win.html#using-msys2

 

This should cover how to build conf on MSYS2.

 

Regards,

 

Carles

 

From: Martin Woolley [mailto:mwoolley@...]
Sent: 21 February 2018 17:40
To: Cufi, Carles <Carles.Cufi@...>; zephyr-users@...
Subject: RE: Unable to find the Kconfig program 'conf'

 

I’m building on Windows. So where can I find “conf”? Google, somewhat uncharacteristically was no help with this 😊

 

From: Cufi, Carles [mailto:Carles.Cufi@...]
Sent: 21 February 2018 16:31
To: Martin Woolley <mwoolley@...>; zephyr-users@...
Subject: RE: Unable to find the Kconfig program 'conf'

 

Hi Martin,

 

Master no longer requires the “conf” executable, whereas 1.10 does. What OS are you building on?

 

Carles

 

From: zephyr-users-bounces@... [mailto:zephyr-users-bounces@...] On Behalf Of Martin Woolley
Sent: 21 February 2018 17:01
To: zephyr-users@...
Subject: [Zephyr-users] Unable to find the Kconfig program 'conf'

 

I just realised I've been working with the master branch i.e. version 1.10.99. I checked out tags/v1.10.0 and now nothing builds. Getting "Unable to find the Kconfig program 'conf'". Does anyone have any idea how to fix this? Thanks.


Re: Unable to find the Kconfig program 'conf'

Carles Cufi
 

Hi Martin,

 

Native Windows builds (i.e. without using MSYS2) were not supported in 1.10.

If you need to build 1.10 on Windows you need to use MSYS2, and the instructions are here:

 

http://docs.zephyrproject.org/getting_started/installation_win.html#using-msys2

 

This should cover how to build conf on MSYS2.

 

Regards,

 

Carles

 

From: Martin Woolley [mailto:mwoolley@...]
Sent: 21 February 2018 17:40
To: Cufi, Carles <Carles.Cufi@...>; zephyr-users@...
Subject: RE: Unable to find the Kconfig program 'conf'

 

I’m building on Windows. So where can I find “conf”? Google, somewhat uncharacteristically was no help with this 😊

 

From: Cufi, Carles [mailto:Carles.Cufi@...]
Sent: 21 February 2018 16:31
To: Martin Woolley <mwoolley@...>; zephyr-users@...
Subject: RE: Unable to find the Kconfig program 'conf'

 

Hi Martin,

 

Master no longer requires the “conf” executable, whereas 1.10 does. What OS are you building on?

 

Carles

 

From: zephyr-users-bounces@... [mailto:zephyr-users-bounces@...] On Behalf Of Martin Woolley
Sent: 21 February 2018 17:01
To: zephyr-users@...
Subject: [Zephyr-users] Unable to find the Kconfig program 'conf'

 

I just realised I've been working with the master branch i.e. version 1.10.99. I checked out tags/v1.10.0 and now nothing builds. Getting "Unable to find the Kconfig program 'conf'". Does anyone have any idea how to fix this? Thanks.


Re: Unable to find the Kconfig program 'conf'

Martin Woolley <mwoolley@...>
 

I’m building on Windows. So where can I find “conf”? Google, somewhat uncharacteristically was no help with this 😊

 

From: Cufi, Carles [mailto:Carles.Cufi@...]
Sent: 21 February 2018 16:31
To: Martin Woolley <mwoolley@...>; zephyr-users@...
Subject: RE: Unable to find the Kconfig program 'conf'

 

Hi Martin,

 

Master no longer requires the “conf” executable, whereas 1.10 does. What OS are you building on?

 

Carles

 

From: zephyr-users-bounces@... [mailto:zephyr-users-bounces@...] On Behalf Of Martin Woolley
Sent: 21 February 2018 17:01
To: zephyr-users@...
Subject: [Zephyr-users] Unable to find the Kconfig program 'conf'

 

I just realised I've been working with the master branch i.e. version 1.10.99. I checked out tags/v1.10.0 and now nothing builds. Getting "Unable to find the Kconfig program 'conf'". Does anyone have any idea how to fix this? Thanks.


Re: Unable to find the Kconfig program 'conf'

Carles Cufi
 

Hi Martin,

 

Master no longer requires the “conf” executable, whereas 1.10 does. What OS are you building on?

 

Carles

 

From: zephyr-users-bounces@... [mailto:zephyr-users-bounces@...] On Behalf Of Martin Woolley
Sent: 21 February 2018 17:01
To: zephyr-users@...
Subject: [Zephyr-users] Unable to find the Kconfig program 'conf'

 

I just realised I've been working with the master branch i.e. version 1.10.99. I checked out tags/v1.10.0 and now nothing builds. Getting "Unable to find the Kconfig program 'conf'". Does anyone have any idea how to fix this? Thanks.


Unable to find the Kconfig program 'conf'

Martin Woolley <mwoolley@...>
 

I just realised I've been working with the master branch i.e. version 1.10.99. I checked out tags/v1.10.0 and now nothing builds. Getting "Unable to find the Kconfig program 'conf'". Does anyone have any idea how to fix this? Thanks.


Re: micro:bit GPIO read always returning 1

Martin Woolley <mwoolley@...>
 

No sign of life in interrupt mode either, using either high or low triggering e.g.

 

#define PIN_0 EXT_P0_GPIO_PIN

#define GPIO_DRV_NAME "GPIO_0"

 

struct device *gpiob;

static struct gpio_callback gpio_trigger_cb;

 

void triggered(struct device *gpiob, struct gpio_callback *cb, u32_t pins)

{

  struct mb_display *disp = mb_display_get();

  printk("Triggered at %d\n", k_cycle_get_32());

  u32_t val = 0;

  gpio_pin_read(gpiob, PIN_0, &val);

  mb_display_image(disp, MB_DISPLAY_MODE_SINGLE, K_SECONDS(1),  &patterns[val], 1);

}

 

 

  gpiob = device_get_binding(GPIO_DRV_NAME);

  if (!gpiob)

  {

    printk("error\n");

    return;

  }

 

 

  gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH);

  gpio_init_callback(&gpio_trigger_cb, triggered, BIT(PIN_0));

  gpio_add_callback(gpiob, &gpio_trigger_cb);

  gpio_pin_enable_callback(gpiob, PIN_0);

 

I’m not at all confident I have the right flags... I was guided by the samples. AFAIK EXT_P0_GPIO_PIN is correct... I got that from board.h:

 

/* External edge connector pin mappings to nRF51 GPIO pin numbers.

* More information:

* https://www.microbit.co.uk/device/pins

* https://github.com/microbit-foundation/microbit-reference-design/tree/master/PDF/Schematic%20Print

*/

#define EXT_P0_GPIO_PIN     3   /* P0, Analog in */

 

 

From: Martin Woolley
Sent: 21 February 2018 13:41
To: 'Cufi, Carles' <Carles.Cufi@...>; zephyr-users@...
Subject: RE: micro:bit GPIO read always returning 1

 

Hi Carles and thanks for the quick response 😊

 

micro:bit buttons, which are of course connected to GPIO pins work fine in interrupt mode:

 

#define PIN_A SW0_GPIO_PIN

#define PORT SW0_GPIO_NAME

#define EDGE (GPIO_INT_EDGE | GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE)

 

 

  gpiob = device_get_binding(PORT);

  if (!gpiob)

  {

    printk("error\n");

    return;

  }

 

  // Button A

  gpio_pin_configure(gpiob, PIN_A, GPIO_DIR_IN | GPIO_INT | EDGE);

  gpio_init_callback(&gpio_btnA_cb, button_A_pressed, BIT(PIN_A));

  gpio_add_callback(gpiob, &gpio_btnA_cb);

  gpio_pin_enable_callback(gpiob, PIN_A);

 

 

 

I haven’t tried interrupt mode with pins on the edge connector. I’ll try that next. Presumably the same pin configuration (apart from the pin number)  should be valid.

 

Do you see anything obviously wrong with the pin config I’m using for polling, though? I’ve tried various flags but none of them made any difference for me. This is doubtless user error.... but what that error is I don’t yet know.

 

I’ll try interrupt mode and report back.

 

Regards

 

Martin

 

 

From: Cufi, Carles [mailto:Carles.Cufi@...]
Sent: 21 February 2018 13:35
To: Martin Woolley <mwoolley@...>; zephyr-users@...
Subject: RE: micro:bit GPIO read always returning 1

 

Hi Martin,

 

I’ve only ever tested that GPIO driver in interrupt mode, but I don’t see why it shouldn’t work in polling mode.

Have you tried it in interrupt mode to see if it works?

 

Unfortunately our driver expert is away this week, I’m sure he’ll respond next week though.

 

Maybe Johan can give us some input as well.

 

Regards,

 

Carles

 

From: zephyr-users-bounces@... [mailto:zephyr-users-bounces@...] On Behalf Of Martin Woolley
Sent: 21 February 2018 14:08
To: zephyr-users@...
Subject: [Zephyr-users] micro:bit GPIO read always returning 1

 

Zephyr newbie question. I’m trying to poll an external pin on a micro:bit. I have a rocker switch with pull up resistor connected to it and the circuit works (tested with code written with microbit-dal APIs). My Zephyr GPIO reads always return 1, however. What am I doing wrong?

 

This video shows code which uses the microbit-dal APIs working... I want to achieve the same for Zephyr:

 

https://drive.google.com/open?id=1h3LWC_PPNBhBs2mAFJj0ZgRvkd9Dk1NB

 

Code fragments:

 

#define PIN_0 EXT_P0_GPIO_PIN

struct device *gpiob;

void poll(void)

{

     struct mb_display *disp = mb_display_get();

     while (1) {

       u32_t val = 0;

      gpio_pin_read(gpiob, PIN_0, &val);

       printk("%d\n",val);

     }

}

 

void main(void)

{

     gpiob = device_get_binding(GPIO_DRV_NAME);

     if (!gpiob)

     {

           printk("error\n");

           return;

     }

 

     // Pin 0 - simple input config - suitable for polling

     gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_PUD_PULL_UP );

     printk("Sampling micro:bit pin P0\n");

     poll();

 

Thanks


Re: micro:bit GPIO read always returning 1

Martin Woolley <mwoolley@...>
 

Hi Carles and thanks for the quick response 😊

 

micro:bit buttons, which are of course connected to GPIO pins work fine in interrupt mode:

 

#define PIN_A SW0_GPIO_PIN

#define PORT SW0_GPIO_NAME

#define EDGE (GPIO_INT_EDGE | GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE)

 

 

  gpiob = device_get_binding(PORT);

  if (!gpiob)

  {

    printk("error\n");

    return;

  }

 

  // Button A

  gpio_pin_configure(gpiob, PIN_A, GPIO_DIR_IN | GPIO_INT | EDGE);

  gpio_init_callback(&gpio_btnA_cb, button_A_pressed, BIT(PIN_A));

  gpio_add_callback(gpiob, &gpio_btnA_cb);

  gpio_pin_enable_callback(gpiob, PIN_A);

 

 

 

I haven’t tried interrupt mode with pins on the edge connector. I’ll try that next. Presumably the same pin configuration (apart from the pin number)  should be valid.

 

Do you see anything obviously wrong with the pin config I’m using for polling, though? I’ve tried various flags but none of them made any difference for me. This is doubtless user error.... but what that error is I don’t yet know.

 

I’ll try interrupt mode and report back.

 

Regards

 

Martin

 

 

From: Cufi, Carles [mailto:Carles.Cufi@...]
Sent: 21 February 2018 13:35
To: Martin Woolley <mwoolley@...>; zephyr-users@...
Subject: RE: micro:bit GPIO read always returning 1

 

Hi Martin,

 

I’ve only ever tested that GPIO driver in interrupt mode, but I don’t see why it shouldn’t work in polling mode.

Have you tried it in interrupt mode to see if it works?

 

Unfortunately our driver expert is away this week, I’m sure he’ll respond next week though.

 

Maybe Johan can give us some input as well.

 

Regards,

 

Carles

 

From: zephyr-users-bounces@... [mailto:zephyr-users-bounces@...] On Behalf Of Martin Woolley
Sent: 21 February 2018 14:08
To: zephyr-users@...
Subject: [Zephyr-users] micro:bit GPIO read always returning 1

 

Zephyr newbie question. I’m trying to poll an external pin on a micro:bit. I have a rocker switch with pull up resistor connected to it and the circuit works (tested with code written with microbit-dal APIs). My Zephyr GPIO reads always return 1, however. What am I doing wrong?

 

This video shows code which uses the microbit-dal APIs working... I want to achieve the same for Zephyr:

 

https://drive.google.com/open?id=1h3LWC_PPNBhBs2mAFJj0ZgRvkd9Dk1NB

 

Code fragments:

 

#define PIN_0 EXT_P0_GPIO_PIN

struct device *gpiob;

void poll(void)

{

     struct mb_display *disp = mb_display_get();

     while (1) {

       u32_t val = 0;

      gpio_pin_read(gpiob, PIN_0, &val);

       printk("%d\n",val);

     }

}

 

void main(void)

{

     gpiob = device_get_binding(GPIO_DRV_NAME);

     if (!gpiob)

     {

           printk("error\n");

           return;

     }

 

     // Pin 0 - simple input config - suitable for polling

     gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_PUD_PULL_UP );

     printk("Sampling micro:bit pin P0\n");

     poll();

 

Thanks


Re: micro:bit GPIO read always returning 1

Carles Cufi
 

Hi Martin,

 

I’ve only ever tested that GPIO driver in interrupt mode, but I don’t see why it shouldn’t work in polling mode.

Have you tried it in interrupt mode to see if it works?

 

Unfortunately our driver expert is away this week, I’m sure he’ll respond next week though.

 

Maybe Johan can give us some input as well.

 

Regards,

 

Carles

 

From: zephyr-users-bounces@... [mailto:zephyr-users-bounces@...] On Behalf Of Martin Woolley
Sent: 21 February 2018 14:08
To: zephyr-users@...
Subject: [Zephyr-users] micro:bit GPIO read always returning 1

 

Zephyr newbie question. I’m trying to poll an external pin on a micro:bit. I have a rocker switch with pull up resistor connected to it and the circuit works (tested with code written with microbit-dal APIs). My Zephyr GPIO reads always return 1, however. What am I doing wrong?

 

This video shows code which uses the microbit-dal APIs working... I want to achieve the same for Zephyr:

 

https://drive.google.com/open?id=1h3LWC_PPNBhBs2mAFJj0ZgRvkd9Dk1NB

 

Code fragments:

 

#define PIN_0 EXT_P0_GPIO_PIN

struct device *gpiob;

void poll(void)

{

     struct mb_display *disp = mb_display_get();

     while (1) {

       u32_t val = 0;

      gpio_pin_read(gpiob, PIN_0, &val);

       printk("%d\n",val);

     }

}

 

void main(void)

{

     gpiob = device_get_binding(GPIO_DRV_NAME);

     if (!gpiob)

     {

           printk("error\n");

           return;

     }

 

     // Pin 0 - simple input config - suitable for polling

     gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_PUD_PULL_UP );

     printk("Sampling micro:bit pin P0\n");

     poll();

 

Thanks


micro:bit GPIO read always returning 1

Martin Woolley <mwoolley@...>
 

Zephyr newbie question. I’m trying to poll an external pin on a micro:bit. I have a rocker switch with pull up resistor connected to it and the circuit works (tested with code written with microbit-dal APIs). My Zephyr GPIO reads always return 1, however. What am I doing wrong?

 

This video shows code which uses the microbit-dal APIs working... I want to achieve the same for Zephyr:

 

https://drive.google.com/open?id=1h3LWC_PPNBhBs2mAFJj0ZgRvkd9Dk1NB

 

Code fragments:

 

#define PIN_0 EXT_P0_GPIO_PIN

struct device *gpiob;

void poll(void)

{

     struct mb_display *disp = mb_display_get();

     while (1) {

       u32_t val = 0;

      gpio_pin_read(gpiob, PIN_0, &val);

       printk("%d\n",val);

     }

}

 

void main(void)

{

     gpiob = device_get_binding(GPIO_DRV_NAME);

     if (!gpiob)

     {

           printk("error\n");

           return;

     }

 

     // Pin 0 - simple input config - suitable for polling

     gpio_pin_configure(gpiob, PIN_0, GPIO_DIR_IN | GPIO_PUD_PULL_UP );

     printk("Sampling micro:bit pin P0\n");

     poll();

 

Thanks


zephyr dlist crash

Ryan Johnson <Ryan.Johnson@...>
 

Hello,

 

I’m seeing zephyr crash w/ an invalid dlist pointer while handling timers.

 

I’m running mcuboot based on zephyr, so this issue may be mcuboot specific, but I thought I’d ask if anyone has seen this crash before.

 

[MCUBOOT] [INF] main: Starting bootloader

 

[MCUBOOT] [INF] boot_status_source: Image 0: magic=good, copy_done=0x1, image_ok=0xff

<LF>[MCUBOOT] [INF] boot_status_source: Scratch: magic=bad, copy_done=0x10, image_ok=0x6b

<LF>[MCUBOOT] [INF] boot_status_source: Boot source: none

<LF>[MCUBOOT] [INF] boot_swap_type: Swap type: revert

 

***** BUS FAULT *****

<LF>  Executing thread ID (thread): 0x20001658

<LF>  Faulting instruction address:  0x8007704

<LF>  Precise data bus error

<LF>  Address: 0xfe2bf00c

 

C:\STM32Toolchain\eclipse\plugins\fr.ac6.mcu.externaltools.arm-none.win32_1.13.3.201707031232\tools\compiler\bin>arm-none-eabi-addr2line.exe -e C:\cygwin64\home\sdorjohn\ns\mcuboot\outdir\ns_common\zephyr.elf -a 0x8007704

 

0x08007704

C:/cygwin64/home/sdorjohn/ns/zephyr/include/misc/dlist.h:228

 

 

Thread #1 (Suspended : Signal : SIGINT:Interrupt)           

               k_cpu_idle() at cpu_idle.S:135 0x8006bf0           

               _SysFatalErrorHandler() at sys_fatal_error_handler.c:70 0x8006c8e       

               _Fault() at fault.c:365 0x8006b28            

               __usage_fault() at fault_s.S:108 0x8006c16        

               <signal handler called>() at 0xfffffff1     

               sys_dlist_is_empty() at dlist.h:228 0x8007704   

               sys_dlist_peek_head() at dlist.h:256 0x8007704               

               handle_timeouts() at sys_clock.c:252 0x8007704             

               _nano_sys_clock_tick_announce() at sys_clock.c:377 0x8007704             

               _timer_int_handler() at cortex_m_systick.c:348 0x800224a        

               <signal handler called>() at 0xfffffffd    

               0x6402 

               0xd00dbeee      

 


Ryan C Johnson
Principal Systems Architect, Intelligent Asset Tracking Business Unit

5950 Nancy Ridge Dr. Ste 500
San Diego, CA 92121 USA

mobile: +1 858 401 3406
email: ryan.johnson@...
web: flex.com

 


Legal Disclaimer:
The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message!


Compiling GNU scientific library (gsl)

ashish.shukla@corvi.com <ashish.shukla@...>
 

Hi everyone,

I've to work with matrix operations in my zephyr project, for which I think GNU scientific library will suit best.

Can someone help me in compiling zephyr project codes with gsl?

--
Warm regards,
Ashish Shukla
Jr. Embedded Engineer
Research & Development


Please consider the environment before printing this e-mail or its attachments.

Disclaimer: The information contained herein (including any accompanying documents) is confidential and is intended solely for the addressee(s). If you have erroneously received this message, please immediately delete it and notify the sender. Also, if you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this message or any accompanying document is strictly prohibited and is unlawful. The organization is not responsible for any damage caused by a virus or alteration of the e-mail by a third party or otherwise. The contents of this message may not necessarily represent the views or policies of Corvi

2161 - 2180 of 2737