Date   

Failure of CMD0 sending using STM32F769 + SPI2 for [samples/subsys/fs/fat_fs] #spi #fatfs

@yasokada
 

My environment:
Ubuntu 18.04 LTS
STM32L476 Nucleo_64 (hereafter STM32L476)
STM32F769 Discovery Kit (hereafter STM32F769)
Zephyr 2.1.0-rc1
Project: `samples/subsys/fs/fat_fs`
Logic Analyzer: Analog Discovery 2
 
### Difference
 
I have tested the sample project for microSD/MMC with FatFs (samples/subsys/fs/fat_fs).
 
The project works on some boards, but does not work on one board.
 
A. STM32L476 + SPI1 : O.K.
B. STM32L476 + SPI2 : O.K.
C. STM32F769 + SPI2 : Fail
 
### Logic capture for STM32L476
 
I have captured the SPI logic using Analog Discovery 2.
 
For STM32L476, the captured logics are shown below.





I can see:
 
1. 74 plus alpha clocks
2. MOSI: 0x40 0x00 0x00 0x00 0x00 0x94 0xFF 0xFF 0xFF
 
It works with STM32L476.
 
### Logic capture for STM32F769
 
I also have captured the SPI logic for STM32F769.





I saw:
 
1. 74 plus alpha clocks
2. MOSI: 0x20 0x00 0x00 0x00 0x00 0x4A ...

The step 2 is mistaken not CMD0 (0x40 0x00 0x00 0x00 0x00 0x94), possibly shifted sending.
 
### Possible cause of the failure
 
It seems that the 74 clocks do not end properly (ChipSelect did not go into low with margin).
This may cause the failure to send the CMD0 (0x40) command using STM32F769.
 
I will check how to solve this. But if anyone can suggest to fix this, it helps.
 
P.S. I will see on this after Jan. 3, 2020.
 


It worked > Re: SPI2 definition is not found for STM32L476 device tree. How to add?

@yasokada
 

Dear Yannis
(I have sent private reply, but for other people, I send this reply again).

Thank you very much.

I added the description for &spi2 in an overlay file.
It worked.

I appreciate it.


Private: Re: [Zephyr-users] SPI2 definition is not found for STM32L476 device tree. How to add?

Yannis Damigos
 

-------- Forwarded Message --------
Subject: Private: Re: [Zephyr-users] SPI2 definition is not found for STM32L476 device tree. How to add?
Date: Fri, 27 Dec 2019 15:40:46 -0800
From: yasokada@gmail.com
To: Yannis Damigos <giannis.damigos@gmail.com>



Dear Yannis


Thank you very much for your quick reply.

It worked!


Re: SPI2 definition is not found for STM32L476 device tree. How to add?

Yannis Damigos
 

Hi,

### How to add?

I may need to add the spi2 definition for STM32L476.

Where should I add the definition?
You don't need to add it. It exists in dts/arm/st/l4/stm32l471.dtsi

A. stm32l4.dtsi
B. nucleo_l476rg.dts> C. <BOARD>.overlay file located in the project directory

I just wonder why there is a definition for SPI2 for the supported board web page, but it is not actually supported by the device tree.
To enable it just add the following in nucleo_l476rg.dts or an overlay file:

&spi2 {
status = "okay";
};

Yannis


SPI2 definition is not found for STM32L476 device tree. How to add?

@yasokada
 
Edited

My environment:
Ubuntu 18.04 LTS
STM32L476 Nucleo_64 (hereafter STM32L476)
STM32F769 Discovery Kit (hereafter STM32F769)
Zephyr 2.1.0-rc1

### SPI2 for STM32L476 

https://docs.zephyrproject.org/latest/boards/arm/nucleo_l476rg/doc/index.html

In the above page, there is the definition of SPI2 (and SPI3).
However, when I west build the project with the SPI_2 set, I have the following errors.

