- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey all,
I've got a project in the works that uses 3 UARTs. I manage to fit in the 3 required, but I want to add a 4th for debugging purposes if possible. This should be no problem, as I appear to have adequate UDB resources for a half-duplex UART according to the UART component datasheet:
However when I try to build, I'm running out of UDBs during placement. Looks like running out of macrocells? I'm curious as to why this is? Something to do with how macrocells get allocated maybe?
I'm using PSoC Creator 4.3, the PSoC5LP part is a CY8C5667AXI-LP040. I've attached the report file to this post. DBG_UART is the component name for the half-duplex I am trying to add. I had to put it in a .zip because apparently I can't upload .rpt or .txt files.
Appreciate any thoughts,
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
It is actually impossible to use 100% of the Macrocells or Pterms. Due to routing restrictions, you might not be able to use all the inputs/outputs of the PLDs. Said that, if you reach around 85~90% of a Macrocells or Pterms, the placer might not be able to fit your design.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello KyTr.
Although KIT-059 uses a different 5LP vs your project, there was a discussion about using 4 UARTs with KIT-059. KIT-059 has 24 UDB's just like 5667. Maybe some of this information will help.
https://community.cypress.com/t5/PSoC-5-3-1-MCU/uart-in-psoc5lp-cy8ckit-059/m-p/159490#198388
Some other suggestions:
Use USBUART.
Use software UART.
Use built-in 5LP I2C with KITprog I2C Bridge. Yeah, it's a bit tricky/limited, but I used it in a pinch for debugging when all UDB resources were used up.
Good luck with your project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi BiBi,
Not a whole lot to go on in that linked thread to address the question about UDB resources, unfortunately.
If I had no other components or digital design work I'm sure I could fit 4 UARTs without much trouble. The software UART will get the job done at least for some basic info printed to my terminal. Using the debugger tool I2C bridge is an interesting idea though. I'll file that away for later, I can imagine it being useful at some point down the line.
This project is already using the USBFS component as a HID device but I'm really more interested in why I'm unable to use a UDB UART, when according to the resource meter, I should have the resources to do so.
I'm guessing it has something to do with how UDB resources are allocated? Maybe something think a UART requires "contiguous" resources that it can't place between my other USB components?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Just like what BiBi-san has already suggested, I would suggest to consider software UART.
As you wrote that you need it for a debugging purpose,
hoping that you can put up with 9600 baud,
I tried a simple software UART TX
using CY8CKIT-059. (Hopefully it will work with your device.)
schematic
pins
main.c
#include "project.h"
#include "stdio.h"
#define STR_BUF_LEN 64
#define BIT_DELAY_US 104 /* 9600Hz -> 104.17us */
void soft_tx_send_byte(uint8_t data)
{
uint8_t mask = 0x01 ;
int i ;
soft_tx_Write(1) ; /* make sure that the level is high */
CyDelayUs(BIT_DELAY_US * 2) ;
soft_tx_Write(0) ; /* generate start bit */
CyDelayUs(BIT_DELAY_US) ;
for (i = 0; i < 8; i++ ) {
if (mask & data) {
soft_tx_Write(1) ;
} else {
soft_tx_Write(0) ;
}
mask <<= 1 ;
CyDelayUs(BIT_DELAY_US) ;
}
soft_tx_Write(1) ; /* generate stop bit */
CyDelayUs(BIT_DELAY_US * 2) ;
}
void soft_tx_send_string(char *str)
{
while(str && *str) {
soft_tx_send_byte(*str++) ;
}
}
int main(void)
{
char str[STR_BUF_LEN+1] ;
int count = 0 ;
CyGlobalIntEnable; /* Enable global interrupts. */
soft_tx_send_string("\x1b[2J\x1b[;H") ;
soft_tx_send_string("Test Software UART TX ") ;
snprintf(str, STR_BUF_LEN, "(%s %s)\n\r", __DATE__, __TIME__) ;
soft_tx_send_string(str) ;
for(;;) {
snprintf(str, STR_BUF_LEN, "count %d\n\r", count++) ;
soft_tx_send_string(str) ;
CyDelay(1000) ;
}
}
Then I connected a USB-serial adapter to P3_0 and PC.
The Tera Term log was something like
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi MotooTanaka,
I will probably end up using the Software Transmit UART component for just some basic debug output, but my real burning question is why can't I place a UDB UART even when I should have the resources to do so according to the resource meter in PSoC Creator. Hoping someone with some more knowledge than I have of how the UDBs work would be able to shed some light on why this might be the case.
In any event, that code for a simple software UART could come in handy elsewhere. Appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
KyTr,
As Rodolfo pointed out, your design is likely runned out of routing resources (P-terms), which are used by 80% (299 out of 384). That is typically the limit of wiring network.
Try using Fixed Function UARTs (4 available), and replace some UDB-based UARTs.
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Odissey,
I don't think this part has fixed UARTs unless I am missing something? Something like an I2C, PWM, or Timer component has a FF/UDB selector in the component config. I see no such thing for the UARTs (and none are listed under "Communication" on the resource meter).
I did find my Master I2C component for this project was UDB though, where I can be using FF. Making this change took UDB usage from 76% to 66% and gave me nearly 40 Macrocells and 100 P-Terms back. This lets me fit another UART with no trouble. If I reconfigure my timers and make one of my PWM modules FF, I might be able to save even more.
Thanks for the tip on P-Terms, I'll bear that in mind here on out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
It is actually impossible to use 100% of the Macrocells or Pterms. Due to routing restrictions, you might not be able to use all the inputs/outputs of the PLDs. Said that, if you reach around 85~90% of a Macrocells or Pterms, the placer might not be able to fit your design.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rodolfo,
Thanks for the tip, I'll mark this as solution to the question.
I did manage to recover some P-Terms and Macrocells by taking my Master I2C component from UDB to FF. Since this design was based on an older one (that had both SI2C and MI2C) I removed the unneeded Slave I2C, but neglected to switch the Master I2C to FF. It was costing me lots of UDB (to the tune of 100 P-Terms and 40 macrocells). With this change I was able to fit my extra UART.
Thanks!