2016/01/05 11:02:12
GeorgePauley
With the release of MPLAB X 3.20 simulator users now have the ability to create simulator specific plug-ins!
 
These plug-ins allow the simulator to be customized in many ways.  Users can implement missing peripherals that are critical to their applications, or they can replace existing peripherals with their own implementations. Plug-ins can be used to implement complex register and pin injections with much more capability than stimulus or SCL can provide.  They can also be used to create sophisticated register and pin tracing functionality far beyond the capabilities offered by Microchip's most sophisticated hardware tools.  And these are just the ideas that Microchip has come up with.  We can't wait to see what the simulator community dreams up!
 
To get started download the MPLAB X 3.20 SDK from http://www.opensource4pic.org and navigate to the Simulator Programmer's Guide portion of the documentation.  (Even if you have no intention of writing a simulator plug-in this document is worth reading to get a better understanding of the simulator architecture and capabilities.)

In addition we have added a category to http://www.embeddedcodesource.com for simulator plug-ins for users to share (or even sell) useful plug-ins they have created.  Microchip has already placed a few example plug-ins up there to help get you started.

This has been a dream goal of the simulator team for about 2 years now and we're excited to finally go live with this functionality.  We can't wait to see what you guys do with it!  Make us proud! 
2016/01/07 07:15:32
Alexander Kots
I have downloaded MPLAB X 3.20 SDK.
Installation procedure guide says that I have to use NetBeans IDE as development program.
I have already NetBeans IDE 8.0.1 (with JDK 1.8.0_25), so next step is to set  MPLAB X IDE as a Platform.
I opened Java Platform Manager and then press Add Platform button.
Guide says I have to select folder ...\mplab-ide of MPLAB X IDE installation folder and press Next.
I select it, but Next button remains grayed, meaning NetBeans IDE does not recognize this folder as a Platform folder.
I have selected also all other folders or subfolders (there is a mplab-ide inside mplab-ide), but Next remains grayed.
 
Any idea what is going wrong?
 
2016/01/07 09:32:11
GeorgePauley
I think you want to set MPLAB X IDE as a NetBeans platform, not a Java platform.
2016/01/07 11:10:40
Alexander Kots
Yes, that's right.
But I can't find a menu to add NetBeans Platforms, only Java Platforms is available.
 
2016/01/07 12:15:45
GeorgePauley
OK, that is Odd.  I've attached what my NetBeans Tools menu looks like.  You're does not have a NetBeans Platform selection?  I wonder if you didn't download a Java enabled NetBeans?  (See attachment from NetBeans download page.)

Attached Image(s)

2016/01/07 15:58:37
Alexander Kots
Silly of me!
I had not activated "Developing NetBeans" plugin ...
All OK ...
2016/01/08 08:33:08
Alexander Kots
I am trying to implement a "smart" plug-in to simulate UART I/O (for PIC24F series), using existing UART simulator.
In MPLABX 3.20, we have to do a Stimulus -> Register Injection with a file, setting Trigger as Message and Format as Pkt.
This action is not specified in MPLABX SDK (or I can't find it).
The actions we can perform to a SFR object, is write() that can't be used because it is Read-Only, and privilegedWrite() that can write data to any register.
I suppose that this will have same results as using Stimulus -> Pin/Register Actions, that is not injecting data to UART.
There is also available a Peripheral object for each UART. In that a PeripheralObserver can be added, in order to monitor any changes. But there is not any "inject" function.
So how Stimulus -> Register Injection action can be implemented in Java, in a byte to byte controlled procedure?
Is there any "special" class for UARTs that we should use?
 
Finally I Have to mention that there is not any Reference Help for SDK (like that for Android). 
We should have a tree of all Classes, as also some info for each constant, variable and method.
(There is a list of them in .../MPLAB_X/doc/Simulator/index.html but it does not seems to be complete)
 
2016/01/08 08:42:50
GeorgePauley
Injecting to a register is done through SCL.  There is a section in the SDK about how to attach to SCL.  There is also an SCL User's manual which ships with MPLAB X.  You can find it in the docs sub-directory of your MPLAB X installation.
 
If you to the Java API References of the SDK (first page) you can get those class references you want.  Unfortunately, it looks like all of those links are broken in the current SDK.  Further it looks like the Javadocs didn't even get installed with the API.  I'll have to wait until our build/install guy gets in later to find out what the heck is going on.  You'll likely have to re-download and install the SDK at some point in the future when we get these links fixed.
 
BTW:  Once you get the SCL object, your data is going to come in via an SCL RegisterInjection.  The SCL code that stimulus generates is pretty crazy.  You might want to set it up in stimulus, then have stimulus generate an SCL file so you can see what needs to be done on the SCL side.
2016/01/08 19:26:49
Alexander Kots
As I have found for UART data injection in "MPLAB X Problem with Stimulus and UART1 on PIC24F" (), using SCL command packetin is enough. 
But it is a little annoying the procedure we have to do each time some data has to be fed in UART Rx:
- Create a "full" SCL string like
 
testbench for "abc" is 
begin
process is
variable data_line : line := "xyz";
begin
packetin(data_line, U1RXREG, true);
wait;
end process;
end testbench;
 
- Send it by scl.append(new StringReader(scl_string)); 
- scl.run();
 
- Next time scl.reset() to clear previous "file", create new text, etc ...
 
I don't know what SCL does to perform command packetin, but I think this should be included as a method of SFR Java Class.
Any way I will try SCL Class to see how system responds ...
 
2016/07/14 20:36:23
Eric Christenson
alexkots
Silly of me!
I had not activated "Developing NetBeans" plugin ...
All OK ...


That step, "Activating" the plugin, is missing from the instructions and definitely needs to be added to the SDK user's guide document.  It certainly tripped me up!
 
What I would like to see in an example is something to run formal code tests automatically.  For example, suppose the spec for my system is that within 10 cycles of a sine wave of more than 1 volt and between 10 and 100 cycles per second, LED1 on the RG12 output pin should turn on.  How would I build a test that could be run automatically as part of a suite of tests to show that my latest code update hasn't broken that or 25 other important system specifications?
 
12
© 2021 APG vNext Commercial Version 4.5

Use My Existing Forum Account