Dual Harmony UARTs Configured Differently
I recently had to deal with using two USARTs that were configured diferently, also did this with two timers. Harmony does not easily allow this. Here is the short of what I am trying to do. USART #2 is setup as the console port. This is only to be used during code development and has limited value in the final product. USART #1 is used as the interface to the Bluetooth Module. This interface is critical to the operation of the device.
The system console port is setup as basically described in this document The USART is setup as a static driver that is blocking. This is the simplest setup possible and thus has the fewest dependencies. At this point this implementation has been integrated for a while. Changing it now would require a lot of changes I am not interested in attempting.
The BT Module serial interface needs to be very responsive. In the original device (PIC18F implementation), this was an interrupt driven process on the Rx side and a blocking function on the Tx side. The Tx was limited to 4 bytes at a time, though. This USART will also be a static implementation, interrupt driven with call backs. This will allow for Tx and Rx buffers to be used to move the data in and out of the BT Module. Of the three transfer models described here the byte-by-byte model seemed the best to use. I created a project with the system console/debugger implemented and then tested it. Once it was working, I created a second project with USART #1 setup as STATIC, Interrupt and callbacks. Once that was working, I manually merged the second project into the first. Then tested that merged project. That final project is attached to this post.
I wont go into the details of the issues I had to overcome here. If anyone is interested, go to mymakertools on blogspot.com. It will also describe how the dual timer issue was solved. The reason for this approach was that then larger project already has multiple peripherals and 100s of lines of code changes to source code that Harmony manages. It is beyond using the harmony configurator at this point.
Just a few details, PIC32MX470F512L, Harmony 2.06 and a custom board and I used the BSP. Cannot guarantee that the code is bug free, but it worked for me. Also I could not get the links to work, so you will have to go to the blog if you want to see them.
post edited by jcwhit54 - 2020/07/13 16:01:22