Re: Writing PWM api, and nrf51 implementation

2017-06-15 Thread marko kiiskila
Hi Jacob,

there should not be any issue, even if you brought code over directly.
Zephyr has a permissive licensing (Apache-2).

> On Jun 15, 2017, at 5:09 PM, Jacob Rosenthal  wrote:
> 
> I know we're chummy with zephyr team. Whats the license issues with
> bringing something very close to their implementation over?
> 
> On Mon, May 15, 2017 at 6:23 AM, Cufi, Carles 
> wrote:
> 
>> Hi Wayne,
>> 
>>> -Original Message-
>>> From: Wayne Keenan [mailto:wayne.kee...@gmail.com]
>>> Sent: Monday, May 15, 2017 11:36
>>> To: dev@mynewt.incubator.apache.org
>>> Subject: Re: Writing PWM api, and nrf51 implementation
>>> 
>>> Hi Jacob,
>>> 
>>> 
>>> I've listed below various soft PWM implementations I've bumped into over
>>> time, I thought they might make a handy reference for you:
>>> 
>>> ARM Mbed:
>>> 
>>> 
>>> https://github.com/ARMmbed/mbed-hal-nrf51822-mcu/blob/master
>>> /source/pwmout_api.c
>>> 
>>> 
>>> 3rd Party support for Arduino IDE:
>>> 
>>> 
>>> https://github.com/RedBearLab/nRF51822-Arduino/blob/S130/ard
>>> uino-
>>> 1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_analog.cpp
>>> 
>>> 
>>> https://github.com/RFduino/RFduino/blob/master/cores/arduino/wiring_anal
>>> og.c
>>> 
>>> 
>>> https://github.com/sandeepmistry/arduino-nRF5/blob/master/
>>> cores/nRF5/wiring_analog_nRF51.c
>>> 
>>> 
>>> Nordic example: (although this probably is very much superseded by what
>>> Nordic includes in their SDK these days, as pointed out by Andrey)
>>> 
>>> 
>>> https://devzone.nordicsemi.com/question/798/is-there-an-exam
>>> ple-code-for-using-pwm-on-the-nrf51822-with-a-softdevice/
>> 
>> Here's another one:
>> 
>> https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/pwm/pwm_
>> nrf5_sw.c
>> 
>> Carles
>> 
>> 
>> 
>> 



Re: Writing PWM api, and nrf51 implementation

2017-06-15 Thread Jacob Rosenthal
I know we're chummy with zephyr team. Whats the license issues with
bringing something very close to their implementation over?

On Mon, May 15, 2017 at 6:23 AM, Cufi, Carles 
wrote:

> Hi Wayne,
>
> > -Original Message-
> > From: Wayne Keenan [mailto:wayne.kee...@gmail.com]
> > Sent: Monday, May 15, 2017 11:36
> > To: dev@mynewt.incubator.apache.org
> > Subject: Re: Writing PWM api, and nrf51 implementation
> >
> > Hi Jacob,
> >
> >
> > I've listed below various soft PWM implementations I've bumped into over
> > time, I thought they might make a handy reference for you:
> >
> > ARM Mbed:
> >
> >
> > https://github.com/ARMmbed/mbed-hal-nrf51822-mcu/blob/master
> > /source/pwmout_api.c
> >
> >
> > 3rd Party support for Arduino IDE:
> >
> >
> > https://github.com/RedBearLab/nRF51822-Arduino/blob/S130/ard
> > uino-
> > 1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_analog.cpp
> >
> >
> > https://github.com/RFduino/RFduino/blob/master/cores/arduino/wiring_anal
> > og.c
> >
> >
> > https://github.com/sandeepmistry/arduino-nRF5/blob/master/
> > cores/nRF5/wiring_analog_nRF51.c
> >
> >
> > Nordic example: (although this probably is very much superseded by what
> > Nordic includes in their SDK these days, as pointed out by Andrey)
> >
> >
> > https://devzone.nordicsemi.com/question/798/is-there-an-exam
> > ple-code-for-using-pwm-on-the-nrf51822-with-a-softdevice/
>
> Here's another one:
>
> https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/pwm/pwm_
> nrf5_sw.c
>
> Carles
>
>
>
>


RE: Writing PWM api, and nrf51 implementation

2017-05-15 Thread Cufi, Carles
Hi Wayne,

> -Original Message-
> From: Wayne Keenan [mailto:wayne.kee...@gmail.com]
> Sent: Monday, May 15, 2017 11:36
> To: dev@mynewt.incubator.apache.org
> Subject: Re: Writing PWM api, and nrf51 implementation
> 
> Hi Jacob,
> 
> 
> I've listed below various soft PWM implementations I've bumped into over
> time, I thought they might make a handy reference for you:
> 
> ARM Mbed:
> 
> 
> https://github.com/ARMmbed/mbed-hal-nrf51822-mcu/blob/master
> /source/pwmout_api.c
> 
> 
> 3rd Party support for Arduino IDE:
> 
> 
> https://github.com/RedBearLab/nRF51822-Arduino/blob/S130/ard
> uino-
> 1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_analog.cpp
> 
> 
> https://github.com/RFduino/RFduino/blob/master/cores/arduino/wiring_anal
> og.c
> 
> 
> https://github.com/sandeepmistry/arduino-nRF5/blob/master/
> cores/nRF5/wiring_analog_nRF51.c
> 
> 
> Nordic example: (although this probably is very much superseded by what
> Nordic includes in their SDK these days, as pointed out by Andrey)
> 
> 
> https://devzone.nordicsemi.com/question/798/is-there-an-exam
> ple-code-for-using-pwm-on-the-nrf51822-with-a-softdevice/

Here's another one:

https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/pwm/pwm_nrf5_sw.c

