Created Fri, 02 Sep 2016 16:24:38 +0000 by Ulysses
Fri, 02 Sep 2016 16:24:38 +0000
I'm bringing up a board with a processor in this family. I think it would be a hoot to have the chipkit core running on it. I am running 1.3.1 What I've got working so far:
PPS appears to be working: when I check the result of mapPps it gives me the expected values for the pin and function type. (i.e. true if the function is available on the mapped pin, false if it isn't)
The problem: I can't get analogWrite to output PWM on my OC pins. When I try analogWrite(MY_OC_PIN, 128) I get nothing out. When I try analogWrite(NOT_AN_OC_PIN, 128) the non-OC pin turns on. From reading wiring_analog.c this implies that the library is successfully figuring out that OC is supported on the pin and my mapping is basically correct. I've been through all the files for boards in the variants directory that use PPS and I can't figure out what I'm doing wrong. I noticed though that there aren't any supported boards with a mx370 family (330/350/370/430/450/470) processor.
I still suspect a subtle PPS problem. The UART is mapped on boot so subsequent attempts to map it through PPS might be failing silently with no effect. I haven't tried the SPI bus yet.
I'm really banging my head here. The chipkit variants files are verbose and not the most straightforward things but after the fortieth time through them there's really not that much to them either. Has the MX370 support been tested on actual hardware? Is there a variants file set for this hardware?
Thanks
Mon, 24 Oct 2016 12:51:59 +0000
Hi Ulysses! I don't know of any 370 based board that are currently working, so you're (a little bit) in uncharted waters here.
It seems unlikely to me that the PPS hardware is different in the 370 as compared with, for example, the MX1/2 family, which is working. But there could be some subtle difference nobody's noticed until now that we need to take into account.
If you manually do the mapPPS() calls before hand, does that allow the analogwrite() to work?
See, for example : [url]https://github.com/fubarino/fubarino.github.com/wiki/Fubarino-Mini-pps[/url]
*Brian
Mon, 24 Oct 2016 15:28:52 +0000
One thing to watch out for is to ensure that the "only allow one remap of PPS" bit is not set in the config bits. With that set the chipKIT core will think that it has mapped the IO pin to the right function, but it won't actually have happened.