• AVR Freaks

Hot!Getting started with using the dsPIC33CH Curiosity demo code

Author
dvtronic
New Member
  • Total Posts : 22
  • Reward points : 0
  • Joined: 2018/10/19 05:51:28
  • Location: 0
  • Status: offline
2019/08/13 14:40:10 (permalink)
0

Getting started with using the dsPIC33CH Curiosity demo code

I couldn't find any postings on this topic, which surprised me. I'm sorry if this has been asked before.

Are there any instructions on how to compile and use the demo code?  I couldn't find any at www.microchip.com/dspic33chcuriosity.

The master project requires a slave.h file, which appears to be the one in slave.X/dist/default/production.  Compiling the slave project causes this file to be wiped out though, which doesn't make a lot of sense. I figured that I should ask for some guidance before proceeding too far down this path.

Is there a tutorial somewhere?
#1

13 Replies Related Threads

    du00000001
    Just Some Member
    • Total Posts : 3064
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/13 14:53:31 (permalink)
    0
    Virtually anything is available  :)
    Although not every resource is linked for easy access  :(
     
    Start here:
    https://microchipdeveloper.com/16bit:ch-overview

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #2
    dvtronic
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2018/10/19 05:51:28
    • Location: 0
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/13 14:59:25 (permalink)
    0
    Thanks so much. I'll look at this tomorrow. 
     
    I wish they'd make these things easier to find.
     
    #3
    du00000001
    Just Some Member
    • Total Posts : 3064
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/13 17:49:58 (permalink)
    5 (1)
    Once you know about microchipdeveloper ...

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #4
    davekw7x
    Entropy++
    • Total Posts : 1827
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Second star on the right, straight on till morning
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/13 18:25:18 (permalink)
    5 (2)
    dvtronic
    Are there any instructions on how to compile and use the demo code?



    I assume you found the demo code itself.
     
    Well here's the deal:
    Unzip the demo code file in some convenient MPLABX project directory.

    There will be two project directories: master.X and slave.x

    Plug in a USB cable from your PC to the Curiosity USB connector J20.

    Invoke MPLABX and open the "master" project.  For MPLABX version 5.15 (and probably some others) you will get an "Upgrade Project" dialog box. Click "Yes" to continue.

    For starters, don't open the "slave" project.  Don't do anything else just yet.

    It looks like these files were more-or-less gleaned from an MCC project, but this is not an MCC project (no .mc3 file).  So, do not (that's NOT) open MCC for this one.

    Under Project->Properties, select your Starter Kits (PKOB) -> dsPIC33CH Curiosity board.  Depending on the default XC16 for your MPLABX installation, you may need to pick a particular version of XC16.  I'm using .36B

    When you compile the "master" project, it is set up so that it will also compile the "slave" project.  It re-creates the slave.h and slave.s that it needs to be able to compile the "slave" project..
     
    ============Important information here===================
                                           |
                                           |
                                           v
    Now, here's the thing they don't tell you: Having upgraded from some previous MPLABX version, there is some leftover junk that you will (probably) have to get rid of before you can build.
    Under the master.X directory there is a "build" subdirectory and a "default" directory under that.  Outside of MPLABX, delete everything under the "build" directory.  Heck, you can delete the "build" directory also.  (See Footnote)
                                           ^
                                           |
                                           |
    ============Important information here===================

    Now do a "Clean and Build Project" for the master:
    If you look at the output you will see that it builds both the "master" stuff and the "slave" stuff.

    In the middle of all that output there is this line:
    main.c:31:9: note: #pragma message: Connect USB-UART port on board to your PC and set COM port to: 230400 baud, 8-bit, 1 stop.

    Plug another USB cable from your PC to the other micro USB connector on the Curiosity board. Open a terminal emulator (putty, minicom, whatever) at 230400 baud

    I attached a screen shot of the terminal output.  Twist the Potentiometer shaft to see some changes in the terminal output and in LED color.  Click some switches and see the designated functionality

    Now before you start futzing around with the settings I would suggest you follow the tutorial here: https://microchipdevelope...-for-dual-core-devices
    to see how to use MCC to create your very own master-slave project. Start with that simple example.  Go through every detail.
    Then get back to the demo, and maybe you can understand how the heck it's organized.  I don't know of any functional documentation other than the source code.

    Regards,

    Dave

    Footnote: It is completely asinine that whoever set up this demo project zip file has stuff in a build directory (and a lot of other stuff not needed for a fresh build.  Why the heck didn't they just do an MPLABX "package" function?  All of that other crap wouldn't have been carried along.  They could have put in the original hex file as a separate part of the zipped package.
    post edited by davekw7x - 2019/08/13 18:44:21

    Attached Image(s)


    Sometimes I just can't help myself...
    #5
    dvtronic
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2018/10/19 05:51:28
    • Location: 0
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/14 06:28:19 (permalink)
    0
    Holy cow, that worked! Thanks.

    I agree that this should have been a clean package.  Also, why aren't these instructions available conveniently -- in the readme.txt file, at the very least?
    #6
    dvtronic
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2018/10/19 05:51:28
    • Location: 0
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/14 06:35:00 (permalink)
    0
    Also, the fact that you have to dig through those messages to find the required UART settings is ridiculous.
     
     
    #7
    dvtronic
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2018/10/19 05:51:28
    • Location: 0
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/14 07:00:23 (permalink)
    0
    BTW, how does the master know how to compile the slave project?  I'd like to rename these projects, so figuring that out would be important.
     
     
    #8
    du00000001
    Just Some Member
    • Total Posts : 3064
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/14 07:23:38 (permalink)

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #9
    dvtronic
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2018/10/19 05:51:28
    • Location: 0
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/14 07:29:35 (permalink)
    0
    Thanks. I think I figured out the slave compilation issue, but when I attempt to run the code, I encounter the following message:


    Target Device ID (0x7d540000) is an Invalid Device ID. Please check your connections to the Target Device.
    Failed to program device
     
    What's going on?  Again, this is just the unaltered demo code.
    #10
    dvtronic
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2018/10/19 05:51:28
    • Location: 0
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/14 08:25:54 (permalink)
    0
    I just saw that the demo code is for the dsPIC33CH128MP508, and my boards use the dsPIC33CH512MP508.  When I change the settings under Project->Properties to use the dsPIC33CH512MP508 though, the code doesn't compile.

    Any hints on how I should proceed?
     
    #11
    dvtronic
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2018/10/19 05:51:28
    • Location: 0
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/14 09:15:07 (permalink)
    0
    Dang it. I figured that compilation issue out, but I hit another wall.

    I saw how the source code is hardcoded to use the dsPIC33CH128MP508 header file, and so I changed those references to use the dsPIC33CH512MP508.  There really should have been instructions in this regard -- or better yet, a pre-processor symbol could have been used to identify the MCU type and select the appropriate header file.  Nuts.

    The proper target device is being detected now, but I'm now getting the following error:
     
    The following memory area(s) will be programmed:
    program memory: start address = 0x0, end address = 0x3dff
    Failed to program device
     
    I'm certain that my USB cable is good, so what else could be going wrong?
    #12
    du00000001
    Just Some Member
    • Total Posts : 3064
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/14 09:40:25 (permalink)
    0
    Oh yeah - the experienced hobbyist  wink: wink
     
    I'd expect the "standard way" (select your derivative in the project properties, then #include <xc.h>) to work for these derivatives just as for the majority of at least PIC10/12/16/18/24 and dsPIC* derivaties.
     
    What other's may have (mis-)done: I don't know. But the solution is widely communicated - including these forums.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #13
    du00000001
    Just Some Member
    • Total Posts : 3064
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Getting started with using the dsPIC33CH Curiosity demo code 2019/08/14 09:43:27 (permalink)
    0
    Failed to program device

    • power supply too low or unstable?
    Provided you're on the Curiosity board, a weak USB port might not supply enough power to the board. Or the board's settings are . . . who knows . . .
     
     

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #14
    Jump to:
    © 2019 APG vNext Commercial Version 4.5