ECIO40P16 and Programatically Changing the Clock Speed

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

ECIO40P16 and Programatically Changing the Clock Speed

Post 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

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: ECIO40P16 and Programatically Changing the Clock Speed

Post by kersing »

You could use the underlying chip in your project, that would allow you to set the clock speed.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: ECIO40P16 and Programatically Changing the Clock Speed

Post 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

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: ECIO40P16 and Programatically Changing the Clock Speed

Post 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.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: ECIO40P16 and Programatically Changing the Clock Speed

Post by Brendan »

Good thought !
Thank you.

Best regards,
Brendan

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ECIO40P16 and Programatically Changing the Clock Speed

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

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: ECIO40P16 and Programatically Changing the Clock Speed

Post 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

Post Reply