Forums - Hardware PWM vs. PIO PWM

7 posts / 0 new
Last post
Hardware PWM vs. PIO PWM
Alan
Join Date: 30 Jun 16
Posts: 14
Posted: Mon, 2016-07-25 14:44

Short version: where is the detailed, register level, hardware documentation?  I've seen postings (back in 2014) referring to a CD in the development kit, but my didn't have a CD.
 
I need detailed documentation of the CSR101x PWM operation.  Reading through the example code, there are two ways of setting up the PWM outputs: 1) using the PIO and "Hardware PWM".

Ultimately: what I want to do is to set up two (or more) PWM outputs that are guaranteed to be maximally out of phase.  

Help is very much appreciated!

  • Up0
  • Down0
cbs
Profile picture
Join Date: 4 Mar 15
Location: IoT consultant, Cambridgeshire, UK
Posts: 21
Posted: Tue, 2016-07-26 07:37

Hi Alan,

There is API documentation in the SDK but no register level documentation has ever been made available I'm afraid.

Depending on the frequency/resolution you require for your PWM you might want to consider using the PioController (it's an on-chip 8051) to create custom I/O. It is clocked at 16MHz and isn't used at all by the Bluetooth subsystem so with appropriate programming it is capable of everything the "Hardware PWM" does (resolution ~30us) and more.

There are a few 8051 examples in the SDK. Get in touch if you need some pointers.

Chris

 

  • Up0
  • Down0
Alan
Join Date: 30 Jun 16
Posts: 14
Posted: Tue, 2016-07-26 18:22

Thanks Chris!

I hadn't fully understood the architecture.

Recapping:

  • - There is a 8051 coprocessor that shares memory starting at PIO_CONTROLLER_DATA_WORD.
  • - It can be clocked off of the 32kHz or 16MHz, giving much finer control.
  • - I don't need deep sleep, so I can use the 16MHz clock.
  •  

Assuming I can dust off my assembly skills, I could rewrite the asm code in the csr_mesh_light example to do something like what I want. Is the downloaded code the only thing running on this processor?  Aside from watching the outputs with a scope, is there a mechanism for debugging?

A followon question: If I'm running my own assembly in this 8051 controller, does that disable other functions?  For example, AIO on other pins?  I guess I'm still confused as to how the controller fits into the picture.

 

 

  • Up0
  • Down0
cbs
Profile picture
Join Date: 4 Mar 15
Location: IoT consultant, Cambridgeshire, UK
Posts: 21
Posted: Wed, 2016-07-27 02:21

Hi Alan,

I think the 8051 operates in three modes:

* Clock off - in this mode nothing is running so no current is consumed. This is the default state.

* Clock as XAP - in this mode, 32kHz when the XAP processor is in sleep but 16MHz when it wakes up. This is a bit of a surprise when your 8051 code start running 500 times faster - especially if you've hand crafted a timing loop with no-ops

* Clock fixed 16MHz - in this mode, always 16MHz even when XAP is in sleep. This is called "shallow sleep" because it uses marginally more current than deep sleep.

I'm only aware of the 8051 being able to access the digital I/O - but as I said earlier documentation is extremely lacking so that's just gleaned from examples plus a bit of experimentation. You need to configure each I/O pin as controlled by the 8051.

I've used the 8051 for all sorts of things - SPI is popular but perhaps the most gratuitous was a 1MHz clock generator... it saved adding an oscillator chip to the board which trimmed a few cents off the BOM.

Best Regards,

Chris

  • Up0
  • Down0
glenn1
Join Date: 2 Sep 16
Posts: 4
Posted: Fri, 2016-10-28 12:19

Alan,

Assuming I understand what you mean by "maximally out of phase," can you just invert one of the PIOs?  That would guarantee 180 degrees out.

I share your frustration about no register documentation.  I have an issue with changing PIO functionailty.  Between the poor demo code and no register documentation I can't seem to get it done.

Glenn

  • Up0
  • Down0
ander454
Join Date: 8 Jun 16
Posts: 5
Posted: Fri, 2017-09-08 11:51

I'm wondering if it would be technically possible to use the 8051 to reset the device?  Meaning, does it have access to the software reset register?  And if you know this software reset register address, would it be possible to share?  If not, I suppose I could reverse engineer the WarmReset() function, but that will take some time.

 

Why am I asking this question?

I'm finding some issues where a device gets stuck in low level CSR code (not application level) and the watchdog never resets the device.  Only way to get it working again is to power cycle.  So, it seems to me I could write a real robust watchdog using the 8051.  What are your thoughts?

  • Up0
  • Down0
Dr. Nissim Zur
Profile picture
Join Date: 6 Jun 16
Location: Skype: nissim.test CSR1010 External design house
Posts: 235
Posted: Sat, 2017-09-09 09:24

Call my Skype nissim.test and I will give you an NPN transistor act as a 3v3 switch, so the 8051 pin can close and open CSR1010 power. 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.