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

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

cross mob
Anonymous
Not applicable

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

   


  
 

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

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

View solution in original post

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

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

0 Likes
Anonymous
Not applicable

Here is the complete project.

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

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

0 Likes
Anonymous
Not applicable

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

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

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

Anonymous
Not applicable

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.

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

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