- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like the "CyU3PDebugPrint" to be supported, and I would like to receive ASCII commands by the UART. My ASCII commands have different length.
I can see that "CyU3PDebugPrint" output to UART only support DMA mode.
When I select DMA mode my smallest buffer is 16 byte, and i can't find a way to get a "callback"/event before the buffer is full.
// Now create the DMA channel required for read.
CyU3PMemSet ((uint8_t *)&dmaConfig, 0, sizeof(dmaConfig));
dmaConfig.size = sizeof(RS232_rx_OutBuf);
dmaConfig.count = sizeof(RS232_rx_OutBuf);
dmaConfig.prodAvailCount = 0;
dmaConfig.dmaMode = CY_U3P_DMA_MODE_BYTE; // CY_U3P_DMA_MODE_BUFFER;
dmaConfig.prodHeader = 0;
dmaConfig.prodFooter = 0;
dmaConfig.consHeader = 0;
dmaConfig.notification = CY_U3P_DMA_CB_XFER_CPLT |
CY_U3P_DMA_CB_SEND_CPLT |
CY_U3P_DMA_CB_RECV_CPLT |
CY_U3P_DMA_CB_PROD_EVENT |
CY_U3P_DMA_CB_CONS_EVENT |
CY_U3P_DMA_CB_ABORTED |
CY_U3P_DMA_CB_ERROR |
CY_U3P_DMA_CB_PROD_SUSP |
CY_U3P_DMA_CB_CONS_SUSP;
dmaConfig.cb = CyFxUartLpDmaCallback;
dmaConfig.prodSckId = CY_U3P_LPP_SOCKET_UART_PROD;
dmaConfig.consSckId = CY_U3P_CPU_SOCKET_CONS;
apiRetStatus = CyU3PDmaChannelCreate (&glUartLpChHandle, CY_U3P_DMA_TYPE_MANUAL_IN, &dmaConfig);
Poul-Erik.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you looked at the UART examples that comes along with FX3 SDK.
Please have a look at the "UartLpDmaMode" example. This example gets 32 bytes of data from the HyperTerminal and prints back on HyperTerminal once FX3 gets 32 bytes of data.
Thanks,
sai krishna.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One of my problems is that I want to be able to make commands of different size. I can setup the DMA size as low as 16 byte, byt I wan to be able to make commands down to 4 chars.
I was looking at register mode, but I can't get the "Call-back" for the UART to work in register mode.
Poul-Erik.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Right. We can setup the DMA size as low as 16bytes. I don't see a way to make it to 4 bytes. You may need to enter remaining bytes in the command as empty spaces to generate a event in the firmware. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Poul-Erik,
I experienced the same issue! You need to use the UART register-mode to receive a variable number of bytes which is less than 16! For this you don't need any callback since the only events which you can catch in register-mode are RX_DONE, TX_DONE and ERROR.
Just use the API CyU3PUartReceiveBytes() to receive byte by byte and check for <CRLF> which usually is used to finish the input at the console.
Bes regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Robert.
That is one way to do it. One of the problems is that you need a timer interrupt to check the status, and you will use a lot of CPU time, because you can't get an interrupt at the right time.
Pol-Erik.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content