Page 1 of 1

ECIO40P16 and Programatically Changing the Clock Speed

Posted: Sun Feb 26, 2017 2:22 am
by Brendan
I'm using an ECIO40P16 module to train a college student, the project involving a range of I2C coupled sensors, TTL232 to a radio module, battery charging circuit, and batteries.

To characterise sensor responses for later embedded settings, the first phase will be to USB-program and power the ECIO module from Vbus in the conventional way, allowing sensors data to be rapidly sampled and streamed via USB to the host computer for analysis. For this purpose, all default ECIO40P16 register settings can remain of-course.

The problem is then powering the unit from batteries (normal operating mode) following sensor characterisation, where a 140MHz PLL-multipled clock (ECIO configuration) will consume excessive battery current. Running on batteries, USB will no longer be required, but there'll be a need to switch back-and-forth between batteries and USB/Vbus as the project develops. It would arguably be possible to use two ECIO40P16 modules - one dedicated to USB characterisation and the other for ICSP programming, but the PCB socket for the ECIO module will doubtless be worn out before finished.

So as not to trash the bootloader (and therefore the default ECIO configuration supporting USB) by ICSP programming, I could perhaps disable the PLL to run at the Xtal speed of 8MHz by a start-up register mod in a C block, but can I also programatically declare the reduced clock speed to Flowcode (which remains greyed-out) from within the project?

Many thanks,
Brendan

Re: ECIO40P16 and Programatically Changing the Clock Speed

Posted: Sun Feb 26, 2017 4:41 pm
by kersing
You could use the underlying chip in your project, that would allow you to set the clock speed.

Re: ECIO40P16 and Programatically Changing the Clock Speed

Posted: Sun Feb 26, 2017 5:33 pm
by Brendan
Thanks Kersing.

I believe I've had a brain-crash...

Initially I'd thought about sensing the status of RE2 (Vbus presence) and resetting registers accordingly in code - which sent me off at a tangent. For some reason, working into the small hours, I'd fixated on the notion that the ECIO40P16 target must be selected to load an image via the ECIO bootloader.

Stupid me :roll:

Best regards,
Brendan

Re: ECIO40P16 and Programatically Changing the Clock Speed

Posted: Sun Feb 26, 2017 5:59 pm
by kersing
You might want to check the linker/compiler options to make sure the code starts at the right location when not using the ECIO40P16 profile.

Re: ECIO40P16 and Programatically Changing the Clock Speed

Posted: Sun Feb 26, 2017 6:05 pm
by Brendan
Good thought !
Thank you.

Best regards,
Brendan

Re: ECIO40P16 and Programatically Changing the Clock Speed

Posted: Mon Feb 27, 2017 12:27 pm
by Benj
Hello,

Your in luck, the ECIO40P16 device has it's bootloader in the extended memory. So your program using the raw chip doesn't need to do anything special and it will work with the bootloader. These 16-bit PIC EP devices are very cool 8)

Note the only hoop you will have to jump through is manually programming using mLoader.

The mLoader tool is located here in the Flowcode installation.

"Flowcode 7/Tools/mLoader/mLoader.exe"

Re: ECIO40P16 and Programatically Changing the Clock Speed

Posted: Mon Feb 27, 2017 2:21 pm
by Brendan
Thank you Ben - that's great news.

Yes, they are cool - very cool indeed 8)

These 16-bit ECIO boards have to-date found ready application in a variety of internal applications - and now for training projects.

Small and discreet; powerful MCU; USB Vbus regulated on-board with 3V3 out; readily-configurable USB Vcom debug interface; programming simplified by bootloader; ~70 mips; plenty of flash and RAM for most projects; high-speed clock simplifying hi-res PWM filters and fast I2C in (ahem) software mode; 0.1" connective interface for hand-prototyped boards... and so-on.

I guess you can tell I've a soft-spot for them :D

Best regards,
Brendan