```
zephyr/include/generated/generated_dts_board_fixups.h:199:27: error: 'DT_ST_STM32_SPI_FIFO_40003800_IRQ_0_PRIORITY' undeclared (first use in this function); did you mean 'DT_ST_STM32_SPI_FIFO_40013000_IRQ_0_PRIORITY'?
 #define DT_SPI_2_IRQ_PRI  DT_ST_STM32_SPI_FIFO_40003800_IRQ_0_PRIORITY
```

I found that the above is caused because there is no "spi2" definition in the stm32l4.dtsi.
On the other hand, there is "spi2" definition in stm32f7.dtsi, which is shown below. 

```
spi2: spi@40003800 {
compatible = "st,stm32-spi";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40003800 0x400>;
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>;
interrupts = <36 5>;
status = "disabled";
label = "SPI_2";
};
```

### How to add?

I may need to add the spi2 definition for STM32L476.

Where should I add the definition?

A. stm32l4.dtsi
B. nucleo_l476rg.dts
C. <BOARD>.overlay file located in the project directory

I just wonder why there is a definition for SPI2 for the supported board web page, but it is not actually supported by the device tree.



Multiple device with different GPIO chip selects on SPI2

armand@...
 

Good day,

I have decided to dive head first into Zephyr with a project of mine.

I have a LIS2DH and a W25Q128JV Flash on the same SPI bus, with two GPIOs to control the chip selects. I have a STM32F413VGT6 microcontroller, and the Zephyr version is

However, I am having some trouble. When the FLASH SPI is initialized (in function spi_nor_read_id called by  spi_not_configure) to read the JEDEC ID, the LIS2DH chip select is still not initialised, ie its low, so I have two devices selected at the same time. This results in an incorrect JEDEC ID.

Later when I try to use the LIS2DH, no chip selects are being controlled, leading to a problem in getting data from the LIS2DH.

I cannot find any place in the code where the cs-gpios from the dts file is used. In fact I have been able to ascertain that the chip select list is not initialized with the following test:

static inline void spi_context_cs_control(struct spi_context *ctx, bool on)
{
if (ctx)
{
printf("Test0 %d\n",(int)on);

if (ctx->config)
{
printf("Test1 %p\n",ctx->config);

if (ctx->config->cs)
{
printf("Test2 %p\n",ctx->config->cs);

if (ctx->config->cs->gpio_dev)
{
printf("Test3 %p,%s,%08X\n",ctx->config->cs->gpio_dev,
ctx->config->cs->gpio_dev->config->name,
ctx->config->cs->gpio_dev->config->init);
}
}
}
}

_spi_context_cs_control(ctx, on, false);
printf("Setting CS End");
}

At the time the SPI NOR flash is initialised the output from the above function is:
Test0 1
Test1 0x20000f78
Test2 0x20000f84
Test3 0x200050fc,GPIOD
Setting CS End
Test0 0
Test1 0x20000f78
Test2 0x20000f84
Test3 0x200050fc,GPIOD
Setting CS End
(And I can see the NOR Flash chip select activated)

but by the time I want to use the LISD2H, the output is:
Test0 1
Test1 0x20000f5c
Setting CS End
Test0 0
Test1 0x20000f5c
Setting CS End
(No chip select activity since the chip select GPIO list ctx->config->cs is NULL)

I have seen the debate on where chip select control is to be done here:
https://github.com/zephyrproject-rtos/zephyr/issues/12698 and
https://github.com/zephyrproject-rtos/zephyr/issues/12226
but none of these really helped my to solve my problem.

Here is an extract from my dts file:

&spi2 {
status = "okay";

cs-gpios = <&gpiob 7 0>, <&gpiod 11 0>;

lis2dh@0 {
compatible = "st,lis2dh";
spi-max-frequency = <1000000>;
reg = <0>;
irq-gpios = <&gpiob 6 0>, <&gpiod 7 0>;
label = "LIS2DH";
};


flash1: flash@1 {
compatible = "jedec,spi-nor";
reg = <1>;
size = <16777216>;
spi-max-frequency = <2000000>;
label = "W25Q128JV";
jedec-id = [ef 40 18];
};
};


