Date   

Re: cannot find "__device_[device name]" #api

Bolivar, Marti
 

Hi Justin,

"Justin Huang via Lists.Zephyrproject.Org"
<justin.y.huang=live.com@lists.zephyrproject.org> writes:

Hi,

I am building a device driver for Zephyr and when calling the macro, DEVICE_GET(), like DEVICE_GET(my_dev), I get a build error complaining about undefined __device_my_dev.
I tried to locate where the variable is assembled during the build process but have no luck so far.
DEVICE_GET() might not be the right thing here. Are you trying to get a
pointer to your device from the device driver C file itself, or from
some other file?

If you're trying to get a pointer to your device from some application
source code, you should probably be using device_get_binding() instead of
DEVICE_GET().


I have placed the following in the driver source code:

DEVICE_INIT(my_dev, CONFIG_MYDEV_NAME, my_dev_init,
my_dev_device_ctrl, NULL,
APPLICATION, CONFIG_MYDEV_INIT_PRIORITY);

Could you please shed some light on where to look for what might go
wrong?
If (and only if) the DEVICE_GET() line is in the same file as the above
DEVICE_INIT(), then it should work properly when paired with
DEVICE_DECLARE(), as shown with example code in this documentation page:

https://docs.zephyrproject.org/latest/reference/drivers/index.html#single-driver-multiple-instances

However, note that DEVICE_INIT allocates a static struct device, so you
can't use DEVICE_GET() to access that device from another file.

If you're trying to get a pointer to your struct device from another
C file, you need to use something like this instead:

struct device *mydev = device_get_binding(CONFIG_MYDEV_NAME);

BR,
Martí


Thanks,
Justin


Re: "in-tree" builds > its meaning

Bolivar, Marti
 

Hello,

"yasokada via Lists.Zephyrproject.Org"
<yasokada=gmail.com@lists.zephyrproject.org> writes:

Application Development
https://docs.zephyrproject.org/latest/application/index.html
at several lines above the Source Tree Structure ( https://docs.zephyrproject.org/latest/application/index.html#source-tree-structure )

Zephyr does not support “in-tree” builds.
The "in-tree" and "out-of-tree" may be used in linux as being part of the system or not, I think.
Linux kernel: meaning of source-tree, in-tree and out-of-tree ( https://unix.stackexchange.com/questions/208638/linux-kernel-meaning-of-source-tree-in-tree-and-out-of-tree )

In the above sentence for Zephyr, what does the "in-tree" builds mean?

For example, I guess, the "in-tree" builds means that the build can be performed only partly for some module, not for all the application project.
That is not correct.

Am I mistaken?
An "in-tree" build is when build artifacts (object files, generated
code, etc.) are created in the same directories as the source code. E.g.
if CMake places the object file for zephyr/kernel/init.c in the same
directory (zephyr/kernel), that would be an in-tree build, but that is
not supported by the Zephyr build system.

Zephyr's build system requires "out-of-tree" builds, which means that
the build directory is separate from the source directories.

Martí


Thanks in advance


cannot find "__device_[device name]" #api

Justin Huang
 

Hi,

I am building a device driver for Zephyr and when calling the macro, DEVICE_GET(), like DEVICE_GET(my_dev), I get a build error complaining about undefined __device_my_dev.
I tried to locate where the variable is assembled during the build process but have no luck so far.

Could you please shed some light on where to look for what might go wrong?

Thanks,
Justin


cannot find "__device_[device name]" #api

Justin Huang
 

Hi,

I am building a device driver for Zephyr and when calling the macro, DEVICE_GET(), like DEVICE_GET(my_dev), I get a build error complaining about undefined __device_my_dev.
I tried to locate where the variable is assembled during the build process but have no luck so far.

I have placed the following in the driver source code:

  DEVICE_INIT(my_dev, CONFIG_MYDEV_NAME, my_dev_init,                                                                                                                                                                                                                                                                                                                                                                                                                                                
              my_dev_device_ctrl, NULL,                                                                                                                                                                                                                                                                                                                                                                                                                                                         
              APPLICATION, CONFIG_MYDEV_INIT_PRIORITY);

Could you please shed some light on where to look for what might go wrong?

Thanks,
Justin


NVS on flash with erase page size 64k or larger #nvs

Marco
 

Hi there

In my application I try to use NVS on an external SPI flash (M25P16) which has an erase page size of 64k.

As I realised, NVS seems to have some limit on its maximum sector size of just below those 64k, since the variable storing it is an u16_t.

Is there any workaround to get this combination to work anyway, or is even an enhancement planned, to overcome this limit?
Since there are still quite a few memories on the market with page sizes exceeding those 64k it might be interesting generally.

Thanks and regards.


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 ?

781 - 800 of 2604