Helpful ReplyWhere is the Harmony documentation?

Page: 12 > Showing page 1 of 2
Author
dlindbergh
Super Member
  • Total Posts : 477
  • Reward points : 0
  • Joined: 2006/09/11 18:17:11
  • Location: Boston USA
  • Status: offline
2015/05/14 18:12:14 (permalink)
0

Where is the Harmony documentation?

Just starting out with Harmony (been using plib for a decade).
 
I went thru the pin configurator thing, asked it to setup RE2 and RB10 as digital outputs (both set low), and hit Generate.
 
I now have this in sys_ports_static.c:
void SYS_PORTS_Initialize(void)
{
    /* AN and CN Pins Initialization */
    PLIB_PORTS_AnPinsModeSelect(PORTS_ID_0, SYS_PORT_AD1PCFG, PORTS_PIN_MODE_DIGITAL);
    PLIB_PORTS_CnPinsPullUpEnable(PORTS_ID_0, SYS_PORT_CNPUE);
    PLIB_PORTS_CnPinsEnable(PORTS_ID_0, SYS_PORT_CNEN);
    PLIB_PORTS_ChangeNoticeEnable(PORTS_ID_0);
   
    /* PORT B Initialization */
    PLIB_PORTS_OpenDrainEnable(PORTS_ID_0, PORT_CHANNEL_B, SYS_PORT_B_ODC);
    PLIB_PORTS_Toggle( PORTS_ID_0, PORT_CHANNEL_B, SYS_PORT_B_LAT);
 PLIB_PORTS_DirectionOutputSet( PORTS_ID_0, PORT_CHANNEL_B, SYS_PORT_B_TRIS ^ 0xFFFF);
    
    /* PORT E Initialization */
    PLIB_PORTS_OpenDrainEnable(PORTS_ID_0, PORT_CHANNEL_E, SYS_PORT_E_ODC);
    PLIB_PORTS_Toggle( PORTS_ID_0, PORT_CHANNEL_E, SYS_PORT_E_LAT);
 PLIB_PORTS_DirectionOutputSet( PORTS_ID_0, PORT_CHANNEL_E, SYS_PORT_E_TRIS ^ 0xFFFF);
}

I don't see any mention in there of RE2 or RB10 (or at least not 2 or 10).  And when I run the code, the PIC32 sets RE2 high (not low as requested).
 
Where is the documentation on what these functions do? And for the symbols used?
 
I found http://microchip.wikidot.com/harmony:documentation. It says there to click the "Harmony Help File" button there to get a PDF with the documentation, but all I get is "MPLAB Harmony Release Notes and Contents v1.04.02" (no docs there).
 
Where are the docs?
 
