Debug with UART

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lechc_282591
Level 4
Level 4

Hello, I want to debug the SlaveFifoAsync example with UART. I found the setting process for debugging with JTAG in the programming manual. How could I debug it with UART? Are there some documents about debugging FX3 with UART?

   
    Thanks,   
   
    Lehua Chen   
0 Likes
6 Replies
Anonymous
Not applicable

Firmware is enabled to support UART debugging.

   

You can use " CyU3PDebugPrint" to print messages wherever you want.

   

Please make sure that your DVK has these jumpers (J101,102,103,104) between 1 and 2.

   

Regards,

   

sai krishna.

0 Likes
lock attach
Attachments are accessible only for community members.
lechc_282591
Level 4
Level 4

I know the UART debugging is supported in the firmware and CyU3PDebugPrint is used to print messages. But I do not know how to set the Debug Configurations. On my DVK, the jumpers (J101, 102, 103, 104) are connected correctly. The UART port is connected to a USB port with a converter. But when I tried to debug, there are always errors (shown in the attached picture). I think I did not set the Debug Configurations in the right way.

   
    But how?   
   
    Thanks,   
   
    Lehua Chen   
0 Likes
Anonymous
Not applicable

Hi Lehua Chen,

   

you don't have to do anything with the Eclipse IDE when you are debugging with UART.

   

Connect the UART cable between your DVK and PC.Open the HyperTerminal in your PC and configure it as follows:

   

115200 - 8 - None - 1 - None.

   

It is just that you add the print messages wherever you want in the firmware. And build the .img file and download into the FX3 DVK.

   

Then you will see the messages getting printed on the HyperTerminal as per the FX3s firmware execution.

   

Regards,

   

sai krishna.

0 Likes
lechc_282591
Level 4
Level 4

Thank you for your detailed information. I misunderstood the debug process with UART at the beginning. Now it is fine.

   

Lehua Chen

0 Likes
lechc_282591
Level 4
Level 4

I debugged the Asynchronous FIFO GPIF with UART. The hardware setting was as before.

   
    When I downloaded the firmware to the RAM, “Data tracker: buffers received: 0, buffers sent: 0” was showed in the Hyper Terminal.   
   
        
   
    In the USB Control Center, when I chose the Bulk out endpoint (0x01) and transferred Data-OUT (1024 Bytes or 10Bytes), “BULK OUT transfer completed” appeared. In the Hyper Terminal, “Data tracker: buffers received: 1, buffers sent: 0” was got. With UART debugger, I found that the CyFxSlFifoUtoPDmaCallback( ) was called for one time. Then I clicked “Transfer Data-OUT” again in the USB Control Center, I got “Data tracker: buffers received: 2, buffers sent: 0” and the CyFxSlFifoUtoPDmaCallback( ) was called again. After that, I clicked “Transfer Data-OUT” for the third time or more, “BULK OUT transfer failed with Error Code:997” was in the USB Control Center.  The CyFxSlFifoUtoPDmaCallback( ) would be not called any more and the Hyper Terminal always showed got “Data tracker: buffers received: 2, buffers sent: 0”.   
   
        
   
    When I chose the Bulk in endpoint (0x81) and transferred Data-IN (1024 Bytes or 10Bytes), I only got “BULK IN transfer failed with Error Code:997” in the USB Control Center. No change happened in the Hyper Terminal (repeating “Data tracker: buffers received: X, buffers sent: 0”) and the CyFxSlFifoPtoUDmaCallback( ) was never called.   
   
        
   
    Look forward to explanation and solution.   
   
    Thanks,   
   
    Lehua Chen   
0 Likes
Anonymous
Not applicable

  Hi Lehua Chen,

   

Below are my answers to your questions.     

   

If you look at the SlaveFifoAsync example source code, DMA buffer for USB to FX3 is configured for 2*1024 Bytes in case of super speed. That is the reason why you are able to do two BULK OUT transfers. If you change the      

   

dmaCfg.count = CY_FX_SLFIFO_DMA_BUF_COUNT; to      

   

dmaCfg.count = 16;     

   

then you can do 16 BULK OUT transfers.     

   

On the other hand if you look at the USBBulkSourceSink example, we are discarding the buffer as soon as we get some data from USB. CyU3PDmaChannelDiscardBuffer is called when there is CY_U3P_DMA_CB_PROD_EVENT. In this case you continuously send the data. But in SlaveFifoAsync example we are not doing this. So number of BULK OUT transfers are limited to dmaCfg.count.     

   

Coming to your next question, regarding BULK IN, again we can correlate both these examples - SlaveFifoAsync  and USBBulkSourceSink. In case of SlaveFifoAsync  example we are committing the data only when there is a CY_U3P_DMA_CB_PROD_EVENT. That is when GPIF fills the DMA buffer.     

   

Regards,     

   

sai krishna.      

0 Likes