Date   

SFCB to save persistence data for #bluetoothmesh

Vikrant More <vikrant8051@...>
 

Hi Johan,

Is SFCB better option than NFFS to save #BluetoothMesh's persistence data ?
Will it help us in case of nRF51 series which has limited flash storage ?

Thank You !!



---------- Forwarded message ----------
From: Laczen JMS <laczenjms@...>
Date: Sat, Feb 10, 2018 at 2:30 PM
Subject: Re: [Zephyr-devel] [Zephyr-users] Power Configuration of nrf52840 (Vikrant More)
To: zephyr-devel@...


Hi Vikrant,

NFFS file system might not be a good choice to store frequently changing data.

For this case I have created a library called sfcb that you can find
in my zephyr project fork: https://github.com/Laczen/zephyr. The sfcb
(simple flash circular buffer) allows you to store data in a series of
sectors in flash.

All data is stored as a identifier-value pair, the identifier is a 16
bit value, the data can be anything from a byte to a very long string
of bytes (limited by the sector size). By writing a new
identifier-value pair the previous pair with the same identifier is
considered overwritten.

When all the available sectors have been used the library does a
garbage collection phase before erasing a sector. In this phase it
makes sure that there is at least one identifier-value pair for each
identifier.

The library allows you to combine almost constant data: node address,
netkeys, groups together with frequently changing data: sequence
number, iv_index into one storage solution, without wearing out flash
to fast. The almost constant data could be stored into one
identifier-value pair, the frequently changing in a different
identifier-value pair. Of course for the sequence number you will need
to avoid storing it for every change.

It can also be used in different cases where you would like to combine
the storage of network address, device name, ... in combination with
the device state (e.g. light switched on) in the same storage
solution.

Another use of the library is to consider the identifier as a file
name and the value as file contents.

In my zephyr project fork you can find a simple example in samples/subsys/sfcb.

Kind regards,

Jehudi



Re: [Zephyr-devel] Power Configuration of nrf52840

Chettimada, Vinayak Kariappa
 

1. Correction, values in UICR are at fixed location, changing them is not needed on every power up of the board.That said, after a change, a power cycle is need for h/w to load the new values. And yes, if you erase and flash UICR, its same as erase and flash a new firmware.
2. For your use case of storing frequently changing data, you need some sort of wear leveling. 


On 10 Feb 2018, at 07:17, Vikrant More <vikrant8051@...> wrote:

But nrf52 flash support 10K write cycle. And it is like normal programming, isn't it ?

Worrying after reading your this statement, since I'm now trying to save persistent data which generate during working of #BluetoothMesh on flash of nRF52.

I used NFFS file system for testing. 

On Feb 10, 2018 10:57 AM, "Chettimada, Vinayak Kariappa" <vinayak.kariappa.chettimada@...> wrote:
Hope you are doing it “only once per board’s life time” else you could be degrading the flash. Hence, my advice is to use nrfjprog to make the change "only once" per each board or use the design in soc.c wherein the value is first compared before writing.

-Vinayak

On 9 Feb 2018, at 07:20, ashish.shukla@... wrote:

Thanks everyone !!!

Adding these lines does the job. 

 NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    }

    NRF_UICR->EXTSUPPLY = 0x01;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    } 

    NRF_UICR->REGOUT0 = 0x05;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    }

    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
    {
    }


--
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


On Thu, Feb 8, 2018 at 12:17 AM, Vinayak Kariappa <vinayak.kariappa@gmail.com> wrote:
Hi Ashish,

UICR is Flash, you need to do something similar to in soc.c done for reset pin config. Or use nrfjprog to write values to UICR


On 7 Feb 2018, at 12:04, "ashish.shukla@..." <ashish.shukla@...> wrote:

Hi,

Yes, I'm working in high voltage mode.  VDDH = 3.6V 

Then, I added following lines 

NRF_POWER->DCDCEN0 = 0x01;  // Enabling DC/DC for stage REG0
NRF_POWER->DCDCEN = 0x01;   // Enabling DC/DC for stage REG1 

Again, as you suggested 

NRF_UICR->EXTSUPPLY = 0x01;  
NRF_UICR->REGOUT0 = 0x05;

After adding these lines at starting of main() function, It still measures 1.8V. 


--
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


On Wed, Feb 7, 2018 at 4:16 PM, Puzdrowski, Andrzej <Andrzej.Puzdrowski@nordicsemi.no> wrote:

Hi

So you must have supplied nRF52840 from VDDH pin – so it power regulator circuit works in high voltage mode.

 

Then internal regulator generate the GPIO output voltage:

You need to set UICR->REGOUT0 properly, 5 is proper value for select 3.3 V

 

For more info see nRF52840 OPS, especjali POWER chapter

 

Andrzej

 

From: zephyr-devel-bounces@lists.zephyrproject.org [mailto:zephyr-devel-bounces@lists.zephyrproject.org] On Behalf Of ashish.shukla@...
Sent: Wednesday, February 07, 2018 8:22 AM
To: zephyr-devel@lists.zephyrproject.org; zephyr-users@...
Subject: [Zephyr-devel] Power Configuration of nrf52840

 

Hello everyone !!! 

I'm working with custom PCB of nrf52840. I need to set VDD voltage which is also GPIO high level voltage equals to 3.3V, otherwise it's 1.8V by default.


How can I configure this? 

or 

How can I access registers of nrf52840 in zephyr architecture?    

 

 

--

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

 


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users



Re: [Zephyr-devel] Power Configuration of nrf52840

Vikrant More <vikrant8051@...>
 

But nrf52 flash support 10K write cycle. And it is like normal programming, isn't it ?

Worrying after reading your this statement, since I'm now trying to save persistent data which generate during working of #BluetoothMesh on flash of nRF52.

I used NFFS file system for testing. 

On Feb 10, 2018 10:57 AM, "Chettimada, Vinayak Kariappa" <vinayak.kariappa.chettimada@...> wrote:
Hope you are doing it “only once per board’s life time” else you could be degrading the flash. Hence, my advice is to use nrfjprog to make the change "only once" per each board or use the design in soc.c wherein the value is first compared before writing.

-Vinayak

On 9 Feb 2018, at 07:20, ashish.shukla@... wrote:

Thanks everyone !!!

Adding these lines does the job. 

 NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    }

    NRF_UICR->EXTSUPPLY = 0x01;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    } 

    NRF_UICR->REGOUT0 = 0x05;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    }

    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
    {
    }


--
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


On Thu, Feb 8, 2018 at 12:17 AM, Vinayak Kariappa <vinayak.kariappa@gmail.com> wrote:
Hi Ashish,

UICR is Flash, you need to do something similar to in soc.c done for reset pin config. Or use nrfjprog to write values to UICR


On 7 Feb 2018, at 12:04, "ashish.shukla@..." <ashish.shukla@...> wrote:

Hi,

Yes, I'm working in high voltage mode.  VDDH = 3.6V 

Then, I added following lines 

NRF_POWER->DCDCEN0 = 0x01;  // Enabling DC/DC for stage REG0
NRF_POWER->DCDCEN = 0x01;   // Enabling DC/DC for stage REG1 

Again, as you suggested 

NRF_UICR->EXTSUPPLY = 0x01;  
NRF_UICR->REGOUT0 = 0x05;

After adding these lines at starting of main() function, It still measures 1.8V. 


--
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


On Wed, Feb 7, 2018 at 4:16 PM, Puzdrowski, Andrzej <Andrzej.Puzdrowski@nordicsemi.no> wrote:

Hi

So you must have supplied nRF52840 from VDDH pin – so it power regulator circuit works in high voltage mode.

 

Then internal regulator generate the GPIO output voltage:

You need to set UICR->REGOUT0 properly, 5 is proper value for select 3.3 V

 

For more info see nRF52840 OPS, especjali POWER chapter

 

Andrzej

 

From: zephyr-devel-bounces@lists.zephyrproject.org [mailto:zephyr-devel-bounces@lists.zephyrproject.org] On Behalf Of ashish.shukla@...
Sent: Wednesday, February 07, 2018 8:22 AM
To: zephyr-devel@lists.zephyrproject.org; zephyr-users@...
Subject: [Zephyr-devel] Power Configuration of nrf52840

 

Hello everyone !!! 

I'm working with custom PCB of nrf52840. I need to set VDD voltage which is also GPIO high level voltage equals to 3.3V, otherwise it's 1.8V by default.


How can I configure this? 

or 

How can I access registers of nrf52840 in zephyr architecture?    

 

 

--

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

 


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users


Re: [Zephyr-devel] Power Configuration of nrf52840

Chettimada, Vinayak Kariappa
 

Hope you are doing it “only once per board’s life time” else you could be degrading the flash. Hence, my advice is to use nrfjprog to make the change "only once" per each board or use the design in soc.c wherein the value is first compared before writing.

-Vinayak

On 9 Feb 2018, at 07:20, ashish.shukla@... wrote:

Thanks everyone !!!

Adding these lines does the job. 

 NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    }

    NRF_UICR->EXTSUPPLY = 0x01;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    } 

    NRF_UICR->REGOUT0 = 0x05;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    }

    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
    {
    }


--
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


On Thu, Feb 8, 2018 at 12:17 AM, Vinayak Kariappa <vinayak.kariappa@...> wrote:
Hi Ashish,

UICR is Flash, you need to do something similar to in soc.c done for reset pin config. Or use nrfjprog to write values to UICR


On 7 Feb 2018, at 12:04, "ashish.shukla@..." <ashish.shukla@...> wrote:

Hi,

Yes, I'm working in high voltage mode.  VDDH = 3.6V 

Then, I added following lines 

NRF_POWER->DCDCEN0 = 0x01;  // Enabling DC/DC for stage REG0
NRF_POWER->DCDCEN = 0x01;   // Enabling DC/DC for stage REG1 

Again, as you suggested 

NRF_UICR->EXTSUPPLY = 0x01;  
NRF_UICR->REGOUT0 = 0x05;

After adding these lines at starting of main() function, It still measures 1.8V. 


--
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


On Wed, Feb 7, 2018 at 4:16 PM, Puzdrowski, Andrzej <Andrzej.Puzdrowski@nordicsemi.no> wrote:

Hi

So you must have supplied nRF52840 from VDDH pin – so it power regulator circuit works in high voltage mode.

 