Is there a way click on these symbols/functions/macros in the IDE and get documentation that way?  (I haven't yet found a way.)
#1
bikeoid
Super Member
  • Total Posts : 168
  • Reward points : 0
  • Joined: 2010/04/30 05:58:38
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/14 19:39:25 (permalink) ☄ Helpfulby dlindbergh 2015/05/17 10:04:24
4.5 (2)
The help files should be located at 
* <install-dir>/doc/help_harmony.pdf
* <install-dir>/doc/html/index.html
* <install-dir>/doc/help_harmony.chm
, where install-dir is something like C:\microchip\harmony\v1_04_01\
 
The statements above initialize all bits on a port at once, rather than just the bits which have been explicitly defined.  For example, right click on SYS_PORT_B_TRIS  and select 'Navigate' / Go to Declaration.  Those definitions were created by MHC.
 
For your specific case, it may be a bug in Harmony in which it assumes an initial hardware state and doesn't initialize the ports properly.  Try adding a     LATE = 0; statement before SYS_Initialize() in Main.c.   That bug will be fixed in a future version of Harmony   - see http://www.microchip.com/forums/m862043.aspx
#2
arpananand
Super Member
  • Total Posts : 376
  • Reward points : 0
  • Joined: 2009/11/18 04:35:42
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/15 01:55:54 (permalink)
0
dlindbergh
I went thru the pin configurator thing, asked it to setup RE2 and RB10 as digital outputs (both set low), and hit Generate.


i dont think you can set initial state (high or low) of a pin through pin configurator, how exactly did u set them low?
#3
bikeoid
Super Member
  • Total Posts : 168
  • Reward points : 0
  • Joined: 2010/04/30 05:58:38
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/15 04:35:14 (permalink)
3 (2)
arpananand
 
i dont think you can set initial state (high or low) of a pin through pin configurator?



In 1.04 MHC, the initial pin states can be set by selecting the "Pin Table" tab below the main configurator screen, then the "Flags" button.   Or, right click on a pin in the graphical "Pin Diagram" and select "Flags".
#4
dlindbergh
Super Member
  • Total Posts : 477
  • Reward points : 0
  • Joined: 2006/09/11 18:17:11
  • Location: Boston USA
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/15 06:39:30 (permalink)
0
Thanks. I found the documentation.
 
The PDF is 8769 pages long.
 
Something is...wrong.
#5
bikeoid
Super Member
  • Total Posts : 168
  • Reward points : 0
  • Joined: 2010/04/30 05:58:38
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/15 08:05:43 (permalink)
3 (1)
dlindbergh
The PDF is 8769 pages long.

 
I find the .CHM much easier to search, use and digest than the PDF.
#6
realexander
Senior Member
  • Total Posts : 163
  • Reward points : 0
  • Joined: 2006/04/08 09:50:42
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/15 13:03:44 (permalink)
4.4 (5)
dlindbergh
The PDF is 8769 pages long.
 
Something is...wrong.



In defense of the manual, and at the risk of being a Pollyanna (which Dave has known me to be in the past :-) ):
  • The PIC32 Family Reference Manual has 52 sections. There are a lot of peripherals to cover, and Harmony implements a library for all (or nearly all) of them.
  • The Harmony manual combines a user guide and reference manual for each of those peripheral libraries.
  • It also includes porting guides and tutorials for many peripherals.
  • Harmony includes a lot more than just peripheral libraries. It has services similar to those an operating system would include: USB and TCP/IP stacks, a variety of USB device and host implementations, graphics library, message queues, file system, console, command processor, MP3 decoder, cryptography, and more. Microchip had a lot of this previously in the MLA, and if you combined the docs for all of them, it probably would rival Harmony's manual.
  • It also has libraries built atop some of the peripherals that provide higher-level functionality (just peruse the System Services section). 
  • Also included in the manual is info about Board Support Packages and 3rd party RTOSes.
  • There's info about the all-important Harmony Configurator (MHC).
There's even more in there. And it's not bloatware because you can choose whether or not it gets built into your project.
 
So there are good reasons for the manual to be so massive. I guess they could've split it up into separate manuals and it would be less ... alarming. But the manual is big because Harmony is big. And Harmony is big because PIC32s have about 52 different peripherals and there's a lot that can be done with them.
 
Twice, I have started and abandoned attempts to write my own microcontroller framework. I gave up both times because I soon realized what a monumental task it is to do it right, to make it complete, and to have it work on multiple devices. I applaud Microchip for attacking the problem. And despite some people who criticize Harmony as some sort of ivory tower Comp Sci project, out of touch with the real world, I think Microchip is doing it right. With the wide variety of PIC32s, there  has to be a code generator. With the wide variety of peripherals, there has to be a uniform architecture. Yes, there are shortcuts you could take if you didn't want a reusable, widely applicable library with lots of high-level services. My experience has been that when I take shortcuts in an architectural design, I live to regret it.
 
I find Harmony to be a good middle ground between PLIB and a Raspberry-Pi-style embedded Linux. If all you want is something like PLIB, then you'll definitely be shocked by the size of Harmony. I haven't tried this, but perhaps if you limit yourself to Harmony's Device Layer, you'll have something similar to PLIB in size, scope and complexity. But you'll be missing out on a lot of cool stuff.
 
And yeah, I know Harmony is still buggy and incomplete. I've wrestled with many of those issues and submitted a few bug reports myself. But I also see good progress with each release, a lot of useful functionality is already there, and as I've said above, I like the architecture.
 
- "Pollyanna" Bob
 
#7
DGTLMAN
Moderator
  • Total Posts : 71
  • Reward points : 0
  • Joined: 2010/03/15 10:23:31
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/19 07:56:53 (permalink)
0
Bob,
 
Thank you.

-DGTLMAN 
#8
realexander
Senior Member
  • Total Posts : 163
  • Reward points : 0
  • Joined: 2006/04/08 09:50:42
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/19 08:05:28 (permalink)
0
DGTLMAN
Bob,
 
Thank you.



