I have added the DBG_PRINTF function to the Dev Info Service Project. Please find it attached.
The things I have modified are:
(i) Copied the UART Component in the cysch file in the Battery Level project to cysch file of Dev Info Service Project
(ii) In the system Tab in cydwr file, the Heap Size is incresed to 0x400 (to accomodate more complexity)
(iii) In the Pins Tab in cydwr file, make sure th UART RX and TX pins are mapped to P1.4 and P1.5 pins respectively. (On the pioneer kit, these pins are only connected to a USB - UART Converter)
(iv) Copy the debug.c file in the BatteryLevel project and paste it to the Dev Info Service Project
(v) Have a common main.h header file to link the debug.c file and main.c file. (So that main.c file may use the DBG_PRINTF function defined in debug.c)
(vi) In the main function in main.c, call UART_DEB_Start () API to start the UART.
You can now add the DBG_PRINTF function anywhere in your code to test the flow of the code. The Baud rate is 115200
Thanks for your instructions.
Of course the issue I have now is that the UART and BLE don't want to play together! The UART baud rate and bits/char do not seem to match what they are set to. The UART receiver's baud rate can no doubt cope with a large difference to that set, but the bits/char seem not to be 8 as requested - which means the terminal output is jibberish.
I also had a similar issue sending some debug data from some BLE related functions over the UART. Just looked like garbage. One thing I realized was that the sleep modes were causing my issues with the UART data. In my case the sleep was tightly coupled with the BLE timing and couldn't be disabled easily. So I put a CyDelay(10) statement directly after sending the debug data. This allowed the UART time to send everything in the buffer and it worked fine. Not saying this is a solution one should leave in production code, but for a temporary debug output statement it got the job done.
Thanks very much. It works for me too.
As you say, probably not ideal to leave in after debugging is complete (I wonder will mine ever be).