After giving up on this about a year and a half ago I came back to it tonight and I still can't get the PWM.h library to compile for this chip.
Every other chip option I have will compile just fine but not this one.
Can anyone help? I'd hate to have to upgrade to the MEGA just so I can get this code to compile. I'd be happy to PayPal $100 to the first person who can give a solution.
Thanks!
Here are the errors that are being thrown out when it tries to compile
error: 'SetPinFrequency' was not declared in this scope
error: 'pwmWriteHR' was not declared in this scope
Which arduino pwm library are you using ?
Github is littered with all varieties of these.
Since these will directly manipulate hardware registers, these will be dependent on the specific MCU.
The output valve is a 6V6GT although the only vacuum tube stuff I've done recently is a Nixie clock.
I guess I could fix the library so it accepts the 1284 and compiles, but can't test it on a physical board. Are you prepared to do the testing to check out the functionality ?
Is the 1284 the only board you've tried the example code on with the "MightyCore" ?
I've already had to make a fix it so it compiles with a recent IDE with the standard core. It looks like that could be a similar problem as that with the "miniCore". That I'll test myself.
OK. I got it to compile with the minicore using a 328 board.
You should be able to unpack the zip and compile the example .ino it within the folder because the modified library parts are in the sketch folder and it will take those in preference to those parts in the standard library location.
The original library is not compatible with modern IDEs
[this crossed with your post. Let me know how you want to carry on]
I restructured it to compile with all 3 cores I tried it with (standard, mini and mighty) and the 1284 and 1284P just with the mighty core.
The functionality testing I have to leave to you.
Let me know how you get on.
6v6gt:
I restructured it to compile with all 3 cores I tried it with (standard, mini and mighty) and the 1284 and 1284P just with the mighty core.
The functionality testing I have to leave to you.
Let me know how you get on.
This is a summary of the main findings and more or less what I did.
The original library uses a recursive include structure.
The IDE is not really compatible with putting sub folders in the sketch folder (which is the standard way of testing unmanaged libraries before adding these to the main library folder)
I tried to avoid changes which may have caused existing code to break.
eliminated recursive #includes but introduced some duplication
Added 1284 support. The library supports 2 basic AVR groups with similar timer configuration
groupA 2x8bit, 4x16bit and groupB 2x8bit and 1x16bit. The 1284/1284p has 2x8bit and 2x16bit so it did not exactly fit in but I treated it as groupB AVR which means 1 16 bit timer is ignored. The groups are simply defined by the core board definition e.g. AVR_ATmega88P
The library uses some direct memory addressing of timer registers instead of using the defined mnemonics. This is somewhat error prone, but I checked the datasheets of the groupB MCUs against the 1284 and these addresses appear to correspond for the timers used. However, this requires careful testing with the 1284 to ensure that there are no surprises.
You are right that I made an error in PWM.h which would have affected the groupA boards. It happened after a late phase of restructuring after my main tests. Well spotted. For completeness, I am including the updated software.
Anyway, if you have any problems let me know and I'll see what I can do.
Personally, if I want to do something like altering the PWM frequency (or duty cycle, PWM mode etc.), I would simply refer to the data sheet for the timer registers of the specific MCU and code accordingly, but I see the advantages of such a library for those who don't want to go down to that depth and @RunnerUp has done a great job here. Of course now the Arduino platform is supporting many different varieties of architectures including even new AVR architectures so making and maintaining a completely universal library would be quite an ambitious undertaking.