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!
Hardware PWM vs. PIO PWM
Posted: Mon, 2016-07-25 14:44
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
Thanks Chris!
I hadn't fully understood the architecture.
Recapping:
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.
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
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
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?
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.