Carles





Re: Writing PWM api, and nrf51 implementation

2017-05-15 Thread Wayne Keenan
Hi Jacob,


I've listed below various soft PWM implementations I've bumped into over
time, I thought they might make a handy reference for you:

ARM Mbed:


https://github.com/ARMmbed/mbed-hal-nrf51822-mcu/blob/master
/source/pwmout_api.c


3rd Party support for Arduino IDE:


https://github.com/RedBearLab/nRF51822-Arduino/blob/S130/ard
uino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_analog.cpp


https://github.com/RFduino/RFduino/blob/master/cores/arduino/wiring_analog.c


https://github.com/sandeepmistry/arduino-nRF5/blob/master/
cores/nRF5/wiring_analog_nRF51.c


Nordic example: (although this probably is very much superseded by what
Nordic includes in their SDK these days, as pointed out by Andrey)


https://devzone.nordicsemi.com/question/798/is-there-an-exam
ple-code-for-using-pwm-on-the-nrf51822-with-a-softdevice/




Hope it helps.

Thanks,
Wayne

On 15 May 2017 at 09:26, Andrey Serdtsev 
wrote:

> Jacob,
>
> Check nrf5_sdk/components/libraries/pwm for soft-pwm implementation by
> NordicSemi. IMO, this is a good start point.
>
> BR,
> Andrey
>
>
>
> On 15.05.2017 00:24, Jacob Rosenthal wrote:
>
>> So a soft pwm on top of one of the free timers sounds like the best way to
>> proceed...
>>
>> On Sun, May 14, 2017 at 2:20 PM, will sanfilippo 
>> wrote:
>>
>> There are other timers you could use; you do not need to use the low power
>>> timer. A callout would not be a good idea imo.
>>>
>>> On May 14, 2017, at 1:35 PM, Jacob Rosenthal 

>>> wrote:
>>>
 Looks like lfclk is now used for low power mode you added, so maybe
 thats
 not a good solution either.

 I wonder how decent a soft pwm with just callouts could be.

 On Sun, May 14, 2017 at 10:25 AM, will sanfilippo 

>>> wrote:
>>>
 Not quite sure myself off the top of my head. I am not the best newt
>
 tool
>>>
 person. I can try to take a look at it later today if you cant figure it
> out before then.
>
>
> On May 14, 2017, at 10:00 AM, Jacob Rosenthal >
> wrote:
>
>> Good point. Ive obviously seen pwm implementaitons on nrf51 many
>> times.
>>
> Im
>
>> guessing theyre using the 'low power pwm" driver I stumbled across
>> that
>> appears to be using the lfclk
>> https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.
>>
> nordic.infocenter.sdk51.v10.0.0%2Flow_power_pwm_example.html
>
>> Sameish question, I tried to port that example with the same problem,
>>
> Im
>>>
 having trouble figuring out how to get newt to see the SDK files
>>
>> I tried adding low_power_pwm to ign_files and  src_dirs
>>
>> pkg.ign_files.BSP_NRF51:
>>- "nrf_saadc.c"
>>- "nrf_drv_saadc.c"
>>- "nrf_drv_comp.c"
>>- "nrf_drv_i2s.c"
>>- "nrf_drv_pdm.c"
>>- "nrf_drv_pwm.c"
>>- "nrf_drv_spis.c"
>>- "nrf_drv_twis.c"
>>- "spi_5W_master.c"
>>- "pstorage*"
>>- "sdk_mapped_flags.c"
>>- "low_power_pwm.c"
>>
>> pkg.ign_dirs:
>>- "deprecated"
>>
>> pkg.src_dirs:
>>- "src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/"
>>- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/"
>>- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/"
>>- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/
>>
> low_power_pwm/"
>
>> Error:
>> /Users/jacobrosenthal/Downloads/chippd3/bin/targets/
>>
> split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_
> drivers_lf_pwm.a(lf_pwm.o):
>
>> In function `low_power_init':
>> /Users/jacobrosenthal/Downloads/chippd3/repos/
>>
> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:127:
>
>> undefined reference to `low_power_pwm_init'
>> /Users/jacobrosenthal/Downloads/chippd3/repos/
>>
> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:129:
>
>> undefined reference to `low_power_pwm_duty_set'
>> /Users/jacobrosenthal/Downloads/chippd3/repos/
>>
> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:154:
>
>> undefined reference to `low_power_pwm_start'
>> /Users/jacobrosenthal/Downloads/chippd3/bin/targets/
>>
> split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_
> drivers_lf_pwm.a(lf_pwm.o):
>
>> In function `lf_pwm_init':
>> /Users/jacobrosenthal/Downloads/chippd3/repos/
>>
> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:182:
>
>> undefined reference to `app_timer_init'
>> collect2: error: ld returned 1 exit status
>>
>>
>> On Sun, May 14, 2017 at 9:00 AM, will sanfilippo 
>>
> wrote:
>
>> Jacob:
>>>
>>> Does the nrf51 have a PWM peripheral? I do not think it does. I
>>> looked
>>>
>> at
>
>> the chip spec and nrf51.h and there is no PWM peripheral like the
>>>
>> nrf52
>>>
 in
>
>> either.
>>>
>>>
>>> On May 1

Re: Writing PWM api, and nrf51 implementation

2017-05-15 Thread Andrey Serdtsev

Jacob,

Check nrf5_sdk/components/libraries/pwm for soft-pwm implementation by 
NordicSemi. IMO, this is a good start point.


BR,
Andrey


On 15.05.2017 00:24, Jacob Rosenthal wrote:

So a soft pwm on top of one of the free timers sounds like the best way to
proceed...

On Sun, May 14, 2017 at 2:20 PM, will sanfilippo  wrote:


There are other timers you could use; you do not need to use the low power
timer. A callout would not be a good idea imo.


On May 14, 2017, at 1:35 PM, Jacob Rosenthal 

wrote:

Looks like lfclk is now used for low power mode you added, so maybe thats
not a good solution either.

I wonder how decent a soft pwm with just callouts could be.

On Sun, May 14, 2017 at 10:25 AM, will sanfilippo 

wrote:

Not quite sure myself off the top of my head. I am not the best newt

tool

person. I can try to take a look at it later today if you cant figure it
out before then.



On May 14, 2017, at 10:00 AM, Jacob Rosenthal 
wrote:

Good point. Ive obviously seen pwm implementaitons on nrf51 many times.

Im

guessing theyre using the 'low power pwm" driver I stumbled across that
appears to be using the lfclk
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.

nordic.infocenter.sdk51.v10.0.0%2Flow_power_pwm_example.html

Sameish question, I tried to port that example with the same problem,

Im

having trouble figuring out how to get newt to see the SDK files

I tried adding low_power_pwm to ign_files and  src_dirs

pkg.ign_files.BSP_NRF51:
   - "nrf_saadc.c"
   - "nrf_drv_saadc.c"
   - "nrf_drv_comp.c"
   - "nrf_drv_i2s.c"
   - "nrf_drv_pdm.c"
   - "nrf_drv_pwm.c"
   - "nrf_drv_spis.c"
   - "nrf_drv_twis.c"
   - "spi_5W_master.c"
   - "pstorage*"
   - "sdk_mapped_flags.c"
   - "low_power_pwm.c"

pkg.ign_dirs:
   - "deprecated"

pkg.src_dirs:
   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/"
   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/"
   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/"
   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/

low_power_pwm/"

Error:
/Users/jacobrosenthal/Downloads/chippd3/bin/targets/

split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_
drivers_lf_pwm.a(lf_pwm.o):

In function `low_power_init':
/Users/jacobrosenthal/Downloads/chippd3/repos/

mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:127:

undefined reference to `low_power_pwm_init'
/Users/jacobrosenthal/Downloads/chippd3/repos/

mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:129:

undefined reference to `low_power_pwm_duty_set'
/Users/jacobrosenthal/Downloads/chippd3/repos/

mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:154:

undefined reference to `low_power_pwm_start'
/Users/jacobrosenthal/Downloads/chippd3/bin/targets/

split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_
drivers_lf_pwm.a(lf_pwm.o):

In function `lf_pwm_init':
/Users/jacobrosenthal/Downloads/chippd3/repos/

mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:182:

undefined reference to `app_timer_init'
collect2: error: ld returned 1 exit status


On Sun, May 14, 2017 at 9:00 AM, will sanfilippo 

wrote:

Jacob:

Does the nrf51 have a PWM peripheral? I do not think it does. I looked

at

the chip spec and nrf51.h and there is no PWM peripheral like the

nrf52

in

either.



On May 13, 2017, at 7:46 PM, Jacob Rosenthal <

jakerosent...@gmail.com>

wrote:

Im attempting to write a pwm api and nrf51 driver. Im mostly just

stubbing

right now based on the adc driver, and have mynewt pwm driver

stubbed,

and

am now stubbing mynewt_nordic/hw/drivers/pwm_nrf51 which includes
nrf_drv_pwm.h and nrf_pwm.h from the sdk but thats giving tons of

errors.

Maybe something needs to be added to the mcu/nordic_sdk?






Error: In file included from
repos/apache-mynewt-core/libc/baselibc/include/inttypes.h:10:0,

   from
repos/apache-mynewt-core/hw/hal/include/hal/hal_bsp.h:27,

   from
repos/mynewt-nordic/hw/drivers/pwm/pwm_nrf51/src/pwm_nrf51.c:19:

repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_

11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:56:39:

error: unknown type name 'NRF_PWM_Type'

   NRF_PWM_TASK_STOP  = offsetof(NRF_PWM_Type, TASKS_STOP),
///< Stops PWM pulse generation on all channels at the end of the

current

PWM period, and stops the sequence playback.

 ^

repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_

11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:57:39:

error: unknown type name 'NRF_PWM_Type'

   NRF_PWM_TASK_SEQSTART0 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[0]),
///< Starts playback of sequence 0.

 ^

repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_

11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:58:39:

error: unknown type name 'NRF_PWM_Type'

   NRF_PWM_TASK_SEQSTART1 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[1]),
///< Starts playback of sequence 1.

 ^

repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SD

Re: Writing PWM api, and nrf51 implementation

2017-05-14 Thread Jacob Rosenthal
So a soft pwm on top of one of the free timers sounds like the best way to
proceed...

On Sun, May 14, 2017 at 2:20 PM, will sanfilippo  wrote:

