However, I'm not finding any documentation on this, or on how setup the H3 timer with settings equivalent to H1/H2.
What a surprise!
Here is one "gotcha" that I found when converting from Hv2 to Hv3.
In Hv2 I created a millisecond timer with a callback. In the app.c init section I used:
void tmrcallback(uintptr_t context, uint32_t currtick); // the prototype
void tmrcallback(uintptr_t context, uint32_t currtick)
appData.appstate = APP_STATE_EVENT;
In the run-time loop, I used:
#define PERIODMS 1
appData.sysTmrHandle = SYS_TMR_CallbackPeriodic(PERIODMS,1,tmrcallback);
Note: In the Timer Driver setup for timer 0, the timer is linked to TMR_ID_2 and the interrupt vectors, etc.
For Hv3, the period is a microsecond value, thereby requiring a 32-bit number and you must tie the timer to a specific hardware timer (i.e. TMR_2 configured as a 32-bit timer) so in Hv3 I used:
void TMR_CallbackFn (uintptr_t context ); // the prototype - note there is only 1 arg in Hv3
void TMR_CallbackFn (uintptr_t context )
clkData.clkstate = CLKS_STATE_EVENT;
Now, if you look in the interrupt code, the interrupt vectors are linked to TMR_3 (because of the 32-bit value).
#define PERIODMS 99999 // microseconds*100 = 1 ms for a 100 MHz CPU
TMR2_Stop(); // not sure if this is needed
TMR2_PeriodSet(PERIODMS); // Set the period (ms)
TMR2_Start(); // Start the timer
This is one of many differences that have to be tracked down when converting to Hv3. I am trying to do this in a new book that shows how to implement the same examples as my MZ book, especially how to use the USB and TCP/IP libraries in Hv3. So far I have stumbled on a lot of issues in the USB CDC library.
To make matters worse, the Curiosity Dev 2.0 boards I have received from MicrochipDirect do not work. I have has a trouble ticket in for almost 2 months with no solution. There is one post on this forum that says the Dev 2.0 board from DigiKey works, so I am waiting to try that one. When I get a working board, I can (hopefully) finish my book, including documentation on the how and why of the USB and TCP/IP libraries.
post edited by BillP - 2019/12/28 11:06:55