Then internal regulator generate the GPIO output voltage:

You need to set UICR->REGOUT0 properly, 5 is proper value for select 3.3 V

 

For more info see nRF52840 OPS, especjali POWER chapter

 

Andrzej

 

From: zephyr-devel-bounces@...hyrproject.org [mailto:zephyr-devel-bounces@lists.zephyrproject.org] On Behalf Of ashish.shukla@...
Sent: Wednesday, February 07, 2018 8:22 AM
To: zephyr-devel@...ct.org; zephyr-users@...ct.org
Subject: [Zephyr-devel] Power Configuration of nrf52840

 

Hello everyone !!! 

I'm working with custom PCB of nrf52840. I need to set VDD voltage which is also GPIO high level voltage equals to 3.3V, otherwise it's 1.8V by default.


How can I configure this? 

or 

How can I access registers of nrf52840 in zephyr architecture?    

 

 

--

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

 


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel


Re: [Zephyr-devel] (#BluetoothMesh) just binding APP-key allow SRV to process the message

Vikrant More <vikrant8051@...>
 

I'm still waiting for reply.
Is it bug or I'm doing something wrong ?

On Wed, Feb 7, 2018 at 5:47 AM, <alan@...> wrote:



Tarry,

here is the Bluwtooth Mesh programers group.

Alan



On 2018-02-06 02:58, Vikrant More wrote:
Using #meshctl I gave following commands to BOARD_1

appkey-add 1

bind 0 1 1000
bind 0 1 1001
bind 0 1 1002
bind 0 1 1003

sub-add 0100 c000 1000
sub-add 0100 c001 1000

pub-set 0100 c000 1 0 5 1001

sub-add 0100 c000 1002
pub-set 0100 c000 1 0 5 1003

--------------------------------------------------------------------------------------------------

Using #meshctl I gave following commands to BOARD_2

appkey-add 1

bind 0 1 1000
bind 0 1 1001
bind 0 1 1002
bind 0 1 1003

sub-add 0101 c000 1000              //in last email I by mistake wrote
0100 instead of 0101, but main Question is as it is.
pub-set 0101 c001 1 0 5 1001
------------------------------------------------------------------------------------------------------

I've hard coded 4 Models, viz,

GEN_ONOFF_SRV

GEN_ONOFF_CLI

GEN_LEVEL_SRV

GEN_LEVEL_CLI

on both boards.

I found something wrong in case of BOARD_2,

where I only bound APP_KEY to all available models but didn't

assign any SUB or PUB addresses to  GEN_LEVEL_SRV or  GEN_LEVEL_CLI

even after that BOARD_2 is processing data publish by GEN_LEVEL_CLIENT
of BOARD_1.

Have anybody noticed it ?
_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel


Re: [Zephyr-devel] Power Configuration of nrf52840

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

Thanks everyone !!!

Adding these lines does the job.

 NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    }

    NRF_UICR->EXTSUPPLY = 0x01;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    }

    NRF_UICR->REGOUT0 = 0x05;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
    }

    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
    {
    }


--
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


On Thu, Feb 8, 2018 at 12:17 AM, Vinayak Kariappa <vinayak.kariappa@...> wrote:
Hi Ashish,

UICR is Flash, you need to do something similar to in soc.c done for reset pin config. Or use nrfjprog to write values to UICR


On 7 Feb 2018, at 12:04, "ashish.shukla@..." <ashish.shukla@...> wrote:

Hi,

Yes, I'm working in high voltage mode.  VDDH = 3.6V

Then, I added following lines

NRF_POWER->DCDCEN0 = 0x01;  // Enabling DC/DC for stage REG0
NRF_POWER->DCDCEN = 0x01;   // Enabling DC/DC for stage REG1

Again, as you suggested

NRF_UICR->EXTSUPPLY = 0x01; 
NRF_UICR->REGOUT0 = 0x05;

After adding these lines at starting of main() function, It still measures 1.8V.


--
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


On Wed, Feb 7, 2018 at 4:16 PM, Puzdrowski, Andrzej <Andrzej.Puzdrowski@nordicsemi.no> wrote:

Hi

So you must have supplied nRF52840 from VDDH pin – so it power regulator circuit works in high voltage mode.

 

Then internal regulator generate the GPIO output voltage:

You need to set UICR->REGOUT0 properly, 5 is proper value for select 3.3 V

 

For more info see nRF52840 OPS, especjali POWER chapter

 

Andrzej

 

From: zephyr-devel-bounces@...hyrproject.org [mailto:zephyr-devel-bounces@lists.zephyrproject.org] On Behalf Of ashish.shukla@...
Sent: Wednesday, February 07, 2018 8:22 AM
To: zephyr-devel@...ct.org; zephyr-users@...ct.org
Subject: [Zephyr-devel] Power Configuration of nrf52840

 

Hello everyone !!!

I'm working with custom PCB of nrf52840. I need to set VDD voltage which is also GPIO high level voltage equals to 3.3V, otherwise it's 1.8V by default.


How can I configure this?

or

How can I access registers of nrf52840 in zephyr architecture?    

 

 

--

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

 


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users


Re: Happy Gecko Support

Kumar Gala
 

We support boards/SoC with 8KB of RAM like nucleo_f030r8

- k

On Feb 8, 2018, at 11:47 AM, Felipe Neves <ryukokki.felipe@gmail.com> wrote:

Hi Marcio, I did not see this 8KB of RAM as a problem, look from the zephyr documentation:

"The configurable nature of the kernel allows you to incorporate only those features needed by your application, making it ideal for systems with limited amounts of memory (as little as 2 KB!) or with simple multi-threading requirements (such as a set of interrupt handlers and a single background task). Examples of such systems include: embedded sensor hubs, environmental sensors, simple LED wearable, and store inventory tags.

Applications requiring more memory (50 to 900 KB), multiple communication devices (like WiFi and Bluetooth Low Energy), and complex multi-threading, can also be developed using the Zephyr kernel. Examples of such systems include: fitness wearables, smart watches, and IoT wireless gateways."

The 64KB of flash seems to be very reasonable to me for a M0+ microcontroller, the Happy Gecko has similar specs of a nordic NRF51 cortex M0+ and its port has support to BT stack :)


I'm wondering if a port to Bosch XDK (built around gecko mcus) could be a funny thing since their SDK's BT stack is closed source and only supports peripheral role :(


Felipe



2018-02-08 14:40 GMT-02:00 Marcio Montenegro <mtuxpe@gmail.com>:
Hi ,
Unfortunately Happy Gecko has only 8 Kb of RAM memory.

https://www.silabs.com/products/mcu/32-bit/efm32-happy-gecko

On Thu, Feb 8, 2018 at 2:26 PM, Kumar Gala <kumar.gala@linaro.org> wrote:

On Feb 8, 2018, at 6:51 AM, Ionut Cosmin Mihai <ionut.cosmin.mihai@gmail.com> wrote:

Hi,

I'm new to Zephyr. Is it possible to use it for EFM32 Happy Gecko? (https://www.silabs.com/products/mcu/32-bit/efm32-happy-gecko)

I see that it only supports Wonder Gecko.
One would need to port the Happy Gecko SoC and a board to Zephyr. Since Wonder Gecko has been ported, I’d expect that it wouldn’t be too difficult to do this.

- k
_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--
Felipe S. Neves
Embedded software & systems engineer
Skype: fneves1989
+55 11 96610 – 0855
ryukokki.felipe@gmail.com


Re: Happy Gecko Support

Felipe Neves
 

Hi Marcio, I did not see this 8KB of RAM as a problem, look from the zephyr documentation:

"The configurable nature of the kernel allows you to incorporate only those features needed by your application, making it ideal for systems with limited amounts of memory (as little as 2 KB!) or with simple multi-threading requirements (such as a set of interrupt handlers and a single background task). Examples of such systems include: embedded sensor hubs, environmental sensors, simple LED wearable, and store inventory tags.

Applications requiring more memory (50 to 900 KB), multiple communication devices (like WiFi and Bluetooth Low Energy), and complex multi-threading, can also be developed using the Zephyr kernel. Examples of such systems include: fitness wearables, smart watches, and IoT wireless gateways."

The 64KB of flash seems to be very reasonable to me for a M0+ microcontroller, the Happy Gecko has similar specs of a nordic NRF51 cortex M0+ and its port has support to BT stack :)