> There are other timers you could use; you do not need to use the low power
> timer. A callout would not be a good idea imo.
>
> > On May 14, 2017, at 1:35 PM, Jacob Rosenthal 
> wrote:
> >
> > Looks like lfclk is now used for low power mode you added, so maybe thats
> > not a good solution either.
> >
> > I wonder how decent a soft pwm with just callouts could be.
> >
> > On Sun, May 14, 2017 at 10:25 AM, will sanfilippo 
> wrote:
> >
> >> Not quite sure myself off the top of my head. I am not the best newt
> tool
> >> person. I can try to take a look at it later today if you cant figure it
> >> out before then.
> >>
> >>
> >>> On May 14, 2017, at 10:00 AM, Jacob Rosenthal  >
> >> wrote:
> >>>
> >>> Good point. Ive obviously seen pwm implementaitons on nrf51 many times.
> >> Im
> >>> guessing theyre using the 'low power pwm" driver I stumbled across that
> >>> appears to be using the lfclk
> >>> https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.
> >> nordic.infocenter.sdk51.v10.0.0%2Flow_power_pwm_example.html
> >>>
> >>> Sameish question, I tried to port that example with the same problem,
> Im
> >>> having trouble figuring out how to get newt to see the SDK files
> >>>
> >>> I tried adding low_power_pwm to ign_files and  src_dirs
> >>>
> >>> pkg.ign_files.BSP_NRF51:
> >>>   - "nrf_saadc.c"
> >>>   - "nrf_drv_saadc.c"
> >>>   - "nrf_drv_comp.c"
> >>>   - "nrf_drv_i2s.c"
> >>>   - "nrf_drv_pdm.c"
> >>>   - "nrf_drv_pwm.c"
> >>>   - "nrf_drv_spis.c"
> >>>   - "nrf_drv_twis.c"
> >>>   - "spi_5W_master.c"
> >>>   - "pstorage*"
> >>>   - "sdk_mapped_flags.c"
> >>>   - "low_power_pwm.c"
> >>>
> >>> pkg.ign_dirs:
> >>>   - "deprecated"
> >>>
> >>> pkg.src_dirs:
> >>>   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/"
> >>>   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/"
> >>>   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/"
> >>>   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/
> >> low_power_pwm/"
> >>>
> >>> Error:
> >>> /Users/jacobrosenthal/Downloads/chippd3/bin/targets/
> >> split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_
> >> drivers_lf_pwm.a(lf_pwm.o):
> >>> In function `low_power_init':
> >>> /Users/jacobrosenthal/Downloads/chippd3/repos/
> >> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:127:
> >>> undefined reference to `low_power_pwm_init'
> >>> /Users/jacobrosenthal/Downloads/chippd3/repos/
> >> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:129:
> >>> undefined reference to `low_power_pwm_duty_set'
> >>> /Users/jacobrosenthal/Downloads/chippd3/repos/
> >> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:154:
> >>> undefined reference to `low_power_pwm_start'
> >>> /Users/jacobrosenthal/Downloads/chippd3/bin/targets/
> >> split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_
> >> drivers_lf_pwm.a(lf_pwm.o):
> >>> In function `lf_pwm_init':
> >>> /Users/jacobrosenthal/Downloads/chippd3/repos/
> >> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:182:
> >>> undefined reference to `app_timer_init'
> >>> collect2: error: ld returned 1 exit status
> >>>
> >>>
> >>> On Sun, May 14, 2017 at 9:00 AM, will sanfilippo 
> >> wrote:
> >>>
>  Jacob:
> 
>  Does the nrf51 have a PWM peripheral? I do not think it does. I looked
> >> at
>  the chip spec and nrf51.h and there is no PWM peripheral like the
> nrf52
> >> in
>  either.
> 
> 
> > On May 13, 2017, at 7:46 PM, Jacob Rosenthal <
> jakerosent...@gmail.com>
>  wrote:
> >
> > Im attempting to write a pwm api and nrf51 driver. Im mostly just
>  stubbing
> > right now based on the adc driver, and have mynewt pwm driver
> stubbed,
>  and
> > am now stubbing mynewt_nordic/hw/drivers/pwm_nrf51 which includes
> > nrf_drv_pwm.h and nrf_pwm.h from the sdk but thats giving tons of
> >> errors.
> >
> > Maybe something needs to be added to the mcu/nordic_sdk?
> >
> >
> >
> >
> >
> >
> > Error: In file included from
> > repos/apache-mynewt-core/libc/baselibc/include/inttypes.h:10:0,
> >
> >   from
> > repos/apache-mynewt-core/hw/hal/include/hal/hal_bsp.h:27,
> >
> >   from
> > repos/mynewt-nordic/hw/drivers/pwm/pwm_nrf51/src/pwm_nrf51.c:19:
> >
> > repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
>  11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:56:39:
> > error: unknown type name 'NRF_PWM_Type'
> >
> >   NRF_PWM_TASK_STOP  = offsetof(NRF_PWM_Type, TASKS_STOP),
> > ///< Stops PWM pulse generation on all channels at the end of the
> >> current
> > PWM period, and stops the sequence playback.
> >
> > ^
> >
> > repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
>  11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:57:39:
>

Re: Writing PWM api, and nrf51 implementation

2017-05-14 Thread will sanfilippo
There are other timers you could use; you do not need to use the low power 
timer. A callout would not be a good idea imo.

