Date   

__ASSERT - transfer to error handler

Skøien, Kristoffer <Kristoffer.Skoien@...>
 

Current implementation:

The __ASSERT macro is extensively used in the Zephyr codebase and in application code for debugging during development.

In case of an ASSERT, the code jumps to __ASSERT_POST which spins the given thread in a while(1).

 

Issue:

During development and debugging, simply looping the thread will mask that the ASSERT has triggered. The only feedback the user gets of an assert is a printout.

This can be missed if e.g.:

- The RTT or Serial debug interface is down or unused

- There is too much logging so that the “ASSERTION FAIL” can be missed

 

Proposed solution:

In __ASSERT_POST provide a function call that will end up a user definable error handler. E.g. _SysFatalErrorHandler

 

This will let the developer set given SOC pins in case of an ASSERT, ask for a specific LED pattern to be set or print further debug messages.

 

Feedback is appreciated.

 

Kind regards

Kristoffer


Re: __ASSERT - transfer to error handler

kristoffer.skoien@...
 

Thanks for your reply Paul.

Perhaps something simliar to this:

#if defined(CONFIG_ARCH_POSIX)
extern void posix_exit(int exit_code);
#define __ASSERT_POST posix_exit(1)
#elif defined(CONFIG_ASSERT_ERR_HANDLER)
#define __ASSERT_POST _SysFatalErrorHandler(?,?)
#else
#define __ASSERT_POST             \
for (;;) {                \
/* spin thread */ \
}
#endif


Re: Zephyr (v1.13.0) HCI_UART running on nRF52 DK why BD address is always 00:00:00:00:00:00 after power cycle #nrf52832

Carles Cufi
 

Hi there,

 

The *public* address is all zeroes because Nordic ICs do not come with one pre-assigned. The *random static* address is set by BlueZ itself, so it will be whatever BlueZ decides it to be.

You don’t typically need a public address to work with BLE.

 

Carles

 

From: devel@... <devel@...> On Behalf Of frv
Sent: 09 November 2018 11:49
To: Zephyr-devel@...
Subject: [Zephyr-devel] Zephyr (v1.13.0) HCI_UART running on nRF52 DK why BD address is always 00:00:00:00:00:00 after power cycle #nrf52832

 

Hallo Zephyr community,

 

Anyone knowing why the BD address is always the ZERO address, when using the nRF52 board running the Zephyr HCI uart hex.

I also see that the random address remains the same after power cycling the nRF board.

Also differences in showing the address for the HCI controller when running the bluetoothctl and hcitool dev commands.

Nor using the hcitool or btmgmt tool makes it possible to adjust the addressing, only so far the hcitool cmd 0x3f 0x006 address makes a difference as long as the board is not power cycled (as the setting is volatile, the default non volatile addresses to zero it seems).

 

Please see my findings described more in detail here in the Nordic Dev Zone, last reply in the message queue.

 

https://devzone.nordicsemi.com/f/nordic-q-a/22194/read-or-change-nrf51-mac-address-on-zephyr/156634#156634

 

Any feedback is very welcome,

Thanks in advance,

Frank


Re: __ASSERT - transfer to error handler

Paul Sokolovsky
 

Hello Kristoffer,

