Hi CG,
I grabbed your code and added it to the mqx/examples/hello2.
I'm using the PEMicro Universal debugger but have also plugged in the OSBDM (after I had been debugging the project several times to make sure that CW was using the correct debugger interface) to enable a second serial interface (my primary serial interface is on the TWR-SER card (ttyd). I then modified the BSP user_config.h to #define ittyf 1 which is the OSBDM debugger interface. Use device manger to look at the "Ports" to determine what COM PORT it is using. My assumption is you are using the OSBDM debugger interface. If not that is OK too.
Once you modify the user_config.h always re-compile your RTOS.
I then played around with your code for a bit to get used to it and came up with the following conclusions:
- You are mixing baremetal code with RTOS code. Usually this doesn't work well and it did not work here for following reasons:
- The interrupt was triggering OK but the fstaus() and fgetc() function calls are to the RTOS drivers it is expecting to be working. Your insertion of your uart5_rx_tx_isr did this and therefore was not allowing the received UART character to be processed and placed into a fifo as the interrupt driver for the ittyf device wants to use, So the fstatus() call would not see a character in the UART interrupt fifo and never call the fgetc(). If commenting out the fstatus() then the fgetc() call also is looking for a character on the fifo, doesn't see one present and then suspends the task (usually not a good thing when calling from a interrupt service routine.
- The hack I did was to use your code to enable the UART to generate an interrupt when a character is received and then baremetal code read UART Status 1 register followed by read of receive buffer of the UART to clear interrupt flag and get the character.
Attached is the code. To restore it to the hello2 original source change #define .CUSTOMER_CODE 0.
To run modified code to see your baremetal code receive a character change #define CUSTOMER_CODE 1.
Important steps for testing as I didn't use the best mqx/examples project as it only runs through the code/task once. Set multiple breakpoints after your code initializes the ttyf interface and one in the isr. Once breakpoint hit, then in your OSBDM terminal window type ONE character, hit Resume/Go Run (whatever you like to call it) and you should hit the breakpoint in the interrupt service routine or see the typed character echoed back to OSBDM terminal.
Summary: Don't mix baremetal code with MQX RTOS code. Do one or the other.
Hope this helps,
David