> On May 14, 2017, at 1:35 PM, Jacob Rosenthal  wrote:
> 
> Looks like lfclk is now used for low power mode you added, so maybe thats
> not a good solution either.
> 
> I wonder how decent a soft pwm with just callouts could be.
> 
> On Sun, May 14, 2017 at 10:25 AM, will sanfilippo  wrote:
> 
>> Not quite sure myself off the top of my head. I am not the best newt tool
>> person. I can try to take a look at it later today if you cant figure it
>> out before then.
>> 
>> 
>>> On May 14, 2017, at 10:00 AM, Jacob Rosenthal 
>> wrote:
>>> 
>>> Good point. Ive obviously seen pwm implementaitons on nrf51 many times.
>> Im
>>> guessing theyre using the 'low power pwm" driver I stumbled across that
>>> appears to be using the lfclk
>>> https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.
>> nordic.infocenter.sdk51.v10.0.0%2Flow_power_pwm_example.html
>>> 
>>> Sameish question, I tried to port that example with the same problem, Im
>>> having trouble figuring out how to get newt to see the SDK files
>>> 
>>> I tried adding low_power_pwm to ign_files and  src_dirs
>>> 
>>> pkg.ign_files.BSP_NRF51:
>>>   - "nrf_saadc.c"
>>>   - "nrf_drv_saadc.c"
>>>   - "nrf_drv_comp.c"
>>>   - "nrf_drv_i2s.c"
>>>   - "nrf_drv_pdm.c"
>>>   - "nrf_drv_pwm.c"
>>>   - "nrf_drv_spis.c"
>>>   - "nrf_drv_twis.c"
>>>   - "spi_5W_master.c"
>>>   - "pstorage*"
>>>   - "sdk_mapped_flags.c"
>>>   - "low_power_pwm.c"
>>> 
>>> pkg.ign_dirs:
>>>   - "deprecated"
>>> 
>>> pkg.src_dirs:
>>>   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/"
>>>   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/"
>>>   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/"
>>>   - "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/
>> low_power_pwm/"
>>> 
>>> Error:
>>> /Users/jacobrosenthal/Downloads/chippd3/bin/targets/
>> split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_
>> drivers_lf_pwm.a(lf_pwm.o):
>>> In function `low_power_init':
>>> /Users/jacobrosenthal/Downloads/chippd3/repos/
>> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:127:
>>> undefined reference to `low_power_pwm_init'
>>> /Users/jacobrosenthal/Downloads/chippd3/repos/
>> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:129:
>>> undefined reference to `low_power_pwm_duty_set'
>>> /Users/jacobrosenthal/Downloads/chippd3/repos/
>> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:154:
>>> undefined reference to `low_power_pwm_start'
>>> /Users/jacobrosenthal/Downloads/chippd3/bin/targets/
>> split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_
>> drivers_lf_pwm.a(lf_pwm.o):
>>> In function `lf_pwm_init':
>>> /Users/jacobrosenthal/Downloads/chippd3/repos/
>> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:182:
>>> undefined reference to `app_timer_init'
>>> collect2: error: ld returned 1 exit status
>>> 
>>> 
>>> On Sun, May 14, 2017 at 9:00 AM, will sanfilippo 
>> wrote:
>>> 
 Jacob:
 
 Does the nrf51 have a PWM peripheral? I do not think it does. I looked
>> at
 the chip spec and nrf51.h and there is no PWM peripheral like the nrf52
>> in
 either.
 
 
> On May 13, 2017, at 7:46 PM, Jacob Rosenthal 
 wrote:
> 
> Im attempting to write a pwm api and nrf51 driver. Im mostly just
 stubbing
> right now based on the adc driver, and have mynewt pwm driver stubbed,
 and
> am now stubbing mynewt_nordic/hw/drivers/pwm_nrf51 which includes
> nrf_drv_pwm.h and nrf_pwm.h from the sdk but thats giving tons of
>> errors.
> 
> Maybe something needs to be added to the mcu/nordic_sdk?
> 
> 
> 
> 
> 
> 
> Error: In file included from
> repos/apache-mynewt-core/libc/baselibc/include/inttypes.h:10:0,
> 
>   from
> repos/apache-mynewt-core/hw/hal/include/hal/hal_bsp.h:27,
> 
>   from
> repos/mynewt-nordic/hw/drivers/pwm/pwm_nrf51/src/pwm_nrf51.c:19:
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:56:39:
> error: unknown type name 'NRF_PWM_Type'
> 
>   NRF_PWM_TASK_STOP  = offsetof(NRF_PWM_Type, TASKS_STOP),
> ///< Stops PWM pulse generation on all channels at the end of the
>> current
> PWM period, and stops the sequence playback.
> 
> ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:57:39:
> error: unknown type name 'NRF_PWM_Type'
> 
>   NRF_PWM_TASK_SEQSTART0 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[0]),
> ///< Starts playback of sequence 0.
> 
> ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:58:39:
> error: unknown type name 'NRF_PWM_Type'
> 
>   N

Re: Writing PWM api, and nrf51 implementation

2017-05-14 Thread Jacob Rosenthal
Looks like lfclk is now used for low power mode you added, so maybe thats
not a good solution either.

I wonder how decent a soft pwm with just callouts could be.

On Sun, May 14, 2017 at 10:25 AM, will sanfilippo  wrote:

> Not quite sure myself off the top of my head. I am not the best newt tool
> person. I can try to take a look at it later today if you cant figure it
> out before then.
>
>
> > On May 14, 2017, at 10:00 AM, Jacob Rosenthal 
> wrote:
> >
> > Good point. Ive obviously seen pwm implementaitons on nrf51 many times.
> Im
> > guessing theyre using the 'low power pwm" driver I stumbled across that
> > appears to be using the lfclk
> > https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.
> nordic.infocenter.sdk51.v10.0.0%2Flow_power_pwm_example.html
> >
> > Sameish question, I tried to port that example with the same problem, Im
> > having trouble figuring out how to get newt to see the SDK files
> >
> > I tried adding low_power_pwm to ign_files and  src_dirs
> >
> > pkg.ign_files.BSP_NRF51:
> >- "nrf_saadc.c"
> >- "nrf_drv_saadc.c"
> >- "nrf_drv_comp.c"
> >- "nrf_drv_i2s.c"
> >- "nrf_drv_pdm.c"
> >- "nrf_drv_pwm.c"
> >- "nrf_drv_spis.c"
> >- "nrf_drv_twis.c"
> >- "spi_5W_master.c"
> >- "pstorage*"
> >- "sdk_mapped_flags.c"
> >- "low_power_pwm.c"
> >
> > pkg.ign_dirs:
> >- "deprecated"
> >
> > pkg.src_dirs:
> >- "src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/"
> >- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/"
> >- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/"
> >- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/
> low_power_pwm/"
> >
> > Error:
> > /Users/jacobrosenthal/Downloads/chippd3/bin/targets/
> split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_
> drivers_lf_pwm.a(lf_pwm.o):
> > In function `low_power_init':
> > /Users/jacobrosenthal/Downloads/chippd3/repos/
> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:127:
> > undefined reference to `low_power_pwm_init'
> > /Users/jacobrosenthal/Downloads/chippd3/repos/
> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:129:
> > undefined reference to `low_power_pwm_duty_set'
> > /Users/jacobrosenthal/Downloads/chippd3/repos/
> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:154:
> > undefined reference to `low_power_pwm_start'
> > /Users/jacobrosenthal/Downloads/chippd3/bin/targets/
> split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_
> drivers_lf_pwm.a(lf_pwm.o):
> > In function `lf_pwm_init':
> > /Users/jacobrosenthal/Downloads/chippd3/repos/
> mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:182:
> > undefined reference to `app_timer_init'
> > collect2: error: ld returned 1 exit status
> >
> >
> > On Sun, May 14, 2017 at 9:00 AM, will sanfilippo 
> wrote:
> >
> >> Jacob:
> >>
> >> Does the nrf51 have a PWM peripheral? I do not think it does. I looked
> at
> >> the chip spec and nrf51.h and there is no PWM peripheral like the nrf52
> in
> >> either.
> >>
> >>
> >>> On May 13, 2017, at 7:46 PM, Jacob Rosenthal 
> >> wrote:
> >>>
> >>> Im attempting to write a pwm api and nrf51 driver. Im mostly just
> >> stubbing
> >>> right now based on the adc driver, and have mynewt pwm driver stubbed,
> >> and
> >>> am now stubbing mynewt_nordic/hw/drivers/pwm_nrf51 which includes
> >>> nrf_drv_pwm.h and nrf_pwm.h from the sdk but thats giving tons of
> errors.
> >>>
> >>> Maybe something needs to be added to the mcu/nordic_sdk?
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> Error: In file included from
> >>> repos/apache-mynewt-core/libc/baselibc/include/inttypes.h:10:0,
> >>>
> >>>from
> >>> repos/apache-mynewt-core/hw/hal/include/hal/hal_bsp.h:27,
> >>>
> >>>from
> >>> repos/mynewt-nordic/hw/drivers/pwm/pwm_nrf51/src/pwm_nrf51.c:19:
> >>>
> >>> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
> >> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:56:39:
> >>> error: unknown type name 'NRF_PWM_Type'
> >>>
> >>>NRF_PWM_TASK_STOP  = offsetof(NRF_PWM_Type, TASKS_STOP),
> >>> ///< Stops PWM pulse generation on all channels at the end of the
> current
> >>> PWM period, and stops the sequence playback.
> >>>
> >>>  ^
> >>>
> >>> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
> >> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:57:39:
> >>> error: unknown type name 'NRF_PWM_Type'
> >>>
> >>>NRF_PWM_TASK_SEQSTART0 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[0]),
> >>> ///< Starts playback of sequence 0.
> >>>
> >>>  ^
> >>>
> >>> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
> >> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:58:39:
> >>> error: unknown type name 'NRF_PWM_Type'
> >>>
> >>>NRF_PWM_TASK_SEQSTART1 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[1]),
> >>> ///< Starts playback of sequence 1.
> >>>
> >>>  ^
> >>>
> >>> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_

Re: Writing PWM api, and nrf51 implementation

2017-05-14 Thread will sanfilippo
Not quite sure myself off the top of my head. I am not the best newt tool 
person. I can try to take a look at it later today if you cant figure it out 
before then.