As a quick reply, definitely ack on the problem statement. I can say
more, I'm patiently waiting for a paradise times when on CPU exception,
assert, etc., we'll be ending up in debugger, point to the instruction
where the problem happened (or it can be seen in backtrace). (To be
exact, I'm talking about running in QEMU first of all, I actually
don't remember how that works on real hw.)

As for specific implementation, perhaps more knowledgeable people can
comment. I would just point that an obvious override point is
__ASSERT_POST macro itself. I.e. instead of defining it
unconditionally, we can have #ifdef around it, and let a user override
it before inclusion of Zephyr headers. That's the simplest, but
perhaps not the most scalable solution.


On Fri, 09 Nov 2018 01:39:34 -0800
kristoffer.skoien@... wrote:

Current implementation:

The __ASSERT macro is extensively used in the Zephyr code base and in
application code for debugging during development.

In case of an ASSERT, the code jumps to __ASSERT_POST which spins the
given thread in a while(1).

 

Issue:

During development and debugging, simply looping the thread will mask
that the ASSERT has triggered. The only feedback the user gets of an
assert is a printout.

This can be missed if e.g.:

- The RTT or Serial debug interface is down or unused

- There is too much logging so that the “ASSERTION FAIL” can be missed

 

Proposed solution:

In __ASSERT_POST provide a function call that will end up a user
definable error handler. E.g. _SysFatalErrorHandler()

 

This will let the developer set given SOC pins in case of an ASSERT,
ask for a specific LED pattern to be set or print further debug
messages.

 

Feedback is appreciated.

 

Kind regards

Kristoffer




--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Zephyr (v1.13.0) HCI_UART running on nRF52 DK why BD address is always 00:00:00:00:00:00 after power cycle #nrf52832

frv
 

Hallo Zephyr community,

 

Anyone knowing why the BD address is always the ZERO address, when using the nRF52 board running the Zephyr HCI uart hex.

I also see that the random address remains the same after power cycling the nRF board.

Also differences in showing the address for the HCI controller when running the bluetoothctl and hcitool dev commands.

Nor using the hcitool or btmgmt tool makes it possible to adjust the addressing, only so far the hcitool cmd 0x3f 0x006 address makes a difference as long as the board is not power cycled (as the setting is volatile, the default non volatile addresses to zero it seems).

 

Please see my findings described more in detail here in the Nordic Dev Zone, last reply in the message queue.

 

https://devzone.nordicsemi.com/f/nordic-q-a/22194/read-or-change-nrf51-mac-address-on-zephyr/156634#156634

 

Any feedback is very welcome,

Thanks in advance,

Frank


Re: #nrf52840 #ble unstable connection #nrf52840 #ble

Chettimada, Vinayak Kariappa
 

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

Could you please test the PR on your board and let me know if its better.

Find attach the patch file as alternative to the diff in PR. Use "git am <patch file>" to apply the changes on latest zephyr master branch.

-Vinayak

-----Original Message-----
From: Randy Chou <rchou3@...>
Date: Friday, 9 November 2018 at 9:22 AM
To: Vinayak Chettimada <vinayak.kariappa.chettimada@...>
Cc: "devel@..." <devel@...>, Nestor Lopez Casado <nlopezcasad@...>
Subject: Re: [Zephyr-devel] #nrf52840 #ble unstable connection

Hi Vinayak,
Thanks for your reply. If you have any idea about this issue I can do the tests from my site.


Regards,
Randy


Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> 於 2018年11月8日 週四 下午6:17寫道:


Your config file looks ok.

I will check if errata 201 will solve your issues. I will try to send you a patch by this weekend.
As I will need to reproduce the issue, you will need to help me if it is the root cause. (with my DK, I did not see issues for hours before I had to be away from my desk).

- Vinayak

-----Original Message-----
From: <devel@...> on behalf of Randy Chou <rchou3@...>
Date: Wednesday, 7 November 2018 at 11:12 AM
To: "devel@..." <devel@...>
Subject: Re: [Zephyr-devel] #nrf52840 #ble unstable connection




Hi Vinayak,
I did some test today by using the latest master, there is no connection parameter update that means the CI keeps in 7.5ms, the connection keeps alive.
I try to update the CI to 30ms manually the connection can keep around 6.5 mins.
attachment is my .config file.

Thanks,
Randy


__ASSERT - transfer to error handler

kristoffer.skoien@...
 

Current implementation:

The __ASSERT macro is extensively used in the Zephyr code base and in application code for debugging during development.

In case of an ASSERT, the code jumps to __ASSERT_POST which spins the given thread in a while(1).

 

Issue:

During development and debugging, simply looping the thread will mask that the ASSERT has triggered. The only feedback the user gets of an assert is a printout.

This can be missed if e.g.:

- The RTT or Serial debug interface is down or unused

- There is too much logging so that the “ASSERTION FAIL” can be missed

 

Proposed solution:

In __ASSERT_POST provide a function call that will end up a user definable error handler. E.g. _SysFatalErrorHandler()

 

This will let the developer set given SOC pins in case of an ASSERT, ask for a specific LED pattern to be set or print further debug messages.

 

Feedback is appreciated.

 

Kind regards

Kristoffer


Re: #nrf52840 #ble unstable connection #nrf52840 #ble

Randy Chou <rchou3@...>
 

Hi Vinayak,
Thanks for your reply. If you have any idea about this issue I can do the tests from my site.

Regards,
Randy

Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> 於 2018年11月8日 週四 下午6:17寫道:

Your config file looks ok.

I will check if errata 201 will solve your issues. I will try to send you a patch by this weekend.
As I will need to reproduce the issue, you will need to help me if it is the root cause. (with my DK, I did not see issues for hours before I had to be away from my desk).

- Vinayak

-----Original Message-----
From: <devel@...> on behalf of Randy Chou <rchou3@...>
Date: Wednesday, 7 November 2018 at 11:12 AM
To: "devel@..." <devel@...>
Subject: Re: [Zephyr-devel] #nrf52840 #ble unstable connection




    Hi Vinayak,
    I did some test today by using the latest master, there is no connection parameter update that means the CI keeps in 7.5ms, the connection keeps alive.
    I try to update the CI to 30ms manually the connection can keep around 6.5 mins.
    attachment is my .config file.

    Thanks,
    Randy


Re: NRF52832 - setting up NFFS for the external flash W25QXXDV

Johannes Hutter
 

Hey Faisal,

we recently had trouble with the Winbond driver as well, but in the context of FCB and NVS. Something we found is that the current driver doesn't support writing across write pages. So if you call the write function, but the write would cross one of the write page boundaries, the remaining part on the second page is not written. However, we use a W25QxxFV flash, not the DV, so YMMV. We added PRs for the page layout implementation (https://github.com/zephyrproject-rtos/zephyr/pull/11114) as well as writing across write page boundaries (https://github.com/zephyrproject-rtos/zephyr/pull/11113). Maybe this helps.

Best Regards
Joe


On Wed, Nov 7, 2018 at 10:54 PM <faisal.saleem@...> wrote:
Hi

At the moment I am struggling to mount W25QXXDV external flash as NFFS. We have a custom board with nrf52832 connected to the external spi flash W25QXXDV. So Zephyr provides the driver for W25qxxdv, but without page layout implementation. I modified the driver by adding page layout support, simply copied from the nrf flash layout implementation.. given the size is 2MB, page size kept to 4096.. makes 512 pages... please correct me if I shouldn't be doing it... If I don't do it then I get kernel panic because there is no implementation. I know that PAGE_LAYOUT should be disabled to avoid it but one of the settings is overriding PAGE_LAYOUT to be activated even if I disable it.. 

#if defined(CONFIG_FLASH_PAGE_LAYOUT)
static struct flash_pages_layout dev_layout;
 
static void flash_W25QXXDV_pages_layout(struct device *dev,
     const struct flash_pages_layout **layout,
     size_t *layout_size)
{
dev_layout.pages_count = 512;
dev_layout.pages_size = 4096;
*layout = &dev_layout;
*layout_size = 1;
}
#endif /* CONFIG_FLASH_PAGE_LAYOUT */
 
static const struct flash_driver_api spi_flash_api = {
.read = spi_flash_wb_read,
.write = spi_flash_wb_write,
.erase = spi_flash_wb_erase,
.write_protection = spi_flash_wb_write_protection_set,
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
#if 0
.page_layout = (flash_api_pages_layout)
       flash_page_layout_not_implemented,
#else
.page_layout = flash_W25QXXDV_pages_layout,
#endif
#endif
.write_block_size = 1};

I could also see that the nffs_mount function inside nffs_fs.c has hardcoded the flash id to 0.. does it indicate that NFFS is to be implemented only the internal flash... I have disabled that bit here and I am setting  "flash_desc" before entering the function and passing it through the input argument "mountp"... Please correct if my understanding is wrong.. e.g., 
                flash_desc.id = 1;
flash_desc.sector_count = flash_get_page_count(flash_dev);
flash_desc.area_offset = 0; //1044480;
flash_desc.area_size = 1048576;   //even though it is 2MB, I am only using 1MB for now...

static int nffs_mount(struct fs_mount_t *mountp)
{
struct nffs_flash_desc *flash_desc =
(struct nffs_flash_desc *)mountp->fs_data;
int cnt;
int rc;
 
/* Set flash device */
flash_dev = (struct device *)mountp->storage_dev;
 
/* Set flash descriptor fields */
#if 0
flash_desc->id = 0;
flash_desc->sector_count = flash_get_page_count(flash_dev);
flash_desc->area_offset = FLASH_AREA_STORAGE_OFFSET;
flash_desc->area_size = FLASH_AREA_STORAGE_SIZE;
#endif
rc = nffs_misc_reset();
if (rc) {
return -EIO;
}
 
cnt = CONFIG_NFFS_FILESYSTEM_MAX_AREAS;
rc = nffs_misc_desc_from_flash_area(flash_desc, &cnt, descs);
if (rc) {
return -EIO;
}
 
rc = nffs_restore_full(descs);
switch (rc) {
case 0:
break;
case FS_ECORRUPT:
rc = nffs_format_full(descs);
if (rc) {
return -EIO;
}
break;
default:
return -EIO;
}
 
return 0;}
So I could see that there is no "Lost+Found" directory inside the external flash, and when it tries to create it, it fails while writing.. thus I am getting -5 (EIO) message when I am trying to mount it...
Inside "nffs_restore_full" function, it does nffs_restore_area_contents(..) ... I could see activity on the pins when I probe it.. then it ensures that the file system contains a valid scratch area... then it ensures that the file system contains a valid root directory.. finally when it is trying to confirm, if there is a lost+found directory,.. which is not there, so it tries to create it and in turn writes to it, which fails... and it fails to mount...


my prj.conf looks like


CONFIG_FLASH_HAS_DRIVER_ENABLED=y
CONFIG_FLASH_HAS_PAGE_LAYOUT=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_SOC_FLASH_NRF=y
CONFIG_SOC_FLASH_NRF_RADIO_SYNC=y
CONFIG_SPI_FLASH_W25QXXDV=y
CONFIG_SPI_FLASH_W25QXXDV_SPI_NAME="SPI_1"
CONFIG_SPI_FLASH_W25QXXDV_DRV_NAME="W25QXXDV"
CONFIG_SPI_FLASH_W25QXXDV_INIT_PRIORITY=80
CONFIG_SPI_FLASH_W25QXXDV_SPI_FREQ_0=1000000
CONFIG_SPI_FLASH_W25QXXDV_SPI_SLAVE=1
CONFIG_SPI_FLASH_W25QXXDV_GPIO_SPI_CS=y
CONFIG_SPI_FLASH_W25QXXDV_GPIO_SPI_CS_DRV_NAME="GPIO_0"
CONFIG_SPI_FLASH_W25QXXDV_GPIO_SPI_CS_PIN=29
CONFIG_SPI_FLASH_W25QXXDV_GPIO_CS_WAIT_DELAY=50
CONFIG_SPI_FLASH_W25QXXDV_FLASH_SIZE=2097152
CONFIG_SPI_FLASH_W25QXXDV_DEVICE_ID=0x00ef4015
CONFIG_FS_FLASH_STORAGE_PARTITION=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_FS_NFFS_FLASH_DEV_NAME="W25QXXDV"
CONFIG_FILE_SYSTEM=y
CONFIG_FS_NFFS_NUM_BLOCKS=1024
CONFIG_FS_NFFS_NUM_INODES=1024
CONFIG_FS_NFFS_NUM_CACHE_BLOCKS=1
CONFIG_FS_NFFS_NUM_CACHE_INODES=1
CONFIG_FS_NFFS_NUM_DIRS=4
CONFIG_FS_NFFS_NUM_FILES=4
CONFIG_FS_NFFS_NUM_INODES=64
CONFIG_NFFS_FILESYSTEM_MAX_AREAS=64
CONFIG_NFFS_FILESYSTEM_MAX_BLOCK_SIZE=128

If there is an example where we are utilizing both internal and external flash as NFFS, that would be useful... 

Below is my dts file... I have modified it and I can easily make the internal flash work correctly as NFFS.. I can easily upload and download a file into the internal flash via mynewt from our mac computer, size around 23k. I had to reduce the maximum data chunk size for file upload and download from 512 to 256 or else it would give me errors and would never finish the transfer... Now I want to store images into the external flash which is why i need to setup NFFS on it..  


/dts-v1/;
#include <nordic/nrf52832.dtsi>
 
/ {
model = "Nordic PCA10040 Dev Kit";
compatible = "nordic,pca10040-dk", "nordic,nrf52832-qfaa",
     "nordic,nrf52832";
 
chosen {
zephyr,console = &uart0;
#ifdef CONFIG_MCUMGR_SMP_UART
zephyr,uart-mcumgr = &uart0;
#endif
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};
 
&adc {
status ="ok";
};
 
&gpiote {
status ="ok";
};
 
&gpio0 {
status ="ok";
};
 
&uart0 {
status = "ok";
compatible = "nordic,nrf-uart";
current-speed = <115200>;
};
 
&i2c0 {
status = "ok";
sda-pin = <26>;
scl-pin = <27>;
};
 
&i2c1 {
status = "ok";
sda-pin = <30>;
scl-pin = <31>;
};
 
&flash0 {
/*
* For more information, see:
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
 
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0xc000>;
};
slot0_partition: partition@c000 {
label = "image-0";
reg = <0x0000C000 0x32000>;
};
slot1_partition: partition@3e000 {
label = "image-1";
reg = <0x0003E000 0x32000>;
};
scratch_partition: partition@70000 {
label = "image-scratch";
reg = <0x00070000 0xa000>;
};
 
#if defined(CONFIG_FS_FLASH_STORAGE_PARTITION)
storage_partition: partition@7a000 {
label = "storage";
reg = <0x0007a000 0x00006000>;
};
#endif
};
};


Any help is appreciated, Thanks

Faisal



--

Johannes Hutter
Mail: johannes@... 


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

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



Re: #nrf52840 #ble unstable connection #nrf52840 #ble

Chettimada, Vinayak Kariappa
 

Your config file looks ok.

I will check if errata 201 will solve your issues. I will try to send you a patch by this weekend.
As I will need to reproduce the issue, you will need to help me if it is the root cause. (with my DK, I did not see issues for hours before I had to be away from my desk).

- Vinayak

-----Original Message-----
From: <devel@...> on behalf of Randy Chou <rchou3@...>
Date: Wednesday, 7 November 2018 at 11:12 AM
To: "devel@..." <devel@...>
Subject: Re: [Zephyr-devel] #nrf52840 #ble unstable connection




Hi Vinayak,
I did some test today by using the latest master, there is no connection parameter update that means the CI keeps in 7.5ms, the connection keeps alive.
I try to update the CI to 30ms manually the connection can keep around 6.5 mins.
attachment is my .config file.

Thanks,
Randy


Re: usb device network on nrf52840 platform

cpmcparland@...
 

Jukka,

Thanks...learn something new everyday!  This is also a reason for NOT renaming the .conf file for
your project to something unique....which, of course, I did on my first project!

Cheers,
Chuck McP


NRF52832 - setting up NFFS for the external flash W25QXXDV

faisal.saleem@...
 

Hi

At the moment I am struggling to mount W25QXXDV external flash as NFFS. We have a custom board with nrf52832 connected to the external spi flash W25QXXDV. So Zephyr provides the driver for W25qxxdv, but without page layout implementation. I modified the driver by adding page layout support, simply copied from the nrf flash layout implementation.. given the size is 2MB, page size kept to 4096.. makes 512 pages... please correct me if I shouldn't be doing it... If I don't do it then I get kernel panic because there is no implementation. I know that PAGE_LAYOUT should be disabled to avoid it but one of the settings is overriding PAGE_LAYOUT to be activated even if I disable it.. 

#if defined(CONFIG_FLASH_PAGE_LAYOUT)
static struct flash_pages_layout dev_layout;
 
static void flash_W25QXXDV_pages_layout(struct device *dev,
     const struct flash_pages_layout **layout,
     size_t *layout_size)
{
dev_layout.pages_count = 512;
dev_layout.pages_size = 4096;
*layout = &dev_layout;
*layout_size = 1;
}
#endif /* CONFIG_FLASH_PAGE_LAYOUT */
 
static const struct flash_driver_api spi_flash_api = {
.read = spi_flash_wb_read,
.write = spi_flash_wb_write,
.erase = spi_flash_wb_erase,
.write_protection = spi_flash_wb_write_protection_set,
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
#if 0
.page_layout = (flash_api_pages_layout)
       flash_page_layout_not_implemented,
#else
.page_layout = flash_W25QXXDV_pages_layout,
#endif
#endif
.write_block_size = 1};

I could also see that the nffs_mount function inside nffs_fs.c has hardcoded the flash id to 0.. does it indicate that NFFS is to be implemented only the internal flash... I have disabled that bit here and I am setting  "flash_desc" before entering the function and passing it through the input argument "mountp"... Please correct if my understanding is wrong.. e.g., 
                flash_desc.id = 1;
flash_desc.sector_count = flash_get_page_count(flash_dev);
flash_desc.area_offset = 0; //1044480;
flash_desc.area_size = 1048576;   //even though it is 2MB, I am only using 1MB for now...

static int nffs_mount(struct fs_mount_t *mountp)
{
struct nffs_flash_desc *flash_desc =
(struct nffs_flash_desc *)mountp->fs_data;
int cnt;
int rc;
 
/* Set flash device */
flash_dev = (struct device *)mountp->storage_dev;
 
/* Set flash descriptor fields */
#if 0
flash_desc->id = 0;
flash_desc->sector_count = flash_get_page_count(flash_dev);
flash_desc->area_offset = FLASH_AREA_STORAGE_OFFSET;
flash_desc->area_size = FLASH_AREA_STORAGE_SIZE;
#endif
rc = nffs_misc_reset();
if (rc) {
return -EIO;
}
 
cnt = CONFIG_NFFS_FILESYSTEM_MAX_AREAS;
rc = nffs_misc_desc_from_flash_area(flash_desc, &cnt, descs);
if (rc) {
return -EIO;
}
 
rc = nffs_restore_full(descs);
switch (rc) {
case 0:
break;
case FS_ECORRUPT:
rc = nffs_format_full(descs);
if (rc) {
return -EIO;
}
break;
default:
return -EIO;
}
 
return 0;}
So I could see that there is no "Lost+Found" directory inside the external flash, and when it tries to create it, it fails while writing.. thus I am getting -5 (EIO) message when I am trying to mount it...
Inside "nffs_restore_full" function, it does nffs_restore_area_contents(..) ... I could see activity on the pins when I probe it.. then it ensures that the file system contains a valid scratch area... then it ensures that the file system contains a valid root directory.. finally when it is trying to confirm, if there is a lost+found directory,.. which is not there, so it tries to create it and in turn writes to it, which fails... and it fails to mount...


my prj.conf looks like


CONFIG_FLASH_HAS_DRIVER_ENABLED=y
CONFIG_FLASH_HAS_PAGE_LAYOUT=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_SOC_FLASH_NRF=y
CONFIG_SOC_FLASH_NRF_RADIO_SYNC=y
CONFIG_SPI_FLASH_W25QXXDV=y
CONFIG_SPI_FLASH_W25QXXDV_SPI_NAME="SPI_1"
CONFIG_SPI_FLASH_W25QXXDV_DRV_NAME="W25QXXDV"
CONFIG_SPI_FLASH_W25QXXDV_INIT_PRIORITY=80
CONFIG_SPI_FLASH_W25QXXDV_SPI_FREQ_0=1000000
CONFIG_SPI_FLASH_W25QXXDV_SPI_SLAVE=1
CONFIG_SPI_FLASH_W25QXXDV_GPIO_SPI_CS=y
CONFIG_SPI_FLASH_W25QXXDV_GPIO_SPI_CS_DRV_NAME="GPIO_0"
CONFIG_SPI_FLASH_W25QXXDV_GPIO_SPI_CS_PIN=29
CONFIG_SPI_FLASH_W25QXXDV_GPIO_CS_WAIT_DELAY=50
CONFIG_SPI_FLASH_W25QXXDV_FLASH_SIZE=2097152
CONFIG_SPI_FLASH_W25QXXDV_DEVICE_ID=0x00ef4015
CONFIG_FS_FLASH_STORAGE_PARTITION=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_FS_NFFS_FLASH_DEV_NAME="W25QXXDV"
CONFIG_FILE_SYSTEM=y
CONFIG_FS_NFFS_NUM_BLOCKS=1024
CONFIG_FS_NFFS_NUM_INODES=1024
CONFIG_FS_NFFS_NUM_CACHE_BLOCKS=1
CONFIG_FS_NFFS_NUM_CACHE_INODES=1
CONFIG_FS_NFFS_NUM_DIRS=4
CONFIG_FS_NFFS_NUM_FILES=4
CONFIG_FS_NFFS_NUM_INODES=64
CONFIG_NFFS_FILESYSTEM_MAX_AREAS=64
CONFIG_NFFS_FILESYSTEM_MAX_BLOCK_SIZE=128

If there is an example where we are utilizing both internal and external flash as NFFS, that would be useful... 

Below is my dts file... I have modified it and I can easily make the internal flash work correctly as NFFS.. I can easily upload and download a file into the internal flash via mynewt from our mac computer, size around 23k. I had to reduce the maximum data chunk size for file upload and download from 512 to 256 or else it would give me errors and would never finish the transfer... Now I want to store images into the external flash which is why i need to setup NFFS on it..  


/dts-v1/;
#include <nordic/nrf52832.dtsi>
 
/ {
model = "Nordic PCA10040 Dev Kit";
compatible = "nordic,pca10040-dk", "nordic,nrf52832-qfaa",
     "nordic,nrf52832";
 
chosen {
zephyr,console = &uart0;
#ifdef CONFIG_MCUMGR_SMP_UART
zephyr,uart-mcumgr = &uart0;
#endif
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};
 
&adc {
status ="ok";
};
 
&gpiote {
status ="ok";
};
 
&gpio0 {
status ="ok";
};
 
&uart0 {
status = "ok";
compatible = "nordic,nrf-uart";
current-speed = <115200>;
};
 
&i2c0 {
status = "ok";
sda-pin = <26>;
scl-pin = <27>;
};
 
&i2c1 {
status = "ok";
sda-pin = <30>;
scl-pin = <31>;
};
 
&flash0 {
/*
* For more information, see:
* http://docs.zephyrproject.org/devices/dts/flash_partitions.html
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
 
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0xc000>;
};
slot0_partition: partition@c000 {
label = "image-0";
reg = <0x0000C000 0x32000>;
};
slot1_partition: partition@3e000 {
label = "image-1";
reg = <0x0003E000 0x32000>;
};
scratch_partition: partition@70000 {
label = "image-scratch";
reg = <0x00070000 0xa000>;
};
 
#if defined(CONFIG_FS_FLASH_STORAGE_PARTITION)
storage_partition: partition@7a000 {
label = "storage";
reg = <0x0007a000 0x00006000>;
};
#endif
};
};


Any help is appreciated, Thanks

Faisal


【HCI_UART】hci_uart sample cannot advertise controlled by HCI commands #nrf52832 #uart #hci

icephyr
 

Hi guys, I met a problem with official hci_uart sample. Hope anybody can give me any advice,thanks.

I use NRF52832's official develop board running hci_uart sample as a controller, I send hci commands to it to make it advertise outside, also I open btmon to observe the process. It seems worked and output like this below. But I did not find the packet when I use my cell phone to scan the advertise packet. So my question is, Does hci_uart sample support the advertise function ? Any methods can help to resolve this problem ? Thanks


How to use Nordic ppi on zephyr. #nrf52 #ppi

Felipe Gabardo Gonçalves <felipe@...>
 

Hey guys,

I'm tryinig to create an external counter on nrf52 for 10MHz using PPI, GPIOTE and time counter but I don't know where I'm doing it wrong. Follow my code so far. The commented part is just a test I did with interruption to test the hardware, obviosly it won't reach the required 10MHz.


If anyone has any inputs would be very helpfull.

Regards,


Re: #nrf52840 #ble unstable connection #nrf52840 #ble

Randy Chou <rchou3@...>
 

Hi Vinayak,
I did some test today by using the latest master, there is no connection parameter update that means the CI keeps in 7.5ms, the connection keeps alive.
I try to update the CI to 30ms manually the connection can keep around 6.5 mins.
attachment is my .config file.

Thanks,
Randy


Re: usb device network on nrf52840 platform

Jukka Rissanen
 

On Tue, 2018-11-06 at 10:38 -0800, cpmcparland@... wrote:
When the first line is uncommented, I get compile-time errors like
the following (simple variations not copied here-
but, I can send complete listing if needed).

$cmake -DCONF_FILE="prj.conf overlay-netusb.conf"
-DBOARD=nrf52840_pca10056 ../../
BTW, you can also say

$ cmake -DOVERLAY_CONFIG=overlay-netusb.conf -DBOARD=nrf52840_pca10056
../..

as prj.conf is automatically included anyway.
Using -DCONF_FILE="prj.conf overlay-netusb.conf" works too of course.


Cheers,
Jukka


Re: [Question] zephyr file transfer via BLE

우승우 <du5102@...>
 

Hi Carles

 

I have a question

 

NOW

 

Scenario

                               BLE file transfer                                    UART(file)

Android app (mcumgr) ----------------------à Nordic(nrf52810) ---------------à AP(zephyr OS)

 

refer to the following code you shared.

Check the smp server sample here: https://github.com/zephyrproject-rtos/zephyr/tree/master/samples/subsys/mgmt/mcumgr/smp_svr

And the corresponding Android libraries here: https://github.com/runtimeco/mcumgr-android

 

I am aiming to send a file from mobile to BLE and ultimately to transfer the file to UART.

 

smp_svr Is this code the AP code or the hex code that I need to put in Nordic?

 

I do think, I need both Nordic code and AP code.?

 

Thanks you

 

From: Cufi, Carles [mailto:Carles.Cufi@...]
Sent: Thursday, October 18, 2018 5:15 PM
To:
우승우 <du5102@...>; devel@...
Subject: Re: [Zephyr-devel] [Question] zephyr file transfer via BLE

 

Hi there,

 

I believe mcumgr will allow you to do what you need.

Check the smp server sample here: https://github.com/zephyrproject-rtos/zephyr/tree/master/samples/subsys/mgmt/mcumgr/smp_svr

And the corresponding Android libraries here: https://github.com/runtimeco/mcumgr-android

 

Carles

 

From: <devel@...> on behalf of 우승우 <du5102@...>
Date: Thursday, 18 October 2018 at 09:35
To: "devel@..." <devel@...>
Subject: [Zephyr-devel] [Question] zephyr file transfer via BLE

 

Hi, This is seungwoo

 

I have a question

 

If you look at the site below, I can transfer BLE file using Nordic chip.

https://devzone.nordicsemi.com/f/nordic-q-a/33093/transfer-big-file-over-ble

 

nrf52-ble-image-transfer-demo çè Android-Image-Transfer-Demo   // file transfer

 

I am trying to develop a device with BLE functionality using nrf52810 in zephyr OS.

 

Like nrf52-ble-image-transfer-demo, Can I use zephyr with an application that can transfer files with Android?

 

Or I would like to ask if there is a case in which Zephyr tried to implement file transmission via BLE.

 

Thanks you


Re: usb device network on nrf52840 platform

cpmcparland@...
 

Andrezej, thanks for looking at this.  To keep things simple, I went back to the sample project:

samples/net/echo_server

With the exception of adding the first line, I don't believe I have changed anything from the zephyr clone I
made a few weeks ago (1_13_99).  Here's the prj.conf.

************************************************
#CONFIG_NEWLIB_LIBC=y
# Generic networking options
CONFIG_NETWORKING=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=y
#CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y
#CONFIG_NET_DHCPV4=y

# Kernel options
#CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y
#CONFIG_INIT_STACKS=y

# Logging
CONFIG_NET_LOG=y
CONFIG_LOG=y
CONFIG_NET_STATISTICS=y
CONFIG_PRINTK=y

# Network buffers
CONFIG_NET_PKT_RX_COUNT=14
CONFIG_NET_PKT_TX_COUNT=14
CONFIG_NET_BUF_RX_COUNT=36
CONFIG_NET_BUF_TX_COUNT=36
CONFIG_NET_CONTEXT_NET_PKT_POOL=y

# IP address options
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3
#CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=4
CONFIG_NET_MAX_CONTEXTS=10

# Network shell
CONFIG_NET_SHELL=y

# Network application options and configuration
CONFIG_NET_APP_SERVER=y
CONFIG_NET_CONFIG_SETTINGS=y
#CONFIG_NET_CONFIG_NEED_IPV6=y
CONFIG_NET_CONFIG_NEED_IPV4=y
#CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
#CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2"
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"

***************************************************
When the first line is uncommented, I get compile-time errors like the following (simple variations not copied here-
but, I can send complete listing if needed).

$cmake -DCONF_FILE="prj.conf overlay-netusb.conf" -DBOARD=nrf52840_pca10056 ../../
.... cmake completes successfully ...
$make
Scanning dependencies of target kobj_types_h_target
[  0%] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h
[  0%] Built target kobj_types_h_target
Scanning dependencies of target syscall_list_h_target
[  1%] Generating misc/generated/syscalls.json
[  1%] Generating include/generated/syscall_dispatch.c, include/generated/syscall_list.h
[  2%] Built target syscall_list_h_target
Scanning dependencies of target syscall_macros_h_target
[  2%] Generating include/generated/syscall_macros.h
[  2%] Built target syscall_macros_h_target
Scanning dependencies of target driver_validation_h_target
[  2%] Generating include/generated/driver-validation.h
[  2%] Built target driver_validation_h_target
Scanning dependencies of target offsets
[  2%] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj
[  3%] Linking C static library liboffsets.a
[  3%] Built target offsets
Scanning dependencies of target offsets_h
[  3%] Generating include/generated/offsets.h
[  3%] Built target offsets_h
Scanning dependencies of target app
[  3%] Building C object CMakeFiles/app.dir/src/echo-server.c.obj
[  4%] Building C object CMakeFiles/app.dir/src/udp.c.obj
[  4%] Building C object CMakeFiles/app.dir/src/tcp.c.obj
[  5%] Linking C static library libapp.a
[  5%] Built target app
Scanning dependencies of target zephyr
[  6%] Building C object zephyr/CMakeFiles/zephyr.dir/arch/common/isr_tables.c.obj
[  7%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/thread_entry.c.obj
[  7%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc32_sw.c.obj
[  8%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc16_sw.c.obj
[  8%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc8_sw.c.obj
[  9%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/mempool/mempool.c.obj
[  9%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/rbtree/rb.c.obj
[ 10%] Building C object zephyr/CMakeFiles/zephyr.dir/misc/printk.c.obj
[ 11%] Building C object zephyr/CMakeFiles/zephyr.dir/misc/generated/configs.c.obj
[ 11%] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/nrf52/power.c.obj
[ 12%] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/nrf52/soc.c.obj
[ 12%] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/nrf52/mpu_regions.c.obj
[ 13%] Building C object zephyr/CMakeFiles/zephyr.dir/ext/hal/nordic/nrfx/mdk/system_nrf52840.c.obj
[ 13%] Building C object zephyr/CMakeFiles/zephyr.dir/ext/hal/nordic/nrfx_glue.c.obj
[ 14%] Building C object zephyr/CMakeFiles/zephyr.dir/ext/hal/nordic/nrfx/drivers/src/nrfx_systick.c.obj
[ 15%] Building C object zephyr/CMakeFiles/zephyr.dir/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c.obj

In file included from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/nrfx.h:37:0,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:32:
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:161:5: error: expected declaration specifiers or ‘...’ before ‘(’ token
     ((NRF_USBD_EPIN_CHECK(ep) ? NRFX_USBD_EPIN_BITPOS_0 : NRFX_USBD_EPOUT_BITPOS_0) \
     ^
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/./nrfx_glue.h:65:23: note: in definition of macro ‘NRFX_STATIC_ASSERT’
         static_assert(expression, "assertion failed")
                       ^~~~~~~~~~
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:185:20: note: in expansion of macro ‘NRFX_USBD_EP_BITPOS’
 NRFX_STATIC_ASSERT(NRFX_USBD_EP_BITPOS(NRFX_USBD_EPIN1)  == USBD_EPDATASTATUS_EPIN1_Pos );
                    ^~~~~~~~~~~~~~~~~~~

... more similar errors...

In file included from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/nrfx.h:37:0,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:32:
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c: In function ‘usbd_dmareq_process’:
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:1397:50: warning: passing argument 1 of ‘atomic_and’ from incompatible pointer type [-Wincompatible-pointer-types]
                     (void)(NRFX_ATOMIC_FETCH_AND(&m_ep_dma_waiting, ~(1U << pos)));
                                                  ^
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/./nrfx_glue.h:186:58: note: in definition of macro ‘NRFX_ATOMIC_FETCH_AND’
 #define NRFX_ATOMIC_FETCH_AND(p_data, value)  atomic_and(p_data, value)
                                                          ^~~~~~
In file included from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/include/kernel_includes.h:21:0,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/include/kernel.h:17,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/./nrfx_glue.h:139,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/nrfx.h:37,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:32:
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/include/atomic.h:248:28: note: expected ‘atomic_t * {aka int *}’ but argument is of type ‘uint32_t * {aka long unsigned int *}’
 static inline atomic_val_t atomic_and(atomic_t *target, atomic_val_t value)
                            ^~~~~~~~~~
zephyr/CMakeFiles/zephyr.dir/build.make:257: recipe for target 'zephyr/CMakeFiles/zephyr.dir/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c.obj' failed

... more similar errors...

I know echo_server does not require newlib; but my app may.  This is the same behavior I see in my project.
Thought focusing on a sample project would help keep things a bit clearer.

Cheers,
Chuck McP


Re: usb device network on nrf52840 platform

Puzdrowski, Andrzej
 

Hi

 

I’m unable to reproduce this problem – I mean that I did not encounter problem compiling usbd along with newlibc.

Can you point prj.conf you used, or even the project?

 

From: devel@... [mailto:devel@...] On Behalf Of cpmcparland@...
Sent: Tuesday, November 06, 2018 12:41 AM
To: devel@...
Subject: Re: [Zephyr-devel] usb device network on nrf52840 platform

 

Well, as is usually the case, as soon as I'm convinced I'm stuck and send off a note, I try something else and make a bit
of progress......sigh.  The new project I was trying to integrate with an ecm usb network device interface had the following in prj.conf:

CONFIG_NEWLIB_LIBC=y

As soon as I removed that line, nrfx_usbd.c compiled - as did everything else.  The requirement for newlib may have been historical
and possibly irrelevant now.  I was doing some testing with a 3rd party source code package.  But, I don't know if this constitutes an
issue with the newlib code in the present distribution (1_13_99).  Can't say that my code is now functional, but the bizarre compiler behavior has disappeared. 
So, I think an interaction with the current newlib code is the cause of my initial problem.

Any comments on this are appreciated.  I may need newlib for compatibility reasons later on....would like to understand what's going on
here.

Regards,
Chuck McP


Re: usb device network on nrf52840 platform

cpmcparland@...
 

Well, as is usually the case, as soon as I'm convinced I'm stuck and send off a note, I try something else and make a bit
of progress......sigh.  The new project I was trying to integrate with an ecm usb network device interface had the following in prj.conf:

CONFIG_NEWLIB_LIBC=y

As soon as I removed that line, nrfx_usbd.c compiled - as did everything else.  The requirement for newlib may have been historical
and possibly irrelevant now.  I was doing some testing with a 3rd party source code package.  But, I don't know if this constitutes an
issue with the newlib code in the present distribution (1_13_99).  Can't say that my code is now functional, but the bizarre compiler behavior has disappeared. 
So, I think an interaction with the current newlib code is the cause of my initial problem.

Any comments on this are appreciated.  I may need newlib for compatibility reasons later on....would like to understand what's going on
here.

Regards,
Chuck McP