You're welcome. But now comes the caveat: I'm unable to get a USB MSD+CDC device working from MHC and the documentation. If anything, that shows the need for MORE documentation (and if you have anything, like internal documentation, lying around that could help me with this, I'd appreciate it).
 
So yeah, I like your concept and your architecture, but it's too soon to rest on your laurels. :-)
 
- Bob
 
#9
dlindbergh
Super Member
  • Total Posts : 477
  • Reward points : 0
  • Joined: 2006/09/11 18:17:11
  • Location: Boston USA
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/19 08:15:17 (permalink)
2 (2)
For my part, after struggling with Harmony for a week or so, I've given up on it.
 
I could make a pin toggle or a LED blink with it, but not both at the same time.  (Project attached - it doesn't work.)
 
I'm going back to plib.
 
I may reconsider Harmony if/when it matures enough that things work without me having to debug the device files supplied by MCHP.  (Sorry, @DGTLMAN.)
#10
JNR
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2014/07/24 21:41:00
  • Location: Bangalore
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/20 03:02:43 (permalink)
0
The help for USB MSD+CDC device demo is available under the following section:
Applications Help > USB Demonstrations > Demonstrations > Device > cdc_msd_basic
 
#11
arpananand
Super Member
  • Total Posts : 376
  • Reward points : 0
  • Joined: 2009/11/18 04:35:42
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/20 04:21:32 (permalink)
0
dlindbergh
For my part, after struggling with Harmony for a week or so, I've given up on it.
 
I could make a pin toggle or a LED blink with it, but not both at the same time.  (Project attached - it doesn't work.)
 
I'm going back to plib.
 
I may reconsider Harmony if/when it matures enough that things work without me having to debug the device files supplied by MCHP.  (Sorry, @DGTLMAN.)




i just checked your attached project and it seems to be toggling, setting and clearing port pins correctly to me. can you please explain what exactly is your expectation from the given code which is not happening?
#12
Tez
Moderator
  • Total Posts : 477
  • Reward points : 0
  • Joined: 2006/10/04 11:09:05
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/20 05:42:26 (permalink)
0
Could you please post your MSD + CDC project. Let me take a look at it and find out whats wrong.
#13
Tez
Moderator
  • Total Posts : 477
  • Reward points : 0
  • Joined: 2006/10/04 11:09:05
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/20 05:43:25 (permalink)
0
realexander,
 
What more would like to see in the documentation? Your feedback would be helpful.
#14
dlindbergh
Super Member
  • Total Posts : 477
  • Reward points : 0
  • Joined: 2006/09/11 18:17:11
  • Location: Boston USA
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/20 07:20:39 (permalink)
0
arpananandi just checked your attached project and it seems to be toggling, setting and clearing port pins correctly to me. can you please explain what exactly is your expectation from the given code which is not happening?



I expect square-wave output on both pins, and I'm not getting it.  If I modify the code I can get square waves on either pin alone, but not on both at the same time.
 
I've moved on to something else for now, but I'll come back to this in a week or two and investigate more.
#15
realexander
Senior Member
  • Total Posts : 163
  • Reward points : 0
  • Joined: 2006/04/08 09:50:42
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/20 10:51:31 (permalink)
0
Hi Tez,
 
I've attached my attempt at creating a CDC+MSD project. I created it with MHC followed by pasting in code I found in the manual at Framework Help > USB Libraries Help > USB Device Library > USB Device Library - Getting Started > Creating Your Own USB Device. When I run it, the PC does not see a USB device.
 
Now, I know there's a lot missing; I can see that by comparing it with the demo projects. But getting this code working is only half of the issue. The other half is how I get it working. I don't want to have to reverse-engineer the demo, and I especially don't want to have to reverse-engineer it every time I upgrade to a new version of Harmony (I already have working code built from 1.03, but when I upgrade it to 1.04 it breaks).
 
You asked me what more I want from the docs. At the risk of getting mocked, I will say - without shame - that I want more hand-holding. I can say that without shame because hand-holding is Harmony's goal: to make it really easy to generate working applications that incorporate complex things like USB and TCP/IP stacks.
 
In the manual, "Creating Your Own USB Device" talks about APP_USBDeviceEventHandler, and a function event handler, and opening the device layer. It says "Refer to the Event Handling topic in the applicable function driver documentation" (although those topics do not exist in the manual!). The USB MSD documentation mentions "media drivers". I have not seen a definition of that; I imagine it includes the NVM driver and perhaps others, but I don't know. I haven't found documentation of the steps for connecting a USB MSD to a media driver.
 
Ideally, MHC should generate all that code. But until the MHC engineers can implement that, I would like to see step-by-step documentation about what code to add to the MHC-generated code to get a device working. I think each USB device - CDC, MSD, HID, etc. - needs something similar to (but more detailed than) the "Creating Your Own USB Device" section, with code excerpts for each function and code snippet the user needs to add. Cut the code from the demos you've already written and paste them into the manual with a sentence that says "put this function in app.c" or "put this function call in the APP_STATE_INIT state" or "edit the FOO structure initialization in system_init.c to initialize the following field". Have one of your QA engineers follow the manual's instructions to the letter and see if he ends up with a working app.
 
I hope this helps. And I hope you can help me get my USB CDC+MSD project working.
 
- Bob
 
#16
arpananand
Super Member
  • Total Posts : 376
  • Reward points : 0
  • Joined: 2009/11/18 04:35:42
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/20 11:19:08 (permalink)
0

 
I expect square-wave output on both pins, and I'm not getting it.  If I modify the code I can get square waves on either pin alone, but not on both at the same time.
 
I've moved on to something else for now, but I'll come back to this in a week or two and investigate more.




try few "Nopes" in between, its surprising if u r not getting both the square waves together. 
#17
dlindbergh
Super Member
  • Total Posts : 477
  • Reward points : 0
  • Joined: 2006/09/11 18:17:11
  • Location: Boston USA
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/20 11:25:26 (permalink)
3 (1)
arpananand
 
try few "Nopes" in between, its surprising if u r not getting both the square waves together. 



Really? Why?  I don't recall seeing any requirement in the datasheet for NOPs or delays between output port transitions.
 
I'll try it, but having using plib for 10 years, I never had to do that before.
 
Also, while I'm here - with plib, you'd pass a bit mask to the port, so you could manipulate any number of bits (on the same port) simultaneously.
 
For example, this would work:
 
mPORTASetBits(BIT_8 | BIT_10);  // from PIC32 Peripheral Libraries manual, page 99
 
From reading the code, it seems the values passed to the Harmony port libraries are enums (not masks), so you can't do that.
 
Which means there's no way to manipulate multiple bits simultaneously. (So it's slower, and limits what you can do re timing of events.)
 
Am I mistaken? Is there a workaround in Harmony for this?
#18
arpananand
Super Member
  • Total Posts : 376
  • Reward points : 0
  • Joined: 2009/11/18 04:35:42
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/20 11:42:40 (permalink)
0

 
Really? Why?  I don't recall seeing any requirement in the datasheet for NOPs or delays between output port transitions.
 
I'll try it, but having using plib for 10 years, I never had to do that before.

there is no such requirement, i told you to try that for debugging purpose. may be port transition was too fast to be captured in certain CRO setting (just a wild guess).
 

Also, while I'm here - with plib, you'd pass a bit mask to the port, so you could manipulate any number of bits (on the same port) simultaneously.
 
For example, this would work:
 
mPORTASetBits(BIT_8 | BIT_10);  // from PIC32 Peripheral Libraries manual, page 99
 
From reading the code, it seems the values passed to the Harmony port libraries are enums (not masks), so you can't do that.
 
Which means there's no way to manipulate multiple bits simultaneously. (So it's slower, and limits what you can do re timing of events.)
 
Am I mistaken? Is there a workaround in Harmony for this?


Harmony has "PLIB_PORTS_Set/Clear/Toggle" API for manipulating multiple port bits together. check the doc for exact usage.
#19
bikeoid
Super Member
  • Total Posts : 168
  • Reward points : 0
  • Joined: 2010/04/30 05:58:38
  • Location: 0
  • Status: offline
Re: Where is the Harmony documentation? 2015/05/20 12:04:48 (permalink)
3 (1)
dlindbergh
Which means there's no way to manipulate multiple bits simultaneously. (So it's slower, and limits what you can do re timing of events.)
 
Am I mistaken? Is there a workaround in Harmony for this?

There's PLIB_PORTS_Write(..), PLIB_PORTS_Set(..), PLIB_PORTS_Toggle(..)  to work with all bits together.
 
#20
Page: 12 > Showing page 1 of 2
Jump to:
© 2018 APG vNext Commercial Version 4.5