Hot!MCC for PIC24EP256GP202 does not set Interrupt on change

Author
Maldus
Starting Member
  • Total Posts : 47
  • Reward points : 0
  • Joined: 2016/08/17 09:55:57
  • Location: 0
  • Status: offline
2018/10/12 00:57:52 (permalink)
0

MCC for PIC24EP256GP202 does not set Interrupt on change

I'm working on a PIC24EP256GP202 and I needed to enable the interrupt on change on the B15 pin.
I wanted to use MCC since it seems to be the official and updated way to properly work with PICs; unfortunately it doesn't work.
 
Setting the IOC on "any" in the pin module interface (and enabling the CNI interrupt in the interrupt module) leads to a generated pin manager like such
 

void PIN_MANAGER_Initialize(void)
{
    [...]
    /****************************************************************************
     * Interrupt On Change for group CNENB - any
     ***************************************************************************/
    CNENBbits.CNIEB15 = 0; // Pin : RB15

    IEC1bits.CNIE = 1; // Enable CNI interrupt
}

/* Interrupt service routine for the CNI interrupt. */
void __attribute__ (( interrupt, no_auto_psv )) _CNInterrupt ( void )
{
    if(IFS1bits.CNIF == 1)
    {
        // Clear the flag
        IFS1bits.CNIF = 0;
    }
}

 
This leads to the interrupt never being fired. I had to look into the generated code and study the datasheet for myself, which completely defeats the purpose of a code generator. Also, the fact that the documentation for the IOC is limited to a measly and cryptic paragraph ( Device Datasheet , 11.3) doesn't help.
 
Apparently the
 
It's not the first time I find similar problems with MCC, and I ofted have to opt out of using it after realizing it's not worth the trouble. When is it expected to be a fully functioning and reliable tool?
#1