I'm wondering if a port to Bosch XDK (built around gecko mcus) could be a funny thing since their SDK's BT stack is closed source and only supports peripheral role :(

Felipe



2018-02-08 14:40 GMT-02:00 Marcio Montenegro <mtuxpe@...>:

Hi ,
    Unfortunately Happy Gecko has only 8 Kb of RAM memory.


On Thu, Feb 8, 2018 at 2:26 PM, Kumar Gala <kumar.gala@...> wrote:

> On Feb 8, 2018, at 6:51 AM, Ionut Cosmin Mihai <ionut.cosmin.mihai@...> wrote:
>
> Hi,
>
> I'm new to Zephyr. Is it possible to use it for EFM32 Happy Gecko? (https://www.silabs.com/products/mcu/32-bit/efm32-happy-gecko)
>
> I see that it only supports Wonder Gecko.

One would need to port the Happy Gecko SoC and a board to Zephyr.  Since Wonder Gecko has been ported, I’d expect that it wouldn’t be too difficult to do this.

- k
_______________________________________________
Zephyr-users mailing list
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--
Felipe S. Neves 
Embedded software & systems engineer
Skype: fneves1989
+55 11 96610 – 0855 


Re: Happy Gecko Support

Marcio Montenegro
 

Hi ,
    Unfortunately Happy Gecko has only 8 Kb of RAM memory.


On Thu, Feb 8, 2018 at 2:26 PM, Kumar Gala <kumar.gala@...> wrote:

> On Feb 8, 2018, at 6:51 AM, Ionut Cosmin Mihai <ionut.cosmin.mihai@...> wrote:
>
> Hi,
>
> I'm new to Zephyr. Is it possible to use it for EFM32 Happy Gecko? (https://www.silabs.com/products/mcu/32-bit/efm32-happy-gecko)
>
> I see that it only supports Wonder Gecko.

One would need to port the Happy Gecko SoC and a board to Zephyr.  Since Wonder Gecko has been ported, I’d expect that it wouldn’t be too difficult to do this.

- k
_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users


Re: Happy Gecko Support

Kumar Gala
 

On Feb 8, 2018, at 6:51 AM, Ionut Cosmin Mihai <ionut.cosmin.mihai@gmail.com> wrote:

Hi,

I'm new to Zephyr. Is it possible to use it for EFM32 Happy Gecko? (https://www.silabs.com/products/mcu/32-bit/efm32-happy-gecko)

I see that it only supports Wonder Gecko.
One would need to port the Happy Gecko SoC and a board to Zephyr. Since Wonder Gecko has been ported, I’d expect that it wouldn’t be too difficult to do this.

- k


Happy Gecko Support

Cosmin Mihai
 

Hi,

I'm new to Zephyr. Is it possible to use it for EFM32 Happy Gecko? (https://www.silabs.com/products/mcu/32-bit/efm32-happy-gecko)

I see that it only supports Wonder Gecko.

Thank you!


Re: [Zephyr-devel] Buggy PWM driver for nRF52

Chettimada, Vinayak Kariappa
 

Hi Vikrant and Neves,

 

I have submitted a PR that will correctly “disable” Coded PHY support in nRF52840, in turn avoiding the PPI channels 14 to 19 and hence usable by pwm_nrf5_sw.c implementation.

 

Use the following:

CONFIG_BT_CTLR_ADVANCED_FEATURES=y

CONFIG_BT_CTLR_PHY_CODED=n

 

Appreciate if one of you can test this and confirm that on an nRF52840 with BT connections 3 PWM channels using pwm_nrf5_sw has no issues.

 

Feel free to leave your comments here: https://github.com/zephyrproject-rtos/zephyr/pull/6055

 

Regards,

Vinayak

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 12:57 PM
To: Felipe Neves <ryukokki.felipe@...>
Cc: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>; zephyr-users@...; zephyr-devel@...
Subject: Re: [Zephyr-users] [Zephyr-devel] Buggy PWM driver for nRF52

 

Hi Felipe,

Thanks for you support.

I also used this style to take advantage of SoC built-in PWM module.

But was not able to generate PWM with different pulse_width using same instance.

Now it is possible.

We have to enable

NRF_PWM0->ENABLE = 1;
at last to achieve that.

Thanks once again !!

 


 

 

On Thu, Feb 8, 2018 at 4:47 PM, Felipe Neves <ryukokki.felipe@...> wrote:

Hello guys.

@Vikrant you are right, the current implementation of nrf pwm's driver uses a software based PWM combined with the PPI.

Here in my work we are using zephyr built for nordic target with pwm, we don't implemented the driver on zepyr's model because we haven't time to validate and integrate it.

But here is a working code to setup the PWM at 1KHz clocked by 8MHz and a set duty function, I'm planning to move this to a PR later but if anyone wants to submit it, please feel free,

take a look:

/* pwm output pin */
#define PWM_OUT_PIN         (0 | 31)

 

/* pwm frequency and clk in Hz */
#define PWM_FREQUENCY                      1000
#define PWM_CLK                                    8000000
#define PWM_TOP_VALUE_FIX          (PWM_CLK / PWM_FREQUENCY)
#define PWM_MAX_DUTY               0.30f /* 30 % */
#define PWM_MIN_DUTY               0.05   /* 5% */
#define PWM_PERCENT_RESOLUTION     0.0125 /* % */

 

/* polarity to be added on pwm sequencer */
#define PWM_POLARITY_OFFSET        (1 << 15)

/** private variables */
static uint16_t nrf_pwm_sequence[4] = {4096 + PWM_POLARITY_OFFSET , 0 + PWM_POLARITY_OFFSET, 0 + PWM_POLARITY_OFFSET, 0 + PWM_POLARITY_OFFSET};

 

/**
 * temp_pwm_init()
 *
 * @brief inits the pwm controller and route it to the heater
 * @param
 * @return
 */
static void temp_pwm_init(void)
{
     NRF_PWM0->PSEL.OUT[0] = PWM_OUT_PIN;
 
     /* pwm in upmode */
     NRF_PWM0->MODE = 0;
 
     /* sets pwm count top to be at 1 KHz  and decode pwm in common mode*/
     NRF_PWM0->COUNTERTOP = PWM_CLK / PWM_FREQUENCY;
     NRF_PWM0->DECODER =  0x00000002;
     NRF_PWM0->LOOP = 0;
     NRF_PWM0->SEQ[0].REFRESH = 0;
     NRF_PWM0->SEQ[0].ENDDELAY = 0;
 
     /* select clock source prescaler */
     NRF_PWM0->PRESCALER = 0x00000001;
 
     /* enables the PWM */
     NRF_PWM0->SEQ[0].PTR  = ((uint32_t)nrf_pwm_sequence);
     NRF_PWM0->SEQ[0].CNT  = sizeof(nrf_pwm_sequence) / sizeof(uint16_t);
     NRF_PWM0->ENABLE = 1;
 
     /* trigger it! */
     NRF_PWM0->TASKS_SEQSTART[0] = 1;
}
 
/**
 * temp_pwm_set_val()
 *
 * @brief set the pwm with a new duty cicle
 * @param
 * @return
 */
static void temp_pwm_set_val(float required_energy)
{
 
#ifndef TEMP_CLOSED_LOOP
     /* saturate the energy expected */
     if(required_energy < TEMP_MAINTENANCE_ENERGY)
             required_energy = TEMP_MAINTENANCE_ENERGY;
 
     if(required_energy > TEMP_MAXIMUM_ENERGY_AVAILABLE)
             required_energy = TEMP_MAXIMUM_ENERGY_AVAILABLE;
 
#else
     /* saturate the energy required to the bound values, note in closed loop
      * we can increase the pwm output to the maximum during a cycle
      */
     if(required_energy < TEMP_MAINTENANCE_ENERGY)
             required_energy = TEMP_MAINTENANCE_ENERGY;
 
     if(required_energy > TEMP_MAXIMUM_ENERGY_EXCURTION)
             required_energy = TEMP_MAXIMUM_ENERGY_EXCURTION;
 
#endif
 
     /* obtains the duty cicle  and sums it up with polarity offset */
     uint16_t duty = (uint16_t)((required_energy / TEMP_MAXIMUM_ENERGY_EXCURTION) * (float)PWM_TOP_VALUE_FIX);
     duty |= PWM_POLARITY_OFFSET;
 
 
     /* update the duty cicle */
     nrf_pwm_sequence[0] = duty;
     nrf_pwm_sequence[1] = duty;
     nrf_pwm_sequence[2] = duty;
     nrf_pwm_sequence[3] = duty;
 
     NRF_PWM0->TASKS_SEQSTART[0] = 1;
}

 

The nrf_pwm_sequence variable is a kind of PWM descriptor which holds the value of duty cycle concatenated with the polarity bit,

the 4096 value means near 50% of duty cicle on channel 0, please note each pwm instance can be mapped to any pin of

nordic chip and each instance has up to 4 channels.

Please let me know if this was helpful.

best

Felipe

 

 

2018-02-08 7:50 GMT-02:00 Vikrant More <vikrant8051@...>:

I'm not able to understand what you are saying.

Is that means Zephyr PWM (fade_led example) is using software to generate PWM instead of separate dedicated

SoC's internal PWM module ?

 

On Thu, Feb 8, 2018 at 3:01 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Your main.c uses pwm_nrf5_sw.c driver which has conflict with BT features on nRF52840...

I do not see use of NRF_PWM0 in you main.c, of course, yes your code in the devzone does, hope you get some help there and can contribute a Zephyr driver.

I am not familiar with NRF_PWM0, hence not much help for you.

We are in the process of contributing driver based on nRFx external interfaces, you may just have to wait for it.

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 10:21 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>
Cc: zephyr-devel@...; zephyr-users@...


Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

>> Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

Means ??

I am using h/w PWM only !! Have you looked my main.c ?

Instead I used direct register access method to set PWM on

P0.13(LED_1) & P0.14(LED2)

Here too, I failed to create two PWM with different pulse_width using single instance i.e. PWM0

So I used PWM1 for LED2.

Nordic Datasheet is also not clear about it.

So I open new ticket on Nordic #devzone forum,

https://devzone.nordicsemi.com/f/nordic-q-a/30328/nrf52840-create-2-pwms-with-different-pulse-width-using-single-instance-by-direct-register-access

 

On Thu, Feb 8, 2018 at 2:32 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

As i said, there is possible overlap of PPIs with BT Controller. PPI channel 16 and 17 overlap with Code PHY feature in nRF52840.

 

I will try to send a PR wherein you could (correctly) disable Coded PHY support in nRF52840 so as to have PPI Channels from 14 to 19 available for 3 LEDs.

 

Until then, use 3 LEDs and expect 2nd LED to malfunction.

 

Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

 

Regards,

Vinayak

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 9:31 AM


To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I also able to generate & vary PWM as you did.

Problem arises when we create two channels from PWM0.

One channel -> LED1

Second Channel -> LED2

When I vary LED1 pulse width, sometimes it affects intensity of LED2

Similarly, when I vary LED2 pulse width it affects intensity of LED1

For details I've attached my main.c. Please have a look.

Use nRF connect to send data

send 0100 (ascii string) -> it is for LED1

send 1100 (ascii string) -> it is for LED2

And you will find what I'm saying.

 

 

On Thu, Feb 8, 2018 at 1:37 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

I have run the upstream fade_led sample on nrf52840-PDK, I see no regression, the brightness changes every second (up and then down so on).

I advice you to debug your implementation as I have no visibility to your design.

 

Regards,

Vinayak

 

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 8:55 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>

Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I'm working nRF52840-PDK board.

 

On Thu, Feb 8, 2018 at 1:21 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

Please try the PWM without the BT Controller included. There could be some PWM regression due to changes in controller implementation.

That said the nrf5_sw  driver is software variant designed for older nRF51 SoCs. For newer nRF52x series h/w PWM’s should be used.

 

Nrf5_sw will work provided careful mitigation of used PPI and timers between the driver and BT controller use.

 

Which SoC are you using?

 

Regards,

Vinayak

 

From: zephyr-devel-bounces@... [mailto:zephyr-devel-bounces@...] On Behalf Of Vikrant More
Sent: Thursday, February 08, 2018 5:04 AM
To: Marti Bolivar <marti@...>
Cc: zephyr-users@...; zephyr-devel@...; Felipe Neves <ryukokki.felipe@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Marti,

>>Are you using the latest master?

Yes

 

On Thu, Feb 8, 2018 at 1:23 AM, Marti Bolivar <marti@...> wrote:

Hi Vikrant,

 

Are you using the latest master?

 

Three improvements to nRF PWM went in fairly recently:

 

3f1dbfda1 pwm: nrf5_sw: don't disable timer if another channel is still active

ab399a1cf pwm: nrf5_sw: do not use 'inversed' polarity by default

cec073c35 pwm: nrf5_sw: add support for SYS_LOG

 

Thanks,

Marti

 

On Wed, Feb 7, 2018 at 1:59 PM, Vikrant More <vikrant8051@...> wrote:

I took reference of $zephy/samples/samples/fade_led project

 

& add following parameters in my prj.conf

 

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4
 
Could you please inform me, what I should do besides this ??
 
Thank You !!

 

On Feb 7, 2018 11:36 PM, "Felipe Neves" <ryukokki.felipe@...> wrote:

Hi Vikrant,

Did you configure what pins are associated to pwm duty_cycles on the menuconfig?

Best

Felipe

 

 

2018-02-07 10:15 GMT-02:00 Vikrant More <vikrant8051@...>:

Hello World !!

I've added following lines in my project main ()

    pwm_dev = device_get_binding(PWM_DRIVER);

    if (!pwm_dev)
    {
        printk("Cannot find %s!\n", PWM_DRIVER);
        return;
    }

   
    while(1)
    {
   
        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0, PERIOD, pulse_width0))
        {
            printk("pwm pin set fails\n");
        }

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1, PERIOD, pulse_width1))
        {
            printk("pwm pin set fails\n");
        }

        k_sleep(100);
    }

