- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to write firmware for the 244110 module. I have the dev board and the 042 programming board.
I have the BLE stuff all working. I am having trouble with the UART.
There are 2 example project for the 244110 when I create a new project. One is for transmitting and one is for receiving. Not sure why there isn't a single example that shows both, but ok. These examples use the LCD, which I don't have either, so I took that out.
I am trying to just send any data transmitted out back into the receive. I do this by just having a wire go from the TX pin to the RX pin. I am using pin P1.0 for RX and P1.1 for TX.
That is my first question. Should I have any trouble using those pins like that? Can I just connect them together and have the bytes go out one pin and come right in the other? I don't have an easy way to connect a serial port to my laptop, so I was hoping this would work.
I took the RX example and TX example and smashed them together and then modified the main.c to simply be this:
int main()
{
char8 ch; /* Data received from the Serial port */
char8 ch2;
CyGlobalIntEnable; /* Enable all interrupts by the processor. */
isr_1_Start(); /* Initializing the ISR */
UART_1_Start();
ch = 0;
while(1)
{
ch++;
UART_1_WriteTxData(ch); /* Sending the data */
/* Check the UART status */
ch2 = UART_1_GetChar();
/* If byte received */
if(ch2 > 0u)
{
CyDelay(200u);
}
CyDelay(200u);
}
}
As you can see I just transmit a character and then try to receive it. Nothing ever comes in. I set a break point inside the if (ch2 > 0u) and it never hits the break point. This is similar to what I am seeing in my BLE firmware that tries to do the same thing.
I have attached a zip file to this post with the simple example project. Please tell me what I am doing wrong so I can get this working.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome in the forum, Tony!
You started the interrupt, but you did not supply an interrupt handler, So the program will stall at the interrupt.
For the first approach I would suggest you to:
- Remove the isr component
- Change the Rx and Tx buffer sizes to 40. This will enable the component's internal interrupt handling.
- Use UART_GetRxBufferSize() to check how many bytes are received already. This only works with the internal interrupts.
Happy coding!
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome in the forum, Tony!
You started the interrupt, but you did not supply an interrupt handler, So the program will stall at the interrupt.
For the first approach I would suggest you to:
- Remove the isr component
- Change the Rx and Tx buffer sizes to 40. This will enable the component's internal interrupt handling.
- Use UART_GetRxBufferSize() to check how many bytes are received already. This only works with the internal interrupts.
Happy coding!
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for taking the time to respond. In my big project I had actually tried something like that and it didn't work.
I modified the sample that I have uploaded. I removed the isr component. I changed the RX and TX buffers to 40 and saw that the internal interrupts turned on.
I changed main to be like this:
int main()
{
char8 ch; /* Data received from the Serial port */
char8 ch2;
CyGlobalIntEnable; /* Enable all interrupts by the processor. */
UART_1_Start();
ch = 0;
while(1)
{
ch++;
UART_1_WriteTxData(ch); /* Sending the data */
if (UART_1_GetRxBufferSize() > 0)
{
/* Check the UART status */
ch2 = UART_1_GetChar();
/* If byte received */
if(ch2 > 0u)
{
CyDelay(200u);
}
}
CyDelay(200u);
}
}
Same problem. I never reach the code inside the if (UART_1_GetRxBufferSize()) even though just above that I transmit a byte.
Where you able to get the sample I uploaded to work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a little more information. I put a scope on the TX pin and do see the serial data going out, so I know the transmit is working.
I have the TX pin connected to the RX pin.
UART_1_GetRxBufferSize is always 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I changed the device to fit my board (CY8C4345AXI-483), removed the Rx pin and wired it internally to Tx signal.
Your supplied main() from last post runs flawlessly.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As you can see from my post after yours (that we wrote at the same time) I did the same thing and having it wired internally works.
So the problem seems to be with the input pin not seeing the data.
So how do I fix it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just decided to try something else. I removed the RX and TX phyisical pins from the design and connected the UART RX and TX pins directly. Now I am getting the bytes back that I transmit.
Why can't I connect the physical TX and RX pins on the board and have that work?
I have the 244110 plugged into a 042 BLE kit board and am using that to program and debug it. I am using the header along the side of the board on P1.0 and P1.1. Are those not connected to the connectors that the 244110 are connected to?
Actually they must be because that is where I have the scope hooked up. So why don't I see the data coming in on P1.0 when I see it going out on P1.1?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually they must be because that is where I have the scope hooked up. So why don't I see the data coming in on P1.0 when I see it going out on P1.1 Only answer to this is a bad connection between P1_0 and P1_1.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the scope on the RX pin and am seeing the data on the scope, so I don't know how to connect it any more than that.
I have a jumper plugged into the header and the 2 pins are soldered together.
The only thing that makes sense is some kind of a problem with the RX pin config maybe?
Are you able to connect the 2 pins together physically on your board and have it work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I notice that you have the isr routine in there. I thought you said to take that out.
If that doesn't matter then the only conclusion I can come to is that it has something to do with the 244110 specifically.
Where do I go from here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I replaced my project with yours. Then I simply changed the device. Doing that gave an error when I compile saying that the input voltage of VDDA is set to 5 which is out of range. I fixed that by changing it to 3.3 and it compiles, but still the RX buffer is always 0 so it doesn't work.
Could this whole problem have to do with that voltage difference?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Take my running project, change the device to yours and try using a breakpoint.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is exactly what I did. Right after changing the device and trying to build I got an error that the VDDA was out of range. I changed it to 3.3, ran it and it didn't work just like mine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have to thank you for taking all the time you have to help. I hope you or someone can figure out why this doesn't work on my 244110.
I should also say that I tried other pins and still didn't get it working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would suggest you to get in contact with Cypress directly: At top of this page select "Design support -> Create a Support Case" and ask your question and attach your project archive. You will be helped by a Cypress engineer.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Again, you have been awesome helping on this. Thank you!
I have contacted my Cypress FAE. He is on it. I will try to remember to post the solution when we get to one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are using the wrong pins. P1(0) is not a Uart pin please check chart.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I kind of figured it might be something like that. Why did the tool let me choose it then? And it was green?
I will try out your example in a little while.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have everything working now. Much thanks to you and cypress FAE.
I do have another question if you know the answer.
I need to support write with response, but don't know the code to do the response. I set the BLE component with both write without response and then also write with response.
In my code I accept the data, but don't know how to acknowledge the write. I need to support both.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@bobgoar
The UART component in this project is UDB-based, so it can be routed freely to any port1, 2 and 3, No limitations for P1_0 and P1_1
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry I wasn't clear in my last post. I am switching gears a little bit and talking about the bluetooth low energy. The code example I started with supports Write Without Response. I need to also support write with response, but don't know the code to write to perform the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Much thanks to you and cypress FAE What did the FAE say?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
He sent me another example that I was able to modify. Basically the same thing you ended up helping me discover. I needed to use the SBC UART and put it on the right pins.