Does anyone know of a good working example with multiple Chip selects on a SPI bus where the CS lines are controlled with GPIOs, or can someone point me in the right direction to solve this problem?

Thanks in advance, any help is appreciated.

Greeting from South Africa


Re: Regarding the flash of hci_uart sample app of zephire in nrf52840

Chettimada, Vinayak Kariappa
 

Please follow this, if using hci_uart:

https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/nrf5x-support-within-the-zephyr-project-rtos

 

Else if using hci_usb and the nRF52840’s native USB port, Linux with Bluez will implicitly load the modules on plugging and you can directly using btmgmt tool.

 

 

-Vinayak

 

From: users@... <users@...> On Behalf Of Amit Purwar via Lists.Zephyrproject.Org
Sent: 18 December 2019 11:49
To: users@...
Cc: users@...
Subject: [Zephyr-users] Regarding the flash of hci_uart sample app of zephire in nrf52840

 

I have build and flashed the zephire/sample/bluetooth/hci_uart on nrf52840 board and connected the board with ubuntu but hci interface was not created when checked using hciconfig.

Can you please provide the steps for the same . I have used below step

cd zephyr/samples/bluetooth/hci_uart

mkdir nrf_build

cmake -DBOARD=nrf52840_pca10056 ../

make

make flash

hciconfig

But no hci interface created


Regarding the flash of hci_uart sample app of zephire in nrf52840

Amit Purwar <amit.purwar@...>
 

I have build and flashed the zephire/sample/bluetooth/hci_uart on nrf52840 board and connected the board with ubuntu but hci interface was not created when checked using hciconfig.

Can you please provide the steps for the same . I have used below step

cd zephyr/samples/bluetooth/hci_uart

mkdir nrf_build

cmake -DBOARD=nrf52840_pca10056 ../

make

make flash

hciconfig

But no hci interface created


How to implement a simple SPI-Slave function on nRF52 PCA10040 board.

robin@...
 

I am attempting to create a simple SPI-Slave implementation for the nRF52 PCA10040 board.  
My project’s source code is at https://github.com/foldedtoad/spi_slave.
 
While I am able to receive events whenever the SPI-Master (host) sends data, the receive buffers are empty. 
A logic analyzer trace shows good SPI protocol from the SPI-Master.

I have looked for examples which might shed some light on how to implement an starter version of a SPI-Slave on the nRF52 series. 

Any guidance or suggestions as to what prevents my code from receiving data would be appreciated.

Cheers,
Robin


API meeting: agenda

Carles Cufi
 

Hi all,

This week we will focus on two Stable API Change RFCs and GPIO.
I am unable to attend but Peter Bigot has kindly offered to chair the meeting instead.

Reminder on the Stable API Change RFCs: The purpose of discussing them in this meeting is to raise awareness and talk about any objections or potential problems the change may introduce. The final acceptance is gated by the Pull Request itself.

- RFC: API Change: PWM: add support for inverted PWM signals
- https://github.com/zephyrproject-rtos/zephyr/issues/21384

- RFC: API Change: usb: Make users call usb_enable. Provide global status callback.
- https://github.com/zephyrproject-rtos/zephyr/issues/21419