And using bluetooth updating value of pulse_width0 & pulse_width1. Those two are defined as global variables.

pulse_width0 --> LED_1 on nrf52840_PDK
pulse_width1 --> LED_2 on nrf52840_PDK

I'm able to update value of both these variables using Bluetooth.

I used printk to check it. My logic is perfect.

But if I vary pulse_width0 then it affects intensity of LED2
& if I vary pulse_width1 then it affects intensity of LED1.

Why ? Is anyone found this BUG ?


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--

Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

 

 

 

 

 

 


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--

Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989

+55 11 96610 – 0855 

 


Re: [Zephyr-devel] Buggy PWM driver for nRF52

Vikrant More <vikrant8051@...>
 

Hi Felipe,

Thanks for you support.
I also used this style to take advantage of SoC built-in PWM module.

But was not able to generate PWM with different pulse_width using same instance.
Now it is possible.

We have to enable
NRF_PWM0->ENABLE = 1;

at last to achieve that.


Thanks once again !!


 

On Thu, Feb 8, 2018 at 4:47 PM, Felipe Neves <ryukokki.felipe@...> wrote:
Hello guys.

@Vikrant you are right, the current implementation of nrf pwm's driver uses a software based PWM combined with the PPI.

Here in my work we are using zephyr built for nordic target with pwm, we don't implemented the driver on zepyr's model because we haven't time to validate and integrate it.

But here is a working code to setup the PWM at 1KHz clocked by 8MHz and a set duty function, I'm planning to move this to a PR later but if anyone wants to submit it, please feel free,

take a look:


/* pwm output pin */
#define PWM_OUT_PIN		(0 | 31)

/* pwm frequency and clk in Hz */
#define PWM_FREQUENCY			1000
#define PWM_CLK					8000000
#define PWM_TOP_VALUE_FIX		(PWM_CLK / PWM_FREQUENCY)
#define PWM_MAX_DUTY			0.30f /* 30 % */
#define PWM_MIN_DUTY			0.05   /* 5% */
#define PWM_PERCENT_RESOLUTION	0.0125 /* % */

/* polarity to be added on pwm sequencer */
#define PWM_POLARITY_OFFSET		(1 << 15)

/** private variables */
static uint16_t nrf_pwm_sequence[4] = {4096 + PWM_POLARITY_OFFSET , 0 + PWM_POLARITY_OFFSET, 0 + PWM_POLARITY_OFFSET, 0 + PWM_POLARITY_OFFSET};

/**
 * temp_pwm_init()
 *
 * @brief inits the pwm controller and route it to the heater
 * @param
 * @return
 */
static void temp_pwm_init(void)
{
	NRF_PWM0->PSEL.OUT[0] = PWM_OUT_PIN;

	/* pwm in upmode */
	NRF_PWM0->MODE = 0;

	/* sets pwm count top to be at 1 KHz  and decode pwm in common mode*/
	NRF_PWM0->COUNTERTOP = PWM_CLK / PWM_FREQUENCY;
	NRF_PWM0->DECODER =  0x00000002;
	NRF_PWM0->LOOP = 0;
	NRF_PWM0->SEQ[0].REFRESH = 0;
	NRF_PWM0->SEQ[0].ENDDELAY = 0;

	/* select clock source prescaler */
	NRF_PWM0->PRESCALER = 0x00000001;

	/* enables the PWM */
	NRF_PWM0->SEQ[0].PTR  = ((uint32_t)nrf_pwm_sequence);
	NRF_PWM0->SEQ[0].CNT  = sizeof(nrf_pwm_sequence) / sizeof(uint16_t);
	NRF_PWM0->ENABLE = 1;

	/* trigger it! */
	NRF_PWM0->TASKS_SEQSTART[0] = 1;
}

/**
 * temp_pwm_set_val()
 *
 * @brief set the pwm with a new duty cicle
 * @param
 * @return
 */
static void temp_pwm_set_val(float required_energy)
{

#ifndef TEMP_CLOSED_LOOP
	/* saturate the energy expected */
	if(required_energy < TEMP_MAINTENANCE_ENERGY)
		required_energy = TEMP_MAINTENANCE_ENERGY;

	if(required_energy > TEMP_MAXIMUM_ENERGY_AVAILABLE)
		required_energy = TEMP_MAXIMUM_ENERGY_AVAILABLE;

#else
	/* saturate the energy required to the bound values, note in closed loop
	 * we can increase the pwm output to the maximum during a cycle
	 */
	if(required_energy < TEMP_MAINTENANCE_ENERGY)
		required_energy = TEMP_MAINTENANCE_ENERGY;

	if(required_energy > TEMP_MAXIMUM_ENERGY_EXCURTION)
		required_energy = TEMP_MAXIMUM_ENERGY_EXCURTION;

#endif

	/* obtains the duty cicle  and sums it up with polarity offset */
	uint16_t duty = (uint16_t)((required_energy / TEMP_MAXIMUM_ENERGY_EXCURTION) * (float)PWM_TOP_VALUE_FIX);
	duty |= PWM_POLARITY_OFFSET;


	/* update the duty cicle */
	nrf_pwm_sequence[0] = duty;
	nrf_pwm_sequence[1] = duty;
	nrf_pwm_sequence[2] = duty;
	nrf_pwm_sequence[3] = duty;

	NRF_PWM0->TASKS_SEQSTART[0] = 1;
}


The nrf_pwm_sequence variable is a kind of PWM descriptor which holds the value of duty cycle concatenated with the polarity bit,
the 4096 value means near 50% of duty cicle on channel 0, please note each pwm instance can be mapped to any pin of
nordic chip and each instance has up to 4 channels.

Please let me know if this was helpful.

best

Felipe


2018-02-08 7:50 GMT-02:00 Vikrant More <vikrant8051@...>:
I'm not able to understand what you are saying.

Is that means Zephyr PWM (fade_led example) is using software to generate PWM instead of separate dedicated
SoC's internal PWM module ?

On Thu, Feb 8, 2018 at 3:01 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Your main.c uses pwm_nrf5_sw.c driver which has conflict with BT features on nRF52840...

I do not see use of NRF_PWM0 in you main.c, of course, yes your code in the devzone does, hope you get some help there and can contribute a Zephyr driver.

I am not familiar with NRF_PWM0, hence not much help for you.

We are in the process of contributing driver based on nRFx external interfaces, you may just have to wait for it.

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 10:21 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>
Cc: zephyr-devel@...ct.org; zephyr-users@...ct.org


Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

>> Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

Means ??

I am using h/w PWM only !! Have you looked my main.c ?

Instead I used direct register access method to set PWM on

P0.13(LED_1) & P0.14(LED2)

Here too, I failed to create two PWM with different pulse_width using single instance i.e. PWM0

So I used PWM1 for LED2.

Nordic Datasheet is also not clear about it.

So I open new ticket on Nordic #devzone forum,

https://devzone.nordicsemi.com/f/nordic-q-a/30328/nrf52840-create-2-pwms-with-different-pulse-width-using-single-instance-by-direct-register-access

 

On Thu, Feb 8, 2018 at 2:32 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

As i said, there is possible overlap of PPIs with BT Controller. PPI channel 16 and 17 overlap with Code PHY feature in nRF52840.

 

I will try to send a PR wherein you could (correctly) disable Coded PHY support in nRF52840 so as to have PPI Channels from 14 to 19 available for 3 LEDs.

 

Until then, use 3 LEDs and expect 2nd LED to malfunction.

 

Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

 

Regards,

Vinayak

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 9:31 AM


To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I also able to generate & vary PWM as you did.

Problem arises when we create two channels from PWM0.

One channel -> LED1

Second Channel -> LED2

When I vary LED1 pulse width, sometimes it affects intensity of LED2

Similarly, when I vary LED2 pulse width it affects intensity of LED1

For details I've attached my main.c. Please have a look.

Use nRF connect to send data

send 0100 (ascii string) -> it is for LED1

send 1100 (ascii string) -> it is for LED2

And you will find what I'm saying.

 

 

On Thu, Feb 8, 2018 at 1:37 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

I have run the upstream fade_led sample on nrf52840-PDK, I see no regression, the brightness changes every second (up and then down so on).

I advice you to debug your implementation as I have no visibility to your design.

 

Regards,

Vinayak

 

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 8:55 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>

Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I'm working nRF52840-PDK board.

 

On Thu, Feb 8, 2018 at 1:21 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

Please try the PWM without the BT Controller included. There could be some PWM regression due to changes in controller implementation.

That said the nrf5_sw  driver is software variant designed for older nRF51 SoCs. For newer nRF52x series h/w PWM’s should be used.

 

