I have been distracted again by my life, but integration does go on, just slowly. I soldered down the RN4020 module to the prototype. It works, sort of. It is flaky on starting, as in sometimes it starts and sometimes it doesn't. There is no true power on reset pin. All of the control pins are under PIC32 control and the start sequence is the same as all of the other RN4020 equipped systems I have done. Not to mention that the PIC32 firmware doesn't always start. And to make life even more fun, attaching the various serial ports cause issues. See this post for serial ports.
Using the debugger and the console output seemed to cause different scenarios. The PICKit3 especially caused different things to happen. But what I did notice was the code seemed to be caught in an interrupt loop for the BT UART. Part of the problem was the Harmony initializing code. I have always cleared all of the flags before enabling the interrupts and disabling any interrupts that dont have ISRs. Well only part of that was happening.
There are 3 interrupts for the UART, these are Tx, Rx and ERROR. First the flags were not being cleared until the UART was opened, but at that point the interrupts were already enabled in the SYSTEM_INIT module. Also the ISRs are not registered until the after the UART is opened. The list goes on. Again this is a problem with Harmony when you have multiple peripherals, mostly interrupt driven, the order of instantiation has to be carefully reviewed.
I carefully went through the order, made sure the flags were always cleared when going through the interrupt. Now it is more stable, though we are not still where the PIC18F25K50 firmware is. This still needs more analysis. I suspect I need to implement an UART ERROR ISR, just to see what is happening.
No comments:
Post a Comment