- GPIO: Update on progress
- Proposal from Peter Bigot: Port remaining users without testing them on hardware
- Look at the PRs with driver conversion (https://github.com/zephyrproject-rtos/zephyr/issues/18530)
- Check users of GPIO APIs: https://github.com/zephyrproject-rtos/zephyr/issues/20017
- Tips for converting users can be found here: https://github.com/zephyrproject-rtos/zephyr/issues/20017#issuecomment-549315497 (thanks Peter!)
- Any additional outstanding PRs to topic-gpio

Additional items in the "Triage" column in the GitHub project may be discussed if time permits.
If you want an item included in the meeting, please add it to the GitHub project.

https://github.com/zephyrproject-rtos/zephyr/wiki/Zephyr-Committee-and-Working-Group-Meetings#zephyr-api-discussion
https://github.com/zephyrproject-rtos/zephyr/projects/18
https://docs.google.com/document/d/1lv-8B5QE2m4FjBcvfqAXFIgQfW5oz6306zJ7GIZIWCk/edit

Regards,

Carles


Proposal to make Zephyr 2.2 require Python 3.6 or later

Bolivar, Marti
 

Hello Zephyr users,

Now that Zephyr 2.1 has been released, I am proposing we make Python 3.6
the minimum supported Python version for 2.2:

https://github.com/zephyrproject-rtos/zephyr/pull/21212

The pull request has been approved and was discussed without objection
by the Technical Steering Committee today, so I'm trying to raise
awareness about it as it seems likely to me it will be merged for 2.2
unless someone objects.

Comments or objections in the PR if possible, please.

Thanks!


Re: Using #stm32 HAL_TIM_xyz for counting pulses with timer in external clock mode #stm32

Erwan Gouriou
 

Hi Pauli,

If you are able to do what you want with Cube HAL then, to interface with zephyr, you just need to redefine
the HAL callback (defined as weak in HAL drivr) in your zephyr application.
You can check what has been done in a similar fashion on zephyr stm32 ethernet driver.

HIH
Cheers
Erwan


On Tue, 10 Dec 2019 at 18:02, Pauli <susundberg@...> wrote:
Dear all,

I am doing silly motor driver for worm-gear dc-motor with stm32f411e-disco board (and L298). The dc-motor has HAL-sensor for feedback - providing raising/lowering edge for every turn. Now, as the HAL sensor is attached before the worm-gear, so the RPM will be something. To have it handled with ease i was thinking to connect the HAL sensor output to STM32 as external clock input -> i can get the count from the timer register with zero load to processor.

As far as i know (and have tested - it compiles) i can use the HAL_TIM_XYZ functions and they should work -> i can use them to configure timer to be in external clock mode.

But how does one handle the overflow of the timer? In normal STM32 HAL code one would get interupt from this but i have no glue how to do it with Zephyr. I do know i could poll it with very little overhead, but that seems bit brute-force.

Would it be easy to set up interrupt handler for timer overflow? Could somebody point out tips what would be the steps required (or just say its not doable without weeks of work)? What Zephyr source files i should look at? Any change of samples that would even have some similarity?

BR,
Pauli


Using #stm32 HAL_TIM_xyz for counting pulses with timer in external clock mode #stm32

Pauli
 

Dear all,

I am doing silly motor driver for worm-gear dc-motor with stm32f411e-disco board (and L298). The dc-motor has HAL-sensor for feedback - providing raising/lowering edge for every turn. Now, as the HAL sensor is attached before the worm-gear, so the RPM will be something. To have it handled with ease i was thinking to connect the HAL sensor output to STM32 as external clock input -> i can get the count from the timer register with zero load to processor.

As far as i know (and have tested - it compiles) i can use the HAL_TIM_XYZ functions and they should work -> i can use them to configure timer to be in external clock mode.

But how does one handle the overflow of the timer? In normal STM32 HAL code one would get interupt from this but i have no glue how to do it with Zephyr. I do know i could poll it with very little overhead, but that seems bit brute-force.

Would it be easy to set up interrupt handler for timer overflow? Could somebody point out tips what would be the steps required (or just say its not doable without weeks of work)? What Zephyr source files i should look at? Any change of samples that would even have some similarity?

BR,
Pauli


API meeting: Agenda

Carles Cufi
 

Hi all,

This week we will focus on API Changes and GPIO:

- Changing a stable API:
- https://github.com/zephyrproject-rtos/zephyr/pull/21013

- GPIO: Update on progress
- Look at the PRs with driver conversion (https://github.com/zephyrproject-rtos/zephyr/issues/18530)
- Check users of GPIO APIs: https://github.com/zephyrproject-rtos/zephyr/issues/20017
- Tips for converting users can be found here: https://github.com/zephyrproject-rtos/zephyr/issues/20017#issuecomment-549315497 (thanks Peter!)
- Any additional outstanding PRs to topic-gpio

Additional items in the "Triage" column in the GitHub project may be discussed if time permits.
If you want an item included in the meeting, please add it to the GitHub project.

https://github.com/zephyrproject-rtos/zephyr/wiki/Zephyr-Committee-and-Working-Group-Meetings#zephyr-api-discussion
https://github.com/zephyrproject-rtos/zephyr/projects/18
https://docs.google.com/document/d/1lv-8B5QE2m4FjBcvfqAXFIgQfW5oz6306zJ7GIZIWCk/edit

Regards,

Carles


Different MAC address for nrf52 when using as a controller #bluetooth #nrf52480 #usb #ble

Venkatesh Dyagala
 
Edited

Hi,
 
Iam using nrf52840 DK as a BLE controller. So i compiled a hex file and loaded into it. There after when we power on am getting the bdaddr of the device as 00:00:00:00:00:00, But when i check the "bluetootctl show " command its showing the MAC address of the device.
 
So without modifying the bdaddr i started advertise, The scanned devices seeing the different MAC that is not equal to the address which we seen using bluetoothctl show.
 
So my question is
--The address which we seen in the bluetoothctl show  is the correct address? or the address which we seen in scanning when the device is advertising that is correct ?


Re: Determining source of GPIO Interrupt on NRF52832 #gpio #nrf52832

bbradley@...
 

I just realized I responded to you privately by accident, Lawrence. Sorry about that. I will copy the message I sent to you to the group so that the discussion is up to date.

The suggestion regarding testing the gpio with gpio_pin_read is exactly what I am currently doing, and it does indeed work well, but I had the same thought about spurious pulses potentially causing issues here. I haven't observed issues with this yet, but it certainly was a concern of mine.

As for your second suggestion, I have not tried that! My understanding was that calling gpio_pin_configure a second time would (re)configure the gpio, not append additional configurations. So I have been configuring the gpio with interrupt flags which are bitwise OR'd. If the API can in fact allow me to have multiple pin configurations with different callbacks then it should work perfectly. This will require a bit of refactor for my current project, but I can at least test this concept fairly quickly. 

Thanks for the suggestions! I will let you know if it works.
Brian 


Re: bt_gatt_is_subscribed - any examples?

Lawrence King
 

Adding devel@... to the email address.

 

Lawrence King

Principal Developer

+1(416)627-7302

 

From: users@... <users@...> On Behalf Of Lawrence King
Sent: Thursday, December 5, 2019 4:00 PM
To: users@...
Subject: [Zephyr-users] bt_gatt_is_subscribed - any examples?

 

Dear All:

 

I have a similar problem to what Frank Viren is seeing in his thread “bt_gatt_notify multiple characteristics”. How to determine the pointer to the right characteristic.

 

When my central connects to my device I want to send it several notifications. My device has several characteristics under the primary service. When the central connects (in this case the central is either an iPhone, or an Android phone), if I simply wait 200mS after the connection and sent the notifications with bt_gatt_notify() it ‘almost’ always works. Unfortunately sometimes Android or iOS take a little longer to subscribe for notifications, hence I would like to determine if the phone is ready to receive notifications rather than simply waiting 200mS.

 

I hunted through the bt_ apis and found bt_gatt_is_subscribed() which looks like I can loop testing to see if the central is ready and then send the notifications. Much better than blindly waiting 200mS.

 

 

bool bt_gatt_is_subscribed(struct bt_conn *connconststructbt_gatt_attr *attr, u16_t ccc_value)

Check if connection have subscribed to attribute.

Check if connection has subscribed to attribute value change.

The attribute object can be the so called Characteristic Declaration, which is usually declared with BT_GATT_CHARACTERISTIC followed by BT_GATT_CCC, or the Characteristic Value Declaration which is automatically created after the Characteristic Declaration when using BT_GATT_CHARACTERISTIC, or the Client Characteristic Configuration Descriptor (CCCD) which is created by BT_GATT_CCC.

Return

true if the attribute object has been subscribed.

Parameters

·        conn: Connection object.

·        attr: Attribute object.

·        ccc_value: The subscription type, either notifications or indications.

 

OK, based on the documentation, this seems to be what I want, but the parameters are difficult for a newbie to understand:

conn – yes I did declare this with BT_GATT_CHARACTERISTIC I know where it is in my source code, but how do I find a pointer to it?

attr –  this was automatically created with BT_GATT_CCC in the same place, but again how do I get a pointer to the attr?

ccc_value – this is obviously an int, probably with definitions for the bits, but what symbolic enums or defines can I put in this parameter?

 

 

 

Unfortunately a google search of “bt_gatt_is_subscribed” only finds 8 results, the source code, the documentation (on the zephyr site, and on the nordic site), and 2 content aggregators. I did not find a single piece of code that calls this function, but there must be at least one call to the function in at least some test suite. bt_gatt_is_subscribed is never called in any of the zephyr/samples…

 

Can someone point me to an example please?

 

 

 

Lawrence King

Principal Developer

Connected Transport Market Unit

https://www.Irdeto.com

+1(416)627-7302

 

1  2 - linkedin  3 - instagram  4 - youtube  6 - facebook  7

            

CONFIDENTIAL: This e-mail and any attachments are confidential and intended solely for the use of the individual(s) to whom it is addressed. It can contain proprietary confidential information and be subject to legal privilege and/or subject to a non-disclosure Agreement. Unauthorized use, disclosure or copying is strictly prohibited. If you are not the/an addressee and are in possession of this e-mail, please delete the message and notify us immediately. Please consider the environment before printing this e-mail. Thank you.

 

 

 


Re: Determining source of GPIO Interrupt on NRF52832 #gpio #nrf52832

Lawrence King
 

Hi Brian:

 

You can always test the value of the GPIO with gpio_pin_read() in the callback, if it is 1, then the cause is a rising edge, and if it is 0 the cause was a falling edge. Unfortunately if the input is a very short pulse you could get a rising edge interrupt, but by the time you get around to reading the GPIO, it could be back to low giving you the wrong information, and the short pulse should also trigger a second interrupt. If your transitions are relatively slow the testing the GPIO is good enough.

 

I agree there should be a way to separate the rising and falling events. Did you try creating two call backs, one for rising, and one for falling?

 

gpio_pin_configure – with flags for rising edge

gpio_init_callback,  - rising

gpio_add_callback, - rising

gpio_pin_enable_callback – for rising edges

 

gpio_pin_configure – with flags for falling edge

gpio_init_callback,  - falling

gpio_add_callback, - falling

gpio_pin_enable_callback – for falling edges

 

Lawrence King

Principal Developer

+1(416)627-7302

 

From: users@... <users@...> On Behalf Of bbradley@...
Sent: Thursday, December 5, 2019 11:16 AM
To: users@...
Subject: [Zephyr-users] Determining source of GPIO Interrupt on NRF52832 #gpio #nrf52832

 

Hello, 

I hope I am posting this question in the correct place.

I have an interrupt handler which can be configured to trigger on either edge. This is working perfectly, but I want to perform a different action on a rising edge vs a falling edge in some cases. Is there any way to do this? (i.e., perhaps I can determine in the interrupt context that a rising edge and not a falling edge was triggered?)

I am configuring the interrupts and registering the handler using the gpio API (gpio_pin_configure, gpio_init_callback, gpio_add_callback, gpio_pin_enable_callback), but the interrupt handler will act differently on a rising edge vs falling edge, for instance, so it is helpful to know which specific flags were raised that triggered the interrupt. I am currently using the gpio_pin_read API to work around this, but I am not sure if this is the best solution.

In other MCU's there is often an API to read the status register containing the interrupt flags that have been raised, and then an API for clearing the status register after reading. Is there anything similar with Zephyr? Or perhaps there is a way to have two different handlers for rising edge/falling edge?

I am using Zephyr v2.0.99 right now.

Thanks for any help, 
Brian


bt_gatt_is_subscribed - any examples?

Lawrence King
 

Dear All:

 

I have a similar problem to what Frank Viren is seeing in his thread “bt_gatt_notify multiple characteristics”. How to determine the pointer to the right characteristic.

 

When my central connects to my device I want to send it several notifications. My device has several characteristics under the primary service. When the central connects (in this case the central is either an iPhone, or an Android phone), if I simply wait 200mS after the connection and sent the notifications with bt_gatt_notify() it ‘almost’ always works. Unfortunately sometimes Android or iOS take a little longer to subscribe for notifications, hence I would like to determine if the phone is ready to receive notifications rather than simply waiting 200mS.

 

I hunted through the bt_ apis and found bt_gatt_is_subscribed() which looks like I can loop testing to see if the central is ready and then send the notifications. Much better than blindly waiting 200mS.

 

 

bool bt_gatt_is_subscribed(struct bt_conn *connconststructbt_gatt_attr *attr, u16_t ccc_value)

Check if connection have subscribed to attribute.

Check if connection has subscribed to attribute value change.

The attribute object can be the so called Characteristic Declaration, which is usually declared with BT_GATT_CHARACTERISTIC followed by BT_GATT_CCC, or the Characteristic Value Declaration which is automatically created after the Characteristic Declaration when using BT_GATT_CHARACTERISTIC, or the Client Characteristic Configuration Descriptor (CCCD) which is created by BT_GATT_CCC.

Return

true if the attribute object has been subscribed.

Parameters

·        conn: Connection object.

·        attr: Attribute object.

·        ccc_value: The subscription type, either notifications or indications.

 

OK, based on the documentation, this seems to be what I want, but the parameters are difficult for a newbie to understand:

conn – yes I did declare this with BT_GATT_CHARACTERISTIC I know where it is in my source code, but how do I find a pointer to it?

attr –  this was automatically created with BT_GATT_CCC in the same place, but again how do I get a pointer to the attr?

ccc_value – this is obviously an int, probably with definitions for the bits, but what symbolic enums or defines can I put in this parameter?

 

 

 

Unfortunately a google search of “bt_gatt_is_subscribed” only finds 8 results, the source code, the documentation (on the zephyr site, and on the nordic site), and 2 content aggregators. I did not find a single piece of code that calls this function, but there must be at least one call to the function in at least some test suite. bt_gatt_is_subscribed is never called in any of the zephyr/samples…

 

Can someone point me to an example please?

 

 

 

Lawrence King

Principal Developer

Connected Transport Market Unit

https://www.Irdeto.com

+1(416)627-7302

 

1  2 - linkedin  3 - instagram  4 - youtube  6 - facebook  7

            

CONFIDENTIAL: This e-mail and any attachments are confidential and intended solely for the use of the individual(s) to whom it is addressed. It can contain proprietary confidential information and be subject to legal privilege and/or subject to a non-disclosure Agreement. Unauthorized use, disclosure or copying is strictly prohibited. If you are not the/an addressee and are in possession of this e-mail, please delete the message and notify us immediately. Please consider the environment before printing this e-mail. Thank you.

 

 

 


Determining source of GPIO Interrupt on NRF52832 #gpio #nrf52832

bbradley@...
 

Hello, 

I hope I am posting this question in the correct place.

I have an interrupt handler which can be configured to trigger on either edge. This is working perfectly, but I want to perform a different action on a rising edge vs a falling edge in some cases. Is there any way to do this? (i.e., perhaps I can determine in the interrupt context that a rising edge and not a falling edge was triggered?)

I am configuring the interrupts and registering the handler using the gpio API (gpio_pin_configure, gpio_init_callback, gpio_add_callback, gpio_pin_enable_callback), but the interrupt handler will act differently on a rising edge vs falling edge, for instance, so it is helpful to know which specific flags were raised that triggered the interrupt. I am currently using the gpio_pin_read API to work around this, but I am not sure if this is the best solution.

In other MCU's there is often an API to read the status register containing the interrupt flags that have been raised, and then an API for clearing the status register after reading. Is there anything similar with Zephyr? Or perhaps there is a way to have two different handlers for rising edge/falling edge?

I am using Zephyr v2.0.99 right now.

Thanks for any help, 
Brian

841 - 860 of 2659