Nrf5_sw will work provided careful mitigation of used PPI and timers between the driver and BT controller use.

 

Which SoC are you using?

 

Regards,

Vinayak

 

From: zephyr-devel-bounces@...hyrproject.org [mailto:zephyr-devel-bounces@lists.zephyrproject.org] On Behalf Of Vikrant More
Sent: Thursday, February 08, 2018 5:04 AM
To: Marti Bolivar <marti@...>
Cc: zephyr-users@...ct.org; zephyr-devel@...ct.org; Felipe Neves <ryukokki.felipe@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Marti,

>>Are you using the latest master?

Yes

 

On Thu, Feb 8, 2018 at 1:23 AM, Marti Bolivar <marti@...> wrote:

Hi Vikrant,

 

Are you using the latest master?

 

Three improvements to nRF PWM went in fairly recently:

 

3f1dbfda1 pwm: nrf5_sw: don't disable timer if another channel is still active

ab399a1cf pwm: nrf5_sw: do not use 'inversed' polarity by default

cec073c35 pwm: nrf5_sw: add support for SYS_LOG

 

Thanks,

Marti

 

On Wed, Feb 7, 2018 at 1:59 PM, Vikrant More <vikrant8051@...> wrote:

I took reference of $zephy/samples/samples/fade_led project

 

& add following parameters in my prj.conf

 

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4
 
Could you please inform me, what I should do besides this ??
 
Thank You !!

 

On Feb 7, 2018 11:36 PM, "Felipe Neves" <ryukokki.felipe@...> wrote:

Hi Vikrant,

Did you configure what pins are associated to pwm duty_cycles on the menuconfig?

Best

Felipe

 

 

2018-02-07 10:15 GMT-02:00 Vikrant More <vikrant8051@...>:

Hello World !!

I've added following lines in my project main ()

    pwm_dev = device_get_binding(PWM_DRIVER);

    if (!pwm_dev)
    {
        printk("Cannot find %s!\n", PWM_DRIVER);
        return;
    }

   
    while(1)
    {
   
        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0, PERIOD, pulse_width0))
        {
            printk("pwm pin set fails\n");
        }

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1, PERIOD, pulse_width1))
        {
            printk("pwm pin set fails\n");
        }

        k_sleep(100);
    }

And using bluetooth updating value of pulse_width0 & pulse_width1. Those two are defined as global variables.

pulse_width0 --> LED_1 on nrf52840_PDK
pulse_width1 --> LED_2 on nrf52840_PDK

I'm able to update value of both these variables using Bluetooth.

I used printk to check it. My logic is perfect.

But if I vary pulse_width0 then it affects intensity of LED2
& if I vary pulse_width1 then it affects intensity of LED1.

Why ? Is anyone found this BUG ?


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--

Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

 

 

 

 

 



_______________________________________________
Zephyr-users mailing list
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--
Felipe S. Neves 
Embedded software & systems engineer
Skype: fneves1989
+55 11 96610 – 0855 


Re: [Zephyr-devel] Buggy PWM driver for nRF52

Felipe Neves
 

Hello guys.

@Vikrant you are right, the current implementation of nrf pwm's driver uses a software based PWM combined with the PPI.

Here in my work we are using zephyr built for nordic target with pwm, we don't implemented the driver on zepyr's model because we haven't time to validate and integrate it.

But here is a working code to setup the PWM at 1KHz clocked by 8MHz and a set duty function, I'm planning to move this to a PR later but if anyone wants to submit it, please feel free,

take a look:


/* pwm output pin */
#define PWM_OUT_PIN		(0 | 31)

/* pwm frequency and clk in Hz */
#define PWM_FREQUENCY			1000
#define PWM_CLK					8000000
#define PWM_TOP_VALUE_FIX		(PWM_CLK / PWM_FREQUENCY)
#define PWM_MAX_DUTY			0.30f /* 30 % */
#define PWM_MIN_DUTY			0.05   /* 5% */
#define PWM_PERCENT_RESOLUTION	0.0125 /* % */

/* polarity to be added on pwm sequencer */
#define PWM_POLARITY_OFFSET		(1 << 15)

/** private variables */
static uint16_t nrf_pwm_sequence[4] = {4096 + PWM_POLARITY_OFFSET , 0 + PWM_POLARITY_OFFSET, 0 + PWM_POLARITY_OFFSET, 0 + PWM_POLARITY_OFFSET};

/**
 * temp_pwm_init()
 *
 * @brief inits the pwm controller and route it to the heater
 * @param
 * @return
 */
static void temp_pwm_init(void)
{
	NRF_PWM0->PSEL.OUT[0] = PWM_OUT_PIN;

	/* pwm in upmode */
	NRF_PWM0->MODE = 0;

	/* sets pwm count top to be at 1 KHz  and decode pwm in common mode*/
	NRF_PWM0->COUNTERTOP = PWM_CLK / PWM_FREQUENCY;
	NRF_PWM0->DECODER =  0x00000002;
	NRF_PWM0->LOOP = 0;
	NRF_PWM0->SEQ[0].REFRESH = 0;
	NRF_PWM0->SEQ[0].ENDDELAY = 0;

	/* select clock source prescaler */
	NRF_PWM0->PRESCALER = 0x00000001;

	/* enables the PWM */
	NRF_PWM0->SEQ[0].PTR  = ((uint32_t)nrf_pwm_sequence);
	NRF_PWM0->SEQ[0].CNT  = sizeof(nrf_pwm_sequence) / sizeof(uint16_t);
	NRF_PWM0->ENABLE = 1;

	/* trigger it! */
	NRF_PWM0->TASKS_SEQSTART[0] = 1;
}

/**
 * temp_pwm_set_val()
 *
 * @brief set the pwm with a new duty cicle
 * @param
 * @return
 */
static void temp_pwm_set_val(float required_energy)
{

#ifndef TEMP_CLOSED_LOOP
	/* saturate the energy expected */
	if(required_energy < TEMP_MAINTENANCE_ENERGY)
		required_energy = TEMP_MAINTENANCE_ENERGY;

	if(required_energy > TEMP_MAXIMUM_ENERGY_AVAILABLE)
		required_energy = TEMP_MAXIMUM_ENERGY_AVAILABLE;

#else
	/* saturate the energy required to the bound values, note in closed loop
	 * we can increase the pwm output to the maximum during a cycle
	 */
	if(required_energy < TEMP_MAINTENANCE_ENERGY)
		required_energy = TEMP_MAINTENANCE_ENERGY;

	if(required_energy > TEMP_MAXIMUM_ENERGY_EXCURTION)
		required_energy = TEMP_MAXIMUM_ENERGY_EXCURTION;

#endif

	/* obtains the duty cicle  and sums it up with polarity offset */
	uint16_t duty = (uint16_t)((required_energy / TEMP_MAXIMUM_ENERGY_EXCURTION) * (float)PWM_TOP_VALUE_FIX);
	duty |= PWM_POLARITY_OFFSET;


	/* update the duty cicle */
	nrf_pwm_sequence[0] = duty;
	nrf_pwm_sequence[1] = duty;
	nrf_pwm_sequence[2] = duty;
	nrf_pwm_sequence[3] = duty;

	NRF_PWM0->TASKS_SEQSTART[0] = 1;
}


The nrf_pwm_sequence variable is a kind of PWM descriptor which holds the value of duty cycle concatenated with the polarity bit,
the 4096 value means near 50% of duty cicle on channel 0, please note each pwm instance can be mapped to any pin of
nordic chip and each instance has up to 4 channels.

Please let me know if this was helpful.

best

Felipe


2018-02-08 7:50 GMT-02:00 Vikrant More <vikrant8051@...>:

I'm not able to understand what you are saying.

Is that means Zephyr PWM (fade_led example) is using software to generate PWM instead of separate dedicated
SoC's internal PWM module ?

On Thu, Feb 8, 2018 at 3:01 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Your main.c uses pwm_nrf5_sw.c driver which has conflict with BT features on nRF52840...

I do not see use of NRF_PWM0 in you main.c, of course, yes your code in the devzone does, hope you get some help there and can contribute a Zephyr driver.

I am not familiar with NRF_PWM0, hence not much help for you.

We are in the process of contributing driver based on nRFx external interfaces, you may just have to wait for it.

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 10:21 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>
Cc: zephyr-devel@...ct.org; zephyr-users@...ct.org


Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

>> Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

Means ??

I am using h/w PWM only !! Have you looked my main.c ?

Instead I used direct register access method to set PWM on

P0.13(LED_1) & P0.14(LED2)

Here too, I failed to create two PWM with different pulse_width using single instance i.e. PWM0

So I used PWM1 for LED2.

Nordic Datasheet is also not clear about it.

So I open new ticket on Nordic #devzone forum,

https://devzone.nordicsemi.com/f/nordic-q-a/30328/nrf52840-create-2-pwms-with-different-pulse-width-using-single-instance-by-direct-register-access

 

On Thu, Feb 8, 2018 at 2:32 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

As i said, there is possible overlap of PPIs with BT Controller. PPI channel 16 and 17 overlap with Code PHY feature in nRF52840.

 

I will try to send a PR wherein you could (correctly) disable Coded PHY support in nRF52840 so as to have PPI Channels from 14 to 19 available for 3 LEDs.

 

Until then, use 3 LEDs and expect 2nd LED to malfunction.

 

Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

 

Regards,

Vinayak

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 9:31 AM


To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I also able to generate & vary PWM as you did.

Problem arises when we create two channels from PWM0.

One channel -> LED1

Second Channel -> LED2

When I vary LED1 pulse width, sometimes it affects intensity of LED2

Similarly, when I vary LED2 pulse width it affects intensity of LED1

For details I've attached my main.c. Please have a look.

Use nRF connect to send data

send 0100 (ascii string) -> it is for LED1

send 1100 (ascii string) -> it is for LED2

And you will find what I'm saying.

 

 

On Thu, Feb 8, 2018 at 1:37 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

I have run the upstream fade_led sample on nrf52840-PDK, I see no regression, the brightness changes every second (up and then down so on).

I advice you to debug your implementation as I have no visibility to your design.

 

Regards,

Vinayak

 

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 8:55 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>

Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I'm working nRF52840-PDK board.

 

On Thu, Feb 8, 2018 at 1:21 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

Please try the PWM without the BT Controller included. There could be some PWM regression due to changes in controller implementation.

