Migrating to a newer device . . .
HavenTechnik is an embedded solutions design consultancy and products provider. www.haventechnik.com (c) 2020, HavenTechnik

Migrating to a newer device . . .

When a design and a system works, especially an embedded one, there is a high degree of reluctance to migrate or change to a new device. Standalone and single-purpose systems incur a level of resources, changing anything in the design can negatively affect the project workings.

On the upside, changing the micro controlling system functions may be at the demand of necessary advantages. Advances in device features, silicon manufacturing technology, and stock availability may induce strong reason especially if it saves money. In embedded design, every resource counts from a single memory address to an I/O pin. Extrapolated across a production run, small elements have major consequences.

A recent project feasibility study for a solar-powered charger revealed this comparing the PIC16F785 vs the newer PIC16F1709 there was, to begin with, a price point disparity of approximately ~R7 / device. Given the cost-sensitive nature of the project, the reduced cost in using what is effectively a drop-in replacement, the decision was taken to migrate the design.

For a feature, side by side comparison you can view the two devices on Microchip's website

Migrating Code

While I will not go into all of the design specifics, for IP's sake I will discuss one element of the migration that has been tricky. Since the PIC16F1709 has additional ie more features packed in the same footprint, peripherals are multiplexed on the same PINS. The PIC16F1709 also has remappable pins. Remappable being those pins that can be redirected from a default to a designated pin.

As with most PICs, the first step would be to 1) Disable the analogs, 2) Switch of the comparators, and then configure the PWM outs. We are using the PWMs to drive the LED lights which are draw power from the battery.

While the remappable pin library is well documented in the Mikroe help file, we did run into a snag where since version 7.2 there were known issues with the remappable library, which can be viewed here Mikroe Forum.

While this may have seemed like a serious issue with the decision to migrate the device, a quick email to the Mikroe support desk resulted in a new library for the remappable PWM being supplied and a code sample that got the problems solved and us back on track.

Remappable Libray

This was my first project using a device with this feature and it requires that it be enabled the in Library manager and referred to in the code. Seeing as we are using both the PWM outputs, both were declared.

PPS_Mapping_NoLock(_RC4, _OUTPUT, _CCP1);

PPS_Mapping_NoLock(_RC5, _OUTPUT, _CCP2);

No alt text provided for this image

And then configuring the device requires that it's referred to as remappable:

PWM1_Remappable_Init(5000);

PWM1_Remappable_Start();

PWM1_Remappable_Set_Duty(startDuty);

The code is available in the Mikroe Forum if you want to obtain a copy.

Conclusion

While initially there was some apprehension to move to the newer device, the outcome has shown that working with the various industry stakeholders does enable easy device migration. In other words, if you do hit a snag don't panic look for the help that you need.

It is still early stages, however, the migration has not been too hectic and it's subsequently evident that we have made a good decision.

#microchip #mikroe


要查看或添加评论,请登录

Michael Havenga的更多文章

  • Changing Times - Not recommended for new designs . . .

    Changing Times - Not recommended for new designs . . .

    I often get responses from LinkedIn members commenting on the PIC development boards, and then saying how they have…

  • When do I Invoice . . .

    When do I Invoice . . .

    Some more thoughts from business meetings . .

  • Monetization: What that means for my project

    Monetization: What that means for my project

    Your project is done, and after a screencap and a quick description written in Notepad, you create a LinkedIn post…

  • The Practical Economics of Push Button UI

    The Practical Economics of Push Button UI

    Introduction Stand in front of your coffee machine, each element on the front panel has a cost implication. Some models…

    1 条评论
  • Update your 8 BIT Micro to a 32 BIT Alternative?

    Update your 8 BIT Micro to a 32 BIT Alternative?

    The arrival of the 32-bit operating system and the subsequent advent of the 64-bit operating system has opened up…

    5 条评论
  • Development Board Evolution

    Development Board Evolution

    Lead in: A little nostalgia, and then a look at the new #STATICXV3 (18) If you stretch your memory back, and you were…

  • Mikro Pro Compilers: How does the AI fit in?

    Mikro Pro Compilers: How does the AI fit in?

    If like me you are or were looking for an affordable and easy-to-use high-level language compiler for your PIC…

  • Home Vs Office - Which?

    Home Vs Office - Which?

    Working from home was always deemed the ideal perk or concession when looking for a new job. When the new company…

  • Purpose Built PIC Development Platforms

    Purpose Built PIC Development Platforms

    Over the last while, I have progressively uploaded PCB designs that I have done over the years. It was quite an…

  • To shed or not to shed...ready for the next round?

    To shed or not to shed...ready for the next round?

    With load shedding in and out of our lives, how used to it we have become. True we get irritated and complain, or…

社区洞察

其他会员也浏览了