UART data transmission

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

cross mob
lock attach
Attachments are accessible only for community members.
feme_285141
Level 4
Level 4

How I can do to make complete data can be transmitted ?. Because sometimes not transmitted by completo.Ver figure and program

0 Likes
21 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Your data rate relatively low with respect to the rest of code in loop,

   

so at first blush I thought maybe you are over writing Tx buffer. But

   

then I see it is a blocking call.

   

 

   

Looking at system tab of .cydwr file I see you have CMSIS library

   

checked off and a heap size of 256 bytes, stack of 1000. Maybe increase

   

heap size a little due to use of the library and sprintf.

   

 

   

Also the data buffer produced is 9 chars + a NULL to terminate string,

   

But Tx buffer set to 8 bytes, needs to be 10 I would think.

   

 

   

Regards, Dana.

0 Likes
feme_285141
Level 4
Level 4

Everything I did and nothing

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I see in the terminal window baud rate detected as 110K ? I thought

   

the project baud rate was a lot less. If its 110K you might try a lower

   

baud rate.

   

 

   

Also look with scope at signaling, make sure its RS232 levels and relatively

   

clean.

   

 

   

Additionally look at clock accuracy in your clock chain to the UART to make

   

sure your accuracy will tolerate the baud rate you are shooting for.

   

 

   

http://www.cypress.com/knowledge-base-article/steps-achieve-maximum-possible-baud-rate-uart-psoc-3-p...

   

 

   

This is for PSOC 1 but principles apply -

   

 

   

http://www.cypress.com/blog/psoc-hacker-blog/uart-clock-accuracy-requirement-psoc-1

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Print buffer needs to be at least 12 (forgot \n\r), so why not use 20.

   

I would suggest to put the line

   

    ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);

   


into the infinite loop, thus waiting every cycle for a valid result.

   

 

   

Bob

0 Likes
feme_285141
Level 4
Level 4

Suggested did everything and nothing

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

please upload current project

   

 

   

Bob

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

 upload current project

0 Likes
feme_285141
Level 4
Level 4

how much RAM is being used for stack and heap, (I mean it is ACTUALLY used, not being assigned for ). Any one has any idea how we can get the information.

0 Likes
feme_285141
Level 4
Level 4

 heap size and stack size the problem is the example given in a single channel use two channels of ADC might this affect me heap size and stack sizeheap size and stack size 

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Heap is used by sprintf(), stack usually uncritical when >= 0x0400 as you specified.

   

I have currently no access to lab to check code, but I presume that the problem is on PC side. You may try (what I wanted to check) to use a different terminal program, preferrably PuTTY.

   

 

   

Bob

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

it  Occur the same with puttty

   

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Well, the error is not within the PSoC. Look at my output using your latest project which is totally undisturbed.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You need to use an ISR attached to eoc output, as that signifies when all channels

   

have been scanned and result registers can be read. Right now you only can be sure

   

one channel has completed when you invoke. You might consider stopping ADC

   

when the ISR occurs, then restarting it. Read notes associated with these APIs care-

   

fully.

   

 

   

ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);

   

 

   

The ISR should stop converter, set a flag (declared as volatile). and in main() test

   

flag, read the results and then restart ADC.

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Not quite. The selected way (see datasheet)

   

"ADC_WAIT_FOR_RESULT
Does not return a result until the ADC conversion of all sequential channels is complete."

   

ensures that all channels are converted. So no isr is needed, although it could make life easier.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I stand corrected. I missed that note about all channels vs 1 channel.

   

 

   

cuenta1 = ADC_GetResult16(CHANNEL1);

   

 

   

You declared cuental as uint16, but function returns int16, you might want to

   

correct that.

   

 

   

Looks like a logic analyzer would also be useful. These are pretty cheap, work quite well,

   

search for this on ebay "saleae logic analyzer"

   

 

   

http://www.ebay.com/itm/USB-Logic-Analyzer-24MHz-8C-Compatible-to-Saleae-/181809224470?hash=item2a54...

   

 

   

Regards, Dana.

0 Likes
feme_285141
Level 4
Level 4

I've tried everything to change computer remains the same

   

also buy the logic analyzer as UART port to connect to verify?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

My experiences with transmitting data via UART or USBUART are quite flawless. I cannot monitor something like your experiences show and I did a lot of those. So I assume that something with one of your windows drivers or your OS is not as required. (Have a look at CTS and RTS lines)

   

You may do a check yourself, just configure an UART Tx-Rx loopback and see that the transmission without additional hardware (except a jumper wire) works just fine. Next you can check your two-way level shifting cable.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

If you purchased the cheap analyzer it cannot handle RS232 levels directly

   

at its inputs. So place series R's in the data lines to the analyze, say 2 K ohm,

   

and that should protect the analyzer.

   

 

   

Data circuits Control circuits Voltage RS232

   


0 (space) Asserted +3 to +15 V                           1 (mark) Deasserted -15 to -3 V

   

 

   

Regards, Dana.

0 Likes
feme_285141
Level 4
Level 4

I tried the CY8CKIT-50 kit was great to be a problem with my board psoc 4 pionner

0 Likes
feme_285141
Level 4
Level 4

I tried the CY8CKIT-50 kit was great to be a problem with my board psoc 4 pionner

0 Likes
feme_285141
Level 4
Level 4

if you do not influenced  bigger heap size(0x1000) and stack size(0x4000 )

0 Likes