7 Replies Related Threads

    pr.mchp
    New Member
    • Total Posts : 25
    • Reward points : 0
    • Joined: 2015/03/23 06:20:48
    • Location: 0
    • Status: offline
    Re: MCC for PIC24EP256GP202 does not set Interrupt on change 2018/10/12 02:02:39 (permalink)
    0
    Please mention the version of MCC, where you are facing this issue. Also could you please share the .mc3 file.
     
    MCC currently has 1.75.1v available on web.
     
    Using this latest version and with the settings what you are referring, the code generated is as below.


    /****************************************************************************
    * Interrupt On Change for group CNENB - any
    ***************************************************************************/
    CNENBbits.CNIEB15 = 1; // Pin : RB15
    IEC1bits.CNIE = 1; // Enable CNI interrupt
    #2
    Maldus
    Starting Member
    • Total Posts : 47
    • Reward points : 0
    • Joined: 2016/08/17 09:55:57
    • Location: 0
    • Status: offline
    Re: MCC for PIC24EP256GP202 does not set Interrupt on change 2018/10/12 03:01:19 (permalink)
    0
    Mighty strange, from the MPLABx plugin manager it appears my MCC version is 3.65.1, not really in line with the one "on the web".
     
    I've attached my config file
    #3
    davekw7x
    Entropy++
    • Total Posts : 1573
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: MCC for PIC24EP256GP202 does not set Interrupt on change 2018/10/12 09:26:28 (permalink)
    0
    Maldus
    I've attached my config file

    After some few years of "barefoot" programming of Microchip MCUs and peripheral modules, I am getting more and more "into" MCC, so I am verrrry interested in anomalies. I haven't had problems with this chip and MCC version.
     
    The .mc3 file  might shed some light for some people, but since it doesn't let me create a project with your settings I can't see your problem.
     
    Could you package your project (or some smaller but complete project) and post the zip file?
     
    Bottom line:
    I get proper IOC generation with my PIC24EP256GP202; can't see your setup, so can't compare.
     
    MPLABX version 5.05, MCC plugin version 3.65.1
     
    Regards,

    Dave
     
    post edited by davekw7x - 2018/10/12 09:37:07

    Sometimes I just can't help myself...
    #4
    Howard Long
    Super Member
    • Total Posts : 422
    • Reward points : 0
    • Joined: 2005/04/04 08:50:32
    • Status: offline
    Re: MCC for PIC24EP256GP202 does not set Interrupt on change 2018/10/12 09:27:13 (permalink)
    5 (2)
    Maldus
    I'm working on a PIC24EP256GP202 and I needed to enable the interrupt on change on the B15 pin.
    I wanted to use MCC since it seems to be the official and updated way to properly work with PICs; unfortunately it doesn't work.
     
    ....
     
    It's not the first time I find similar problems with MCC, and I ofted have to opt out of using it after realizing it's not worth the trouble. When is it expected to be a fully functioning and reliable tool?



    I avoid using MCC, while it _might_ help a noob with a trivial proof of concept, I personally find it gets in the way. Examples: forces you into a code layout strait jacket; makes it difficult to maintain code, it's frequently buggy.
     
    You'll need to refer to the datasheet anyway, I just don't see the point of MCC for almost all real world use cases.
    #5
    Maldus
    Starting Member
    • Total Posts : 47
    • Reward points : 0
    • Joined: 2016/08/17 09:55:57
    • Location: 0
    • Status: offline
    Re: MCC for PIC24EP256GP202 does not set Interrupt on change 2018/10/13 13:30:28 (permalink)
    0
    Could you package your project (or some smaller but complete project) and post the zip file?

    I'm interested as well. I've attached the full project; you can see the generated code, tell me if by running MCC you get a different result.
     

    I avoid using MCC, while it _might_ help a noob with a trivial proof of concept, I personally find it gets in the way. Examples: forces you into a code layout strait jacket; makes it difficult to maintain code, it's frequently buggy.
     
    You'll need to refer to the datasheet anyway, I just don't see the point of MCC for almost all real world use cases.

    Considering it doesn't work yes, I'll avoid it as well. I've tried using it in four projects now, and every time I've had similar problem.
    If it did work however it would be a great tool; on the contrary, I think it would be useful precisely for people that already know how a PIC works. I've worked with, say, UART bare handed before; I know the details and studied the datasheet; MCC could spare me the hassle of dealing with the small differences in register names and configuration for a different device. Most of the times I don't care for the details  and wouldn't mind having less control of the code.
     
    All in all, the fact that Microchip offers nothing in terms of development libraries and tools is utterly ridicolous. Their products may be reliable and cheap from an electrical point of view, but from a developer's perspective working with them is a nightmare.
    post edited by Maldus - 2018/10/13 13:32:21
    #6
    davekw7x
    Entropy++
    • Total Posts : 1573
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: MCC for PIC24EP256GP202 does not set Interrupt on change 2018/10/14 15:46:24 (permalink)
    5 (1)
    Maldus
    ...I've attached the full project...

    Thank you for sharing.
     
    Here's my take on it...
    I started to open your project in MPLABX version 5.05.  It asked whether I wanted to update from older version of MPLABX, so I said no.

    So...
    I opened your project in MPLABX version 4.20 and started MCC.  (MCC plugin version 3.55.1 is installed)

    Sure enough...
    Pin Module "Easy Setup" showed RB15 with IOC "any" but the Registers window of the Pin Module showed CNIEB15 as "Disabled," which is consistent with the statement you showed in the generated pin_manager code.  I selected IOC "none" in the Pin Module and verified that the generated pin_manager.c file does not have a statement for CNIEB15.

    Now...
    I have found that (sometimes) when I manually change something in the "Registers" view of an MCC module, future changes in the "Easy Setup" do not override the previous setting.  (Not just the Pin Module)
    So if, somehow, one of the register settings was changed (maybe inadvertently by the user or maybe by some bug in MCC) things got out of sync.  In this case changing the IOC to "none" and back to "any" had no effect.  (Sometimes things like this make a difference;  this time it didn't.)

    So here's what I did next...
    In the Pin Manager Grid View, I removed RB15 as a GPIO input (by clicking the padlock) of RB15  in the GPIO line, then added it back.
    In the MCC Interrupt Module window, I checked the "Enabled" box for CNI and in the Pin Module "Easy Setup" window, I selected "any" for RB15. Now when I look at CNIEB15 in the CNENB register in the Pin Module "Registers" window, it shows "enabled"

    And...
    The generated pin_manager.c now has

        CNENBbits.CNIEB15 = 1; // Pin : RB15

        IEC1bits.CNIE = 1; // Enable CNI interrupt


    Note that I did not have this particular problem with a "fresh build" of an MCC project for this chip with MPLABX version 5.05 (MCC plugin 3.65.1)  Same for adding IOC functionality to a previous project in version 5.05.  I didn't try manual changes to see if they screw the pooch.  (There is a limit to my so-called spare time.)

    Bottom line: Don't know whether this is an easily repeatable (and therefore 'easily' fixable) bug in MCC, but I think the MCC guys have been very, very responsive in overcoming problems like this when you give them details of your dilemma.


    Regards,

    Dave
    post edited by davekw7x - 2018/10/14 15:57:47

    Sometimes I just can't help myself...
    #7
    Maldus
    Starting Member
    • Total Posts : 47
    • Reward points : 0
    • Joined: 2016/08/17 09:55:57
    • Location: 0
    • Status: offline
    Re: MCC for PIC24EP256GP202 does not set Interrupt on change 2018/10/15 02:23:23 (permalink)
    0

    Now...
    I have found that (sometimes) when I manually change something in the "Registers" view of an MCC module, future changes in the "Easy Setup" do not override the previous setting.  (Not just the Pin Module)

    I've had the same feeling about it. This has happened several times to me, but now it was about a pretty simple function (IOC) and I was sure there was no fault on my side. Thanks for taking the time to try to reproduce it.
     
    Maybe I should update MPLAB to v5.05 as well to see if this happens less frequently; I really shouldn't have to though, since I want to ensure I can still work with older projects.
     

    Bottom line: Don't know whether this is an easily repeatable (and therefore 'easily' fixable) bug in MCC, but I think the MCC guys have been very, very responsive in overcoming problems like this when you give them details of your dilemma.

    I realize I sound very salty, but that's because I am very salty about Microchip.
    Whenever I work with their software it seems everything has a pretty high chance of breaking down, and while I'm trying to deliver a working application I don't have time to fix their tools as well.
    Also, the global feeling on the forums about those problems seems to be "nothing they give you works, so you should do everything on your own to be safe", which is just disheartening.
     
    Maybe next time I find myself in a similar situation I'll take the time to put together a clear bug report. Honestly though I really doubt the "very responsive" part. I've been on this forum sporadically for two years now, and I wrote ~50 posts. Looking at moderators delivering MCC news and discussing on the forums they have on average 100 total posts written. That's not what I call active community service.
     
    Maybe I just have bad luck with bugs, but I've had a lot of similar experiences with Microchip IDE, compiler and plugins.
    #8
    Jump to:
    © 2018 APG vNext Commercial Version 4.5