You are here

My measurement result differ from expected value when the data transfer operation using USBUART takes place | Cypress Semiconductor

My measurement result differ from expected value when the data transfer operation using USBUART takes place

Summary: 7 Replies, Latest post by Bob Marlowe on 31 Aug 2016 12:35 AM PDT
Verified Answers: 3
Last post
Log in to post new comments.
wafeez_08_1691781's picture
User
9 posts

Hi Cypress community,

I hve been working on a impedance meter project. I have a problem with the data transfer using the USBUART operation. Below is my program for the data transfer. I used teraterm as my COMport terminal. When i start the data transfer operation, my  measurement result differ from the correct result. For instance, when testing a resistor, i observed 1k ohm at my LCD display which is a correct value, however, after i make connection to the COMport for the data transfer and start the operation, the value of the tested resistor become 500 ohm and even lower than that. This situation lead me to having a false measurement for the resistor value.

I hope this problem can be identify and solve.

Thanks in advance

  
 

 

Attachments: 
user_1377889's picture
User
10115 posts

Cannot see more than CDCIsReady() is a function. You need to wait for it returning a nonzero value (TRUE). This indicates you may send more data.

Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file. There are more pitfalls to check as interrupt priorities, buffer overflow etc.

 

Bob

 

wafeez_08_1691781's picture
User
9 posts

Here is the complete project.

user_1377889's picture
User
10115 posts

I cannot see any USBUART component. The Keese_ADC component is not contained in the archive. So build fails and I cannot check the interrupts.

Declare EOC_Flag as volatile!!!! It gets changed in an interrupt handler, so it might get optimized-out.

 

Bob

wafeez_08_1691781's picture
User
9 posts

I try to changed it to volatile , but it make some warning. here i attach the complete file of my project.. the only problem here is on my data transfer using the USBUART interface.

Tq for your cooperation

user_1377889's picture
User
10115 posts

There were two dependencies that could not be resolved and generated warnings. After removal project compiled fine. Only dep. left were cyAnnotation and cyReference libraries.

Try setting the ADC_IRQ priority (in .cydwr view) to something better than the default 7 (take 5, good music)

The line in main.c must read

volatile uint8 EOC_Flag = 0;

 

Bob

wafeez_08_1691781's picture
User
9 posts

Tq bob for you reply. However, after i changed the ADC interrupt and the volatile uint8 EOC_Flag =0, no changes happen. the problem still there. i checked the USBUART_PutString function description and i found that the function will send the zero length packet data automatically after the transfer operation takes place.I think this maybe the reason to my problem. So, do you have any alternative method so that i can transfer my measurement data to my computer without any data loss or program corruption.

 

user_1377889's picture
User
10115 posts

When you are using one of the Cypress kits you may use the built-in UART-USB bridge and use an emulated com-port as before. You will have to connect the UART component to the correct pins, check the schematics of the kit.

 

Bob

Log in to post new comments.