> On May 14, 2017, at 10:00 AM, Jacob Rosenthal  wrote:
> 
> Good point. Ive obviously seen pwm implementaitons on nrf51 many times. Im
> guessing theyre using the 'low power pwm" driver I stumbled across that
> appears to be using the lfclk
> https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk51.v10.0.0%2Flow_power_pwm_example.html
> 
> Sameish question, I tried to port that example with the same problem, Im
> having trouble figuring out how to get newt to see the SDK files
> 
> I tried adding low_power_pwm to ign_files and  src_dirs
> 
> pkg.ign_files.BSP_NRF51:
>- "nrf_saadc.c"
>- "nrf_drv_saadc.c"
>- "nrf_drv_comp.c"
>- "nrf_drv_i2s.c"
>- "nrf_drv_pdm.c"
>- "nrf_drv_pwm.c"
>- "nrf_drv_spis.c"
>- "nrf_drv_twis.c"
>- "spi_5W_master.c"
>- "pstorage*"
>- "sdk_mapped_flags.c"
>- "low_power_pwm.c"
> 
> pkg.ign_dirs:
>- "deprecated"
> 
> pkg.src_dirs:
>- "src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/"
>- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/"
>- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/"
>- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/low_power_pwm/"
> 
> Error:
> /Users/jacobrosenthal/Downloads/chippd3/bin/targets/split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_drivers_lf_pwm.a(lf_pwm.o):
> In function `low_power_init':
> /Users/jacobrosenthal/Downloads/chippd3/repos/mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:127:
> undefined reference to `low_power_pwm_init'
> /Users/jacobrosenthal/Downloads/chippd3/repos/mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:129:
> undefined reference to `low_power_pwm_duty_set'
> /Users/jacobrosenthal/Downloads/chippd3/repos/mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:154:
> undefined reference to `low_power_pwm_start'
> /Users/jacobrosenthal/Downloads/chippd3/bin/targets/split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_drivers_lf_pwm.a(lf_pwm.o):
> In function `lf_pwm_init':
> /Users/jacobrosenthal/Downloads/chippd3/repos/mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:182:
> undefined reference to `app_timer_init'
> collect2: error: ld returned 1 exit status
> 
> 
> On Sun, May 14, 2017 at 9:00 AM, will sanfilippo  wrote:
> 
>> Jacob:
>> 
>> Does the nrf51 have a PWM peripheral? I do not think it does. I looked at
>> the chip spec and nrf51.h and there is no PWM peripheral like the nrf52 in
>> either.
>> 
>> 
>>> On May 13, 2017, at 7:46 PM, Jacob Rosenthal 
>> wrote:
>>> 
>>> Im attempting to write a pwm api and nrf51 driver. Im mostly just
>> stubbing
>>> right now based on the adc driver, and have mynewt pwm driver stubbed,
>> and
>>> am now stubbing mynewt_nordic/hw/drivers/pwm_nrf51 which includes
>>> nrf_drv_pwm.h and nrf_pwm.h from the sdk but thats giving tons of errors.
>>> 
>>> Maybe something needs to be added to the mcu/nordic_sdk?
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Error: In file included from
>>> repos/apache-mynewt-core/libc/baselibc/include/inttypes.h:10:0,
>>> 
>>>from
>>> repos/apache-mynewt-core/hw/hal/include/hal/hal_bsp.h:27,
>>> 
>>>from
>>> repos/mynewt-nordic/hw/drivers/pwm/pwm_nrf51/src/pwm_nrf51.c:19:
>>> 
>>> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
>> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:56:39:
>>> error: unknown type name 'NRF_PWM_Type'
>>> 
>>>NRF_PWM_TASK_STOP  = offsetof(NRF_PWM_Type, TASKS_STOP),
>>> ///< Stops PWM pulse generation on all channels at the end of the current
>>> PWM period, and stops the sequence playback.
>>> 
>>>  ^
>>> 
>>> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
>> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:57:39:
>>> error: unknown type name 'NRF_PWM_Type'
>>> 
>>>NRF_PWM_TASK_SEQSTART0 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[0]),
>>> ///< Starts playback of sequence 0.
>>> 
>>>  ^
>>> 
>>> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
>> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:58:39:
>>> error: unknown type name 'NRF_PWM_Type'
>>> 
>>>NRF_PWM_TASK_SEQSTART1 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[1]),
>>> ///< Starts playback of sequence 1.
>>> 
>>>  ^
>>> 
>>> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
>> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:59:39:
>>> error: unknown type name 'NRF_PWM_Type'
>>> 
>>>NRF_PWM_TASK_NEXTSTEP  = offsetof(NRF_PWM_Type, TASKS_NEXTSTEP)
>>> ///< Steps by one value in the current sequence if the decoder is set to
>>> @ref NRF_PWM_STEP_TRIGGERED mode.
>>> 
>>>  ^
>>> 
>>> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
>> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:69:4

Re: Writing PWM api, and nrf51 implementation

2017-05-14 Thread Jacob Rosenthal
Good point. Ive obviously seen pwm implementaitons on nrf51 many times. Im
guessing theyre using the 'low power pwm" driver I stumbled across that
appears to be using the lfclk
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk51.v10.0.0%2Flow_power_pwm_example.html

Sameish question, I tried to port that example with the same problem, Im
having trouble figuring out how to get newt to see the SDK files

I tried adding low_power_pwm to ign_files and  src_dirs

pkg.ign_files.BSP_NRF51:
- "nrf_saadc.c"
- "nrf_drv_saadc.c"
- "nrf_drv_comp.c"
- "nrf_drv_i2s.c"
- "nrf_drv_pdm.c"
- "nrf_drv_pwm.c"
- "nrf_drv_spis.c"
- "nrf_drv_twis.c"
- "spi_5W_master.c"
- "pstorage*"
- "sdk_mapped_flags.c"
- "low_power_pwm.c"

pkg.ign_dirs:
- "deprecated"

pkg.src_dirs:
- "src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/"
- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/"
- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/"
- "src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/low_power_pwm/"

Error:
/Users/jacobrosenthal/Downloads/chippd3/bin/targets/split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_drivers_lf_pwm.a(lf_pwm.o):
In function `low_power_init':
/Users/jacobrosenthal/Downloads/chippd3/repos/mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:127:
undefined reference to `low_power_pwm_init'
/Users/jacobrosenthal/Downloads/chippd3/repos/mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:129:
undefined reference to `low_power_pwm_duty_set'
/Users/jacobrosenthal/Downloads/chippd3/repos/mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:154:
undefined reference to `low_power_pwm_start'
/Users/jacobrosenthal/Downloads/chippd3/bin/targets/split-central-misfit-flash/app/hw/drivers/lf_pwm/hw_drivers_lf_pwm.a(lf_pwm.o):
In function `lf_pwm_init':
/Users/jacobrosenthal/Downloads/chippd3/repos/mynewt-nordic/hw/drivers/lf_pwm/src/lf_pwm.c:182:
undefined reference to `app_timer_init'
collect2: error: ld returned 1 exit status


On Sun, May 14, 2017 at 9:00 AM, will sanfilippo  wrote:

> Jacob:
>
> Does the nrf51 have a PWM peripheral? I do not think it does. I looked at
> the chip spec and nrf51.h and there is no PWM peripheral like the nrf52 in
> either.
>
>
> > On May 13, 2017, at 7:46 PM, Jacob Rosenthal 
> wrote:
> >
> > Im attempting to write a pwm api and nrf51 driver. Im mostly just
> stubbing
> > right now based on the adc driver, and have mynewt pwm driver stubbed,
> and
> > am now stubbing mynewt_nordic/hw/drivers/pwm_nrf51 which includes
> > nrf_drv_pwm.h and nrf_pwm.h from the sdk but thats giving tons of errors.
> >
> > Maybe something needs to be added to the mcu/nordic_sdk?
> >
> >
> >
> >
> >
> >
> > Error: In file included from
> > repos/apache-mynewt-core/libc/baselibc/include/inttypes.h:10:0,
> >
> > from
> > repos/apache-mynewt-core/hw/hal/include/hal/hal_bsp.h:27,
> >
> > from
> > repos/mynewt-nordic/hw/drivers/pwm/pwm_nrf51/src/pwm_nrf51.c:19:
> >
> > repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:56:39:
> > error: unknown type name 'NRF_PWM_Type'
> >
> > NRF_PWM_TASK_STOP  = offsetof(NRF_PWM_Type, TASKS_STOP),
> > ///< Stops PWM pulse generation on all channels at the end of the current
> > PWM period, and stops the sequence playback.
> >
> >   ^
> >
> > repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:57:39:
> > error: unknown type name 'NRF_PWM_Type'
> >
> > NRF_PWM_TASK_SEQSTART0 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[0]),
> > ///< Starts playback of sequence 0.
> >
> >   ^
> >
> > repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:58:39:
> > error: unknown type name 'NRF_PWM_Type'
> >
> > NRF_PWM_TASK_SEQSTART1 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[1]),
> > ///< Starts playback of sequence 1.
> >
> >   ^
> >
> > repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:59:39:
> > error: unknown type name 'NRF_PWM_Type'
> >
> > NRF_PWM_TASK_NEXTSTEP  = offsetof(NRF_PWM_Type, TASKS_NEXTSTEP)
> > ///< Steps by one value in the current sequence if the decoder is set to
> > @ref NRF_PWM_STEP_TRIGGERED mode.
> >
> >   ^
> >
> > repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
> 11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:69:43:
> > error: unknown type name 'NRF_PWM_Type'
> >
> > NRF_PWM_EVENT_STOPPED  = offsetof(NRF_PWM_Type, EVENTS_STOPPED),
> >///< Response to STOP task, emitted when PWM pulses are no longer
> > generated.
> >
> >   ^
> >
> > repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_
> 11.0.0_89

Re: Writing PWM api, and nrf51 implementation

2017-05-14 Thread will sanfilippo
Jacob:

Does the nrf51 have a PWM peripheral? I do not think it does. I looked at the 
chip spec and nrf51.h and there is no PWM peripheral like the nrf52 in either.


> On May 13, 2017, at 7:46 PM, Jacob Rosenthal  wrote:
> 
> Im attempting to write a pwm api and nrf51 driver. Im mostly just stubbing
> right now based on the adc driver, and have mynewt pwm driver stubbed, and
> am now stubbing mynewt_nordic/hw/drivers/pwm_nrf51 which includes
> nrf_drv_pwm.h and nrf_pwm.h from the sdk but thats giving tons of errors.
> 
> Maybe something needs to be added to the mcu/nordic_sdk?
> 
> 
> 
> 
> 
> 
> Error: In file included from
> repos/apache-mynewt-core/libc/baselibc/include/inttypes.h:10:0,
> 
> from
> repos/apache-mynewt-core/hw/hal/include/hal/hal_bsp.h:27,
> 
> from
> repos/mynewt-nordic/hw/drivers/pwm/pwm_nrf51/src/pwm_nrf51.c:19:
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:56:39:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_TASK_STOP  = offsetof(NRF_PWM_Type, TASKS_STOP),
> ///< Stops PWM pulse generation on all channels at the end of the current
> PWM period, and stops the sequence playback.
> 
>   ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:57:39:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_TASK_SEQSTART0 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[0]),
> ///< Starts playback of sequence 0.
> 
>   ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:58:39:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_TASK_SEQSTART1 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[1]),
> ///< Starts playback of sequence 1.
> 
>   ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:59:39:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_TASK_NEXTSTEP  = offsetof(NRF_PWM_Type, TASKS_NEXTSTEP)
> ///< Steps by one value in the current sequence if the decoder is set to
> @ref NRF_PWM_STEP_TRIGGERED mode.
> 
>   ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:69:43:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_EVENT_STOPPED  = offsetof(NRF_PWM_Type, EVENTS_STOPPED),
>///< Response to STOP task, emitted when PWM pulses are no longer
> generated.
> 
>   ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:70:43:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_EVENT_SEQSTARTED0  = offsetof(NRF_PWM_Type,
> EVENTS_SEQSTARTED[0]), ///< First PWM period started on sequence 0.
> 
>   ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:71:43:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_EVENT_SEQSTARTED1  = offsetof(NRF_PWM_Type,
> EVENTS_SEQSTARTED[1]), ///< First PWM period started on sequence 1.
> 
>   ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:72:43:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_EVENT_SEQEND0  = offsetof(NRF_PWM_Type, EVENTS_SEQEND[0]),
>///< Emitted at the end of every sequence 0 when its last value has
> been read from RAM.
> 
>   ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:73:43:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_EVENT_SEQEND1  = offsetof(NRF_PWM_Type, EVENTS_SEQEND[1]),
>///< Emitted at the end of every sequence 1 when its last value has
> been read from RAM.
> 
>   ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:74:43:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_EVENT_PWMPERIODEND = offsetof(NRF_PWM_Type,
> EVENTS_PWMPERIODEND),  ///< Emitted at the end of each PWM period.
> 
>   ^
> 
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h:75:43:
> error: unknown type name 'NRF_PWM_Type'
> 
> NRF_PWM_EVENT_LOOPSDONE= offsetof(NRF_PWM_Type, EVENTS_LOOPSDONE)
>///< Concatenated sequences have been played the requested number of
> times.
> 
>   ^
> 
> In file included from
> repos/mynewt-nordic/hw/mcu/nordic_sdk/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pwm/nrf_drv_pwm.h:30:0,
> 
>