That said the nrf5_sw  driver is software variant designed for older nRF51 SoCs. For newer nRF52x series h/w PWM’s should be used.

 

Nrf5_sw will work provided careful mitigation of used PPI and timers between the driver and BT controller use.

 

Which SoC are you using?

 

Regards,

Vinayak

 

From: zephyr-devel-bounces@...hyrproject.org [mailto:zephyr-devel-bounces@lists.zephyrproject.org] On Behalf Of Vikrant More
Sent: Thursday, February 08, 2018 5:04 AM
To: Marti Bolivar <marti@...>
Cc: zephyr-users@...ct.org; zephyr-devel@...ct.org; Felipe Neves <ryukokki.felipe@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Marti,

>>Are you using the latest master?

Yes

 

On Thu, Feb 8, 2018 at 1:23 AM, Marti Bolivar <marti@...> wrote:

Hi Vikrant,

 

Are you using the latest master?

 

Three improvements to nRF PWM went in fairly recently:

 

3f1dbfda1 pwm: nrf5_sw: don't disable timer if another channel is still active

ab399a1cf pwm: nrf5_sw: do not use 'inversed' polarity by default

cec073c35 pwm: nrf5_sw: add support for SYS_LOG

 

Thanks,

Marti

 

On Wed, Feb 7, 2018 at 1:59 PM, Vikrant More <vikrant8051@...> wrote:

I took reference of $zephy/samples/samples/fade_led project

 

& add following parameters in my prj.conf

 

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4
 
Could you please inform me, what I should do besides this ??
 
Thank You !!

 

On Feb 7, 2018 11:36 PM, "Felipe Neves" <ryukokki.felipe@...> wrote:

Hi Vikrant,

Did you configure what pins are associated to pwm duty_cycles on the menuconfig?

Best

Felipe

 

 

2018-02-07 10:15 GMT-02:00 Vikrant More <vikrant8051@...>:

Hello World !!

I've added following lines in my project main ()

    pwm_dev = device_get_binding(PWM_DRIVER);

    if (!pwm_dev)
    {
        printk("Cannot find %s!\n", PWM_DRIVER);
        return;
    }

   
    while(1)
    {
   
        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0, PERIOD, pulse_width0))
        {
            printk("pwm pin set fails\n");
        }

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1, PERIOD, pulse_width1))
        {
            printk("pwm pin set fails\n");
        }

        k_sleep(100);
    }

And using bluetooth updating value of pulse_width0 & pulse_width1. Those two are defined as global variables.

pulse_width0 --> LED_1 on nrf52840_PDK
pulse_width1 --> LED_2 on nrf52840_PDK

I'm able to update value of both these variables using Bluetooth.

I used printk to check it. My logic is perfect.

But if I vary pulse_width0 then it affects intensity of LED2
& if I vary pulse_width1 then it affects intensity of LED1.

Why ? Is anyone found this BUG ?


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--

Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

 

 

 

 

 



_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--
Felipe S. Neves 
Embedded software & systems engineer
Skype: fneves1989
+55 11 96610 – 0855 


Re: [Zephyr-devel] Buggy PWM driver for nRF52

Vikrant More <vikrant8051@...>
 

I'm not able to understand what you are saying.

Is that means Zephyr PWM (fade_led example) is using software to generate PWM instead of separate dedicated
SoC's internal PWM module ?

On Thu, Feb 8, 2018 at 3:01 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Your main.c uses pwm_nrf5_sw.c driver which has conflict with BT features on nRF52840...

I do not see use of NRF_PWM0 in you main.c, of course, yes your code in the devzone does, hope you get some help there and can contribute a Zephyr driver.

I am not familiar with NRF_PWM0, hence not much help for you.

We are in the process of contributing driver based on nRFx external interfaces, you may just have to wait for it.

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 10:21 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>
Cc: zephyr-devel@lists.zephyrproject.org; zephyr-users@lists.zephyrproject.org


Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

>> Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

Means ??

I am using h/w PWM only !! Have you looked my main.c ?

Instead I used direct register access method to set PWM on

P0.13(LED_1) & P0.14(LED2)

Here too, I failed to create two PWM with different pulse_width using single instance i.e. PWM0

So I used PWM1 for LED2.

Nordic Datasheet is also not clear about it.

So I open new ticket on Nordic #devzone forum,

https://devzone.nordicsemi.com/f/nordic-q-a/30328/nrf52840-create-2-pwms-with-different-pulse-width-using-single-instance-by-direct-register-access

 

On Thu, Feb 8, 2018 at 2:32 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

As i said, there is possible overlap of PPIs with BT Controller. PPI channel 16 and 17 overlap with Code PHY feature in nRF52840.

 

I will try to send a PR wherein you could (correctly) disable Coded PHY support in nRF52840 so as to have PPI Channels from 14 to 19 available for 3 LEDs.

 

Until then, use 3 LEDs and expect 2nd LED to malfunction.

 

Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

 

Regards,

Vinayak

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 9:31 AM


To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I also able to generate & vary PWM as you did.

Problem arises when we create two channels from PWM0.

One channel -> LED1

Second Channel -> LED2

When I vary LED1 pulse width, sometimes it affects intensity of LED2

Similarly, when I vary LED2 pulse width it affects intensity of LED1

For details I've attached my main.c. Please have a look.

Use nRF connect to send data

send 0100 (ascii string) -> it is for LED1

send 1100 (ascii string) -> it is for LED2

And you will find what I'm saying.

 

 

On Thu, Feb 8, 2018 at 1:37 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

I have run the upstream fade_led sample on nrf52840-PDK, I see no regression, the brightness changes every second (up and then down so on).

I advice you to debug your implementation as I have no visibility to your design.

 

Regards,

Vinayak

 

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 8:55 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>

Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I'm working nRF52840-PDK board.

 

On Thu, Feb 8, 2018 at 1:21 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

Please try the PWM without the BT Controller included. There could be some PWM regression due to changes in controller implementation.

That said the nrf5_sw  driver is software variant designed for older nRF51 SoCs. For newer nRF52x series h/w PWM’s should be used.

 

Nrf5_sw will work provided careful mitigation of used PPI and timers between the driver and BT controller use.

 

Which SoC are you using?

 

Regards,

Vinayak

 

From: zephyr-devel-bounces@lists.zephyrproject.org [mailto:zephyr-devel-bounces@lists.zephyrproject.org] On Behalf Of Vikrant More
Sent: Thursday, February 08, 2018 5:04 AM
To: Marti Bolivar <marti@...>
Cc: zephyr-users@lists.zephyrproject.org; zephyr-devel@lists.zephyrproject.org; Felipe Neves <ryukokki.felipe@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Marti,

>>Are you using the latest master?

Yes

 

On Thu, Feb 8, 2018 at 1:23 AM, Marti Bolivar <marti@...> wrote:

Hi Vikrant,

 

Are you using the latest master?

 

Three improvements to nRF PWM went in fairly recently:

 

3f1dbfda1 pwm: nrf5_sw: don't disable timer if another channel is still active

ab399a1cf pwm: nrf5_sw: do not use 'inversed' polarity by default

cec073c35 pwm: nrf5_sw: add support for SYS_LOG

 

Thanks,

Marti

 

On Wed, Feb 7, 2018 at 1:59 PM, Vikrant More <vikrant8051@...> wrote:

I took reference of $zephy/samples/samples/fade_led project

 

& add following parameters in my prj.conf

 

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4
 
Could you please inform me, what I should do besides this ??
 
Thank You !!

 

On Feb 7, 2018 11:36 PM, "Felipe Neves" <ryukokki.felipe@...> wrote:

Hi Vikrant,

Did you configure what pins are associated to pwm duty_cycles on the menuconfig?

Best

Felipe

 

 

2018-02-07 10:15 GMT-02:00 Vikrant More <vikrant8051@...>:

Hello World !!

I've added following lines in my project main ()

    pwm_dev = device_get_binding(PWM_DRIVER);

    if (!pwm_dev)
    {
        printk("Cannot find %s!\n", PWM_DRIVER);
        return;
    }

   
    while(1)
    {
   
        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0, PERIOD, pulse_width0))
        {
            printk("pwm pin set fails\n");
        }

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1, PERIOD, pulse_width1))
        {
            printk("pwm pin set fails\n");
        }

        k_sleep(100);
    }

And using bluetooth updating value of pulse_width0 & pulse_width1. Those two are defined as global variables.

pulse_width0 --> LED_1 on nrf52840_PDK
pulse_width1 --> LED_2 on nrf52840_PDK

I'm able to update value of both these variables using Bluetooth.

I used printk to check it. My logic is perfect.

But if I vary pulse_width0 then it affects intensity of LED2
& if I vary pulse_width1 then it affects intensity of LED1.

Why ? Is anyone found this BUG ?


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--

Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

 

 

 

 

 



Re: [Zephyr-devel] Buggy PWM driver for nRF52

Chettimada, Vinayak Kariappa
 

Your main.c uses pwm_nrf5_sw.c driver which has conflict with BT features on nRF52840...

I do not see use of NRF_PWM0 in you main.c, of course, yes your code in the devzone does, hope you get some help there and can contribute a Zephyr driver.

I am not familiar with NRF_PWM0, hence not much help for you.

We are in the process of contributing driver based on nRFx external interfaces, you may just have to wait for it.

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 10:21 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>
Cc: zephyr-devel@...; zephyr-users@...
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

>> Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

Means ??

I am using h/w PWM only !! Have you looked my main.c ?

Instead I used direct register access method to set PWM on

P0.13(LED_1) & P0.14(LED2)

Here too, I failed to create two PWM with different pulse_width using single instance i.e. PWM0

So I used PWM1 for LED2.

Nordic Datasheet is also not clear about it.

So I open new ticket on Nordic #devzone forum,

https://devzone.nordicsemi.com/f/nordic-q-a/30328/nrf52840-create-2-pwms-with-different-pulse-width-using-single-instance-by-direct-register-access

 

On Thu, Feb 8, 2018 at 2:32 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

As i said, there is possible overlap of PPIs with BT Controller. PPI channel 16 and 17 overlap with Code PHY feature in nRF52840.

 

I will try to send a PR wherein you could (correctly) disable Coded PHY support in nRF52840 so as to have PPI Channels from 14 to 19 available for 3 LEDs.

 

Until then, use 3 LEDs and expect 2nd LED to malfunction.

 

Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

 

Regards,

Vinayak

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 9:31 AM


To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I also able to generate & vary PWM as you did.

Problem arises when we create two channels from PWM0.

One channel -> LED1

Second Channel -> LED2

When I vary LED1 pulse width, sometimes it affects intensity of LED2

Similarly, when I vary LED2 pulse width it affects intensity of LED1

For details I've attached my main.c. Please have a look.

Use nRF connect to send data

send 0100 (ascii string) -> it is for LED1

send 1100 (ascii string) -> it is for LED2

And you will find what I'm saying.

 

 

On Thu, Feb 8, 2018 at 1:37 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

I have run the upstream fade_led sample on nrf52840-PDK, I see no regression, the brightness changes every second (up and then down so on).

I advice you to debug your implementation as I have no visibility to your design.

 

Regards,

Vinayak

 

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 8:55 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>

Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I'm working nRF52840-PDK board.

 

On Thu, Feb 8, 2018 at 1:21 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

Please try the PWM without the BT Controller included. There could be some PWM regression due to changes in controller implementation.

That said the nrf5_sw  driver is software variant designed for older nRF51 SoCs. For newer nRF52x series h/w PWM’s should be used.

 

Nrf5_sw will work provided careful mitigation of used PPI and timers between the driver and BT controller use.

 

Which SoC are you using?

 

Regards,

Vinayak

 

From: zephyr-devel-bounces@... [mailto:zephyr-devel-bounces@...] On Behalf Of Vikrant More
Sent: Thursday, February 08, 2018 5:04 AM
To: Marti Bolivar <marti@...>
Cc: zephyr-users@...; zephyr-devel@...; Felipe Neves <ryukokki.felipe@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Marti,

>>Are you using the latest master?

Yes

 

On Thu, Feb 8, 2018 at 1:23 AM, Marti Bolivar <marti@...> wrote:

Hi Vikrant,

 

Are you using the latest master?

 

Three improvements to nRF PWM went in fairly recently:

 

3f1dbfda1 pwm: nrf5_sw: don't disable timer if another channel is still active

ab399a1cf pwm: nrf5_sw: do not use 'inversed' polarity by default

cec073c35 pwm: nrf5_sw: add support for SYS_LOG

 

Thanks,

Marti

 

On Wed, Feb 7, 2018 at 1:59 PM, Vikrant More <vikrant8051@...> wrote:

I took reference of $zephy/samples/samples/fade_led project

 

& add following parameters in my prj.conf

 

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4
 
Could you please inform me, what I should do besides this ??
 
Thank You !!

 

On Feb 7, 2018 11:36 PM, "Felipe Neves" <ryukokki.felipe@...> wrote:

Hi Vikrant,

Did you configure what pins are associated to pwm duty_cycles on the menuconfig?

Best

Felipe

 

 

2018-02-07 10:15 GMT-02:00 Vikrant More <vikrant8051@...>:

Hello World !!

I've added following lines in my project main ()

    pwm_dev = device_get_binding(PWM_DRIVER);

    if (!pwm_dev)
    {
        printk("Cannot find %s!\n", PWM_DRIVER);
        return;
    }

   
    while(1)
    {
   
        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0, PERIOD, pulse_width0))
        {
            printk("pwm pin set fails\n");
        }

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1, PERIOD, pulse_width1))
        {
            printk("pwm pin set fails\n");
        }

        k_sleep(100);
    }

And using bluetooth updating value of pulse_width0 & pulse_width1. Those two are defined as global variables.

pulse_width0 --> LED_1 on nrf52840_PDK
pulse_width1 --> LED_2 on nrf52840_PDK

I'm able to update value of both these variables using Bluetooth.

I used printk to check it. My logic is perfect.

But if I vary pulse_width0 then it affects intensity of LED2
& if I vary pulse_width1 then it affects intensity of LED1.

Why ? Is anyone found this BUG ?


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--

Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

 

 

 

 

 


Re: [Zephyr-devel] Buggy PWM driver for nRF52

Vikrant More <vikrant8051@...>
 

>> Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

Means ??

I am using h/w PWM only !! Have you looked my main.c ?

Instead I used direct register access method to set PWM on
P0.13(LED_1) & P0.14(LED2)

Here too, I failed to create two PWM with different pulse_width using single instance i.e. PWM0

So I used PWM1 for LED2.

Nordic Datasheet is also not clear about it.

So I open new ticket on Nordic #devzone forum,

https://devzone.nordicsemi.com/f/nordic-q-a/30328/nrf52840-create-2-pwms-with-different-pulse-width-using-single-instance-by-direct-register-access


On Thu, Feb 8, 2018 at 2:32 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

As i said, there is possible overlap of PPIs with BT Controller. PPI channel 16 and 17 overlap with Code PHY feature in nRF52840.

 

I will try to send a PR wherein you could (correctly) disable Coded PHY support in nRF52840 so as to have PPI Channels from 14 to 19 available for 3 LEDs.

 

Until then, use 3 LEDs and expect 2nd LED to malfunction.

 

Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

 

Regards,

Vinayak

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 9:31 AM


To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I also able to generate & vary PWM as you did.

Problem arises when we create two channels from PWM0.

One channel -> LED1

Second Channel -> LED2

When I vary LED1 pulse width, sometimes it affects intensity of LED2

Similarly, when I vary LED2 pulse width it affects intensity of LED1

For details I've attached my main.c. Please have a look.

Use nRF connect to send data

send 0100 (ascii string) -> it is for LED1

send 1100 (ascii string) -> it is for LED2

And you will find what I'm saying.

 

 

On Thu, Feb 8, 2018 at 1:37 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

I have run the upstream fade_led sample on nrf52840-PDK, I see no regression, the brightness changes every second (up and then down so on).

I advice you to debug your implementation as I have no visibility to your design.

 

Regards,

Vinayak

 

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 8:55 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>

Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I'm working nRF52840-PDK board.

 

On Thu, Feb 8, 2018 at 1:21 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

Please try the PWM without the BT Controller included. There could be some PWM regression due to changes in controller implementation.

That said the nrf5_sw  driver is software variant designed for older nRF51 SoCs. For newer nRF52x series h/w PWM’s should be used.

 

Nrf5_sw will work provided careful mitigation of used PPI and timers between the driver and BT controller use.

 

Which SoC are you using?

 

Regards,

Vinayak

 

From: zephyr-devel-bounces@lists.zephyrproject.org [mailto:zephyr-devel-bounces@lists.zephyrproject.org] On Behalf Of Vikrant More
Sent: Thursday, February 08, 2018 5:04 AM
To: Marti Bolivar <marti@...>
Cc: zephyr-users@lists.zephyrproject.org; zephyr-devel@lists.zephyrproject.org; Felipe Neves <ryukokki.felipe@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Marti,

>>Are you using the latest master?

Yes

 

On Thu, Feb 8, 2018 at 1:23 AM, Marti Bolivar <marti@...> wrote:

Hi Vikrant,

 

Are you using the latest master?

 

Three improvements to nRF PWM went in fairly recently:

 

3f1dbfda1 pwm: nrf5_sw: don't disable timer if another channel is still active

ab399a1cf pwm: nrf5_sw: do not use 'inversed' polarity by default

cec073c35 pwm: nrf5_sw: add support for SYS_LOG

 

Thanks,

Marti

 

On Wed, Feb 7, 2018 at 1:59 PM, Vikrant More <vikrant8051@...> wrote:

I took reference of $zephy/samples/samples/fade_led project

 

& add following parameters in my prj.conf

 

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4
 
Could you please inform me, what I should do besides this ??
 
Thank You !!

 

On Feb 7, 2018 11:36 PM, "Felipe Neves" <ryukokki.felipe@...> wrote:

Hi Vikrant,

Did you configure what pins are associated to pwm duty_cycles on the menuconfig?

Best

Felipe

 

 

2018-02-07 10:15 GMT-02:00 Vikrant More <vikrant8051@...>:

Hello World !!

I've added following lines in my project main ()

    pwm_dev = device_get_binding(PWM_DRIVER);

    if (!pwm_dev)
    {
        printk("Cannot find %s!\n", PWM_DRIVER);
        return;
    }

   
    while(1)
    {
   
        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0, PERIOD, pulse_width0))
        {
            printk("pwm pin set fails\n");
        }

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1, PERIOD, pulse_width1))
        {
            printk("pwm pin set fails\n");
        }

        k_sleep(100);
    }

And using bluetooth updating value of pulse_width0 & pulse_width1. Those two are defined as global variables.

pulse_width0 --> LED_1 on nrf52840_PDK
pulse_width1 --> LED_2 on nrf52840_PDK

I'm able to update value of both these variables using Bluetooth.

I used printk to check it. My logic is perfect.

But if I vary pulse_width0 then it affects intensity of LED2
& if I vary pulse_width1 then it affects intensity of LED1.

Why ? Is anyone found this BUG ?


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--

Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

 

 

 

 



Re: [Zephyr-devel] Buggy PWM driver for nRF52

Chettimada, Vinayak Kariappa
 

Hi Vikrant,

 

As i said, there is possible overlap of PPIs with BT Controller. PPI channel 16 and 17 overlap with Code PHY feature in nRF52840.

 

I will try to send a PR wherein you could (correctly) disable Coded PHY support in nRF52840 so as to have PPI Channels from 14 to 19 available for 3 LEDs.

 

Until then, use 3 LEDs and expect 2nd LED to malfunction.

 

Again, I will like to iterate that for nRF52840, h/w PWM driver has to be used, feel free to contribute (isn’t it fun to develop than test ;) )

 

Regards,

Vinayak

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 9:31 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I also able to generate & vary PWM as you did.

Problem arises when we create two channels from PWM0.

One channel -> LED1

Second Channel -> LED2

When I vary LED1 pulse width, sometimes it affects intensity of LED2

Similarly, when I vary LED2 pulse width it affects intensity of LED1

For details I've attached my main.c. Please have a look.

Use nRF connect to send data

send 0100 (ascii string) -> it is for LED1

send 1100 (ascii string) -> it is for LED2

And you will find what I'm saying.

 

 

On Thu, Feb 8, 2018 at 1:37 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

I have run the upstream fade_led sample on nrf52840-PDK, I see no regression, the brightness changes every second (up and then down so on).

I advice you to debug your implementation as I have no visibility to your design.

 

Regards,

Vinayak

 

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 8:55 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>

Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I'm working nRF52840-PDK board.

 

On Thu, Feb 8, 2018 at 1:21 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

Please try the PWM without the BT Controller included. There could be some PWM regression due to changes in controller implementation.

That said the nrf5_sw  driver is software variant designed for older nRF51 SoCs. For newer nRF52x series h/w PWM’s should be used.

 

Nrf5_sw will work provided careful mitigation of used PPI and timers between the driver and BT controller use.

 

Which SoC are you using?

 

Regards,

Vinayak

 

From: zephyr-devel-bounces@... [mailto:zephyr-devel-bounces@...] On Behalf Of Vikrant More
Sent: Thursday, February 08, 2018 5:04 AM
To: Marti Bolivar <marti@...>
Cc: zephyr-users@...; zephyr-devel@...; Felipe Neves <ryukokki.felipe@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Marti,

>>Are you using the latest master?

Yes

 

On Thu, Feb 8, 2018 at 1:23 AM, Marti Bolivar <marti@...> wrote:

Hi Vikrant,

 

Are you using the latest master?

 

Three improvements to nRF PWM went in fairly recently:

 

3f1dbfda1 pwm: nrf5_sw: don't disable timer if another channel is still active

ab399a1cf pwm: nrf5_sw: do not use 'inversed' polarity by default

cec073c35 pwm: nrf5_sw: add support for SYS_LOG

 

Thanks,

Marti

 

On Wed, Feb 7, 2018 at 1:59 PM, Vikrant More <vikrant8051@...> wrote:

I took reference of $zephy/samples/samples/fade_led project

 

& add following parameters in my prj.conf

 

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4
 
Could you please inform me, what I should do besides this ??
 
Thank You !!

 

On Feb 7, 2018 11:36 PM, "Felipe Neves" <ryukokki.felipe@...> wrote:

Hi Vikrant,

Did you configure what pins are associated to pwm duty_cycles on the menuconfig?

Best

Felipe

 

 

2018-02-07 10:15 GMT-02:00 Vikrant More <vikrant8051@...>:

Hello World !!

I've added following lines in my project main ()

    pwm_dev = device_get_binding(PWM_DRIVER);

    if (!pwm_dev)
    {
        printk("Cannot find %s!\n", PWM_DRIVER);
        return;
    }

   
    while(1)
    {
   
        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0, PERIOD, pulse_width0))
        {
            printk("pwm pin set fails\n");
        }

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1, PERIOD, pulse_width1))
        {
            printk("pwm pin set fails\n");
        }

        k_sleep(100);
    }

And using bluetooth updating value of pulse_width0 & pulse_width1. Those two are defined as global variables.

pulse_width0 --> LED_1 on nrf52840_PDK
pulse_width1 --> LED_2 on nrf52840_PDK

I'm able to update value of both these variables using Bluetooth.

I used printk to check it. My logic is perfect.

But if I vary pulse_width0 then it affects intensity of LED2
& if I vary pulse_width1 then it affects intensity of LED1.

Why ? Is anyone found this BUG ?


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--

Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

 

 

 

 


Re: [Zephyr-devel] Buggy PWM driver for nRF52

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

Hi Vinayak,

fade_led sample runs as expected. We are trying to generate PWM on two channels. Adding 

pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0,PERIOD, pulse_width);
pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1,PERIOD, pulse_width);

Creates unexpected behavior. 



--
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


On Thu, Feb 8, 2018 at 1:37 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

I have run the upstream fade_led sample on nrf52840-PDK, I see no regression, the brightness changes every second (up and then down so on).

I advice you to debug your implementation as I have no visibility to your design.

 

Regards,

Vinayak

 

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 8:55 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I'm working nRF52840-PDK board.

 

On Thu, Feb 8, 2018 at 1:21 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Vikrant,

 

Please try the PWM without the BT Controller included. There could be some PWM regression due to changes in controller implementation.

That said the nrf5_sw  driver is software variant designed for older nRF51 SoCs. For newer nRF52x series h/w PWM’s should be used.

 

Nrf5_sw will work provided careful mitigation of used PPI and timers between the driver and BT controller use.

 

Which SoC are you using?

 

Regards,

Vinayak

 

From: zephyr-devel-bounces@lists.zephyrproject.org [mailto:zephyr-devel-bounces@lists.zephyrproject.org] On Behalf Of Vikrant More
Sent: Thursday, February 08, 2018 5:04 AM
To: Marti Bolivar <marti@...>
Cc: zephyr-users@lists.zephyrproject.org; zephyr-devel@lists.zephyrproject.org; Felipe Neves <ryukokki.felipe@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Marti,

>>Are you using the latest master?

Yes

 

On Thu, Feb 8, 2018 at 1:23 AM, Marti Bolivar <marti@...> wrote:

Hi Vikrant,

 

Are you using the latest master?

 

Three improvements to nRF PWM went in fairly recently:

 

3f1dbfda1 pwm: nrf5_sw: don't disable timer if another channel is still active

ab399a1cf pwm: nrf5_sw: do not use 'inversed' polarity by default

cec073c35 pwm: nrf5_sw: add support for SYS_LOG

 

Thanks,

Marti

 

On Wed, Feb 7, 2018 at 1:59 PM, Vikrant More <vikrant8051@...> wrote:

I took reference of $zephy/samples/samples/fade_led project

 

& add following parameters in my prj.conf

 

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4
 
Could you please inform me, what I should do besides this ??
 
Thank You !!

 

On Feb 7, 2018 11:36 PM, "Felipe Neves" <ryukokki.felipe@...> wrote:

Hi Vikrant,

Did you configure what pins are associated to pwm duty_cycles on the menuconfig?

Best

Felipe

 

 

2018-02-07 10:15 GMT-02:00 Vikrant More <vikrant8051@...>:

Hello World !!

I've added following lines in my project main ()

    pwm_dev = device_get_binding(PWM_DRIVER);

    if (!pwm_dev)
    {
        printk("Cannot find %s!\n", PWM_DRIVER);
        return;
    }

   
    while(1)
    {
   
        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0, PERIOD, pulse_width0))
        {
            printk("pwm pin set fails\n");
        }

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1, PERIOD, pulse_width1))
        {
            printk("pwm pin set fails\n");
        }

        k_sleep(100);
    }

And using bluetooth updating value of pulse_width0 & pulse_width1. Those two are defined as global variables.

pulse_width0 --> LED_1 on nrf52840_PDK
pulse_width1 --> LED_2 on nrf52840_PDK

I'm able to update value of both these variables using Bluetooth.

I used printk to check it. My logic is perfect.

But if I vary pulse_width0 then it affects intensity of LED2
& if I vary pulse_width1 then it affects intensity of LED1.

Why ? Is anyone found this BUG ?


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--

Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

 

 

 


_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users



Re: [Zephyr-devel] Buggy PWM driver for nRF52

Chettimada, Vinayak Kariappa
 

Hi Vikrant,

 

I have run the upstream fade_led sample on nrf52840-PDK, I see no regression, the brightness changes every second (up and then down so on).

I advice you to debug your implementation as I have no visibility to your design.

 

Regards,

Vinayak

 

 

From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 8:55 AM
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Vinayak,

I'm working nRF52840-PDK board.

 

On Thu, Feb 8, 2018 at 1:21 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,

 

Please try the PWM without the BT Controller included. There could be some PWM regression due to changes in controller implementation.

That said the nrf5_sw  driver is software variant designed for older nRF51 SoCs. For newer nRF52x series h/w PWM’s should be used.

 

Nrf5_sw will work provided careful mitigation of used PPI and timers between the driver and BT controller use.

 

Which SoC are you using?

 

Regards,

Vinayak

 

From: zephyr-devel-bounces@... [mailto:zephyr-devel-bounces@...] On Behalf Of Vikrant More
Sent: Thursday, February 08, 2018 5:04 AM
To: Marti Bolivar <marti@...>
Cc: zephyr-users@...; zephyr-devel@...; Felipe Neves <ryukokki.felipe@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52

 

Hi Marti,

>>Are you using the latest master?

Yes

 

On Thu, Feb 8, 2018 at 1:23 AM, Marti Bolivar <marti@...> wrote:

Hi Vikrant,

 

Are you using the latest master?

 

Three improvements to nRF PWM went in fairly recently:

 

3f1dbfda1 pwm: nrf5_sw: don't disable timer if another channel is still active

ab399a1cf pwm: nrf5_sw: do not use 'inversed' polarity by default

cec073c35 pwm: nrf5_sw: add support for SYS_LOG

 

Thanks,

Marti

 

On Wed, Feb 7, 2018 at 1:59 PM, Vikrant More <vikrant8051@...> wrote:

I took reference of $zephy/samples/samples/fade_led project

 

& add following parameters in my prj.conf

 

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4
 
Could you please inform me, what I should do besides this ??
 
Thank You !!

 

On Feb 7, 2018 11:36 PM, "Felipe Neves" <ryukokki.felipe@...> wrote:

Hi Vikrant,

Did you configure what pins are associated to pwm duty_cycles on the menuconfig?

Best

Felipe

 

 

2018-02-07 10:15 GMT-02:00 Vikrant More <vikrant8051@...>:

Hello World !!

I've added following lines in my project main ()

    pwm_dev = device_get_binding(PWM_DRIVER);

    if (!pwm_dev)
    {
        printk("Cannot find %s!\n", PWM_DRIVER);
        return;
    }

   
    while(1)
    {
   
        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0, PERIOD, pulse_width0))
        {
            printk("pwm pin set fails\n");
        }

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1, PERIOD, pulse_width1))
        {
            printk("pwm pin set fails\n");
        }

        k_sleep(100);
    }

And using bluetooth updating value of pulse_width0 & pulse_width1. Those two are defined as global variables.

pulse_width0 --> LED_1 on nrf52840_PDK
pulse_width1 --> LED_2 on nrf52840_PDK

I'm able to update value of both these variables using Bluetooth.

I used printk to check it. My logic is perfect.

But if I vary pulse_width0 then it affects intensity of LED2
& if I vary pulse_width1 then it affects intensity of LED1.

Why ? Is anyone found this BUG ?


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--

Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989


_______________________________________________
Zephyr-users mailing list
Zephyr-users@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

 

 

 

2121 - 2140 of 2659