ADC SAR SEQ StartConvert() blocking for no good reason

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

cross mob
BeJo_335366
Level 1
Level 1

I am really getting to my wits end.

   

I have a design using the sequencing ADC in PSoC4.

   

It has gotten into a state where the StartConvert API function appears to be blocking. If I include that function in the main code nothing after it will be executed.

   

If I include it in a timer interrupt service routine it will block there too.

   

If I include it in the main line of code in free-running mode, the ADC will carry on converting and I can see that the ADC ISR is updating sample values from a potentiometer to the PWM (driving an LED).

   

If I configure the ADC as "Hardware triggered" and put the StartConvert in the main line of code it blocks still.

   

This behavior does not seem right to me and appears to disagree with the API documentation for the SAR ADC in PSoC 4.

   

Has anyone else had this issue? Any clues as to what I am doing wrong?

   

Could it be an interrupt timing / latency issue?

   

Any help or advice is appreciated.

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

Nothing that I have experienced so far. Can you 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.



Bob
 

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

How do you determine "blocked"? Is there any code in main after the StartConvert()? Do you read the results of the ADC in an ISR? (and maybe this one consumes all CPU)?

   

(When using "hardware triggered", you don't need to use StartConvert at all)

0 Likes
BeJo_335366
Level 1
Level 1

It turns out that the UART was actually the cause - a race condition of some sort.

   

Because each ADC conversion was sending a byte of data to the TX buffer, and the UART is too slow to keep up at the baud rate chosen.

   

Now I'm looking into how to use a semaphore along with the UART Done interrupt to make sure I don't try to stuff the buffer too full 🙂

   

Had to use an oscilloscope to find this one...

   

Thanks all for your responses.

0 Likes
BeJo_335366
Level 1
Level 1

As a follow up, increasing the TX buffer size in the SCB UART solved the problem.

   

I also just realized this was not a question about PSoC Creator and this is the wrong forum... so thanks for graciously replying.

   

-Ben.

0 Likes
BeJo_335366
Level 1
Level 1

As a follow up, increasing the TX buffer size in the SCB UART solved the problem.

   

I also just realized this was not a question about PSoC Creator and this is the wrong forum... so thanks for graciously replying.

   

-Ben.

0 Likes
BeJo_335366
Level 1
Level 1

As a follow up, increasing the TX buffer size in the SCB UART solved the problem.

   

I also just realized this was not a question about PSoC Creator and this is the wrong forum... so thanks for graciously replying.

   

-Ben.

0 Likes
BeJo_335366
Level 1
Level 1

As a follow up, increasing the TX buffer size in the SCB UART solved the problem.

   

I also just realized this was not a question about PSoC Creator and this is the wrong forum... so thanks for graciously replying.

   

-Ben.

0 Likes
BeJo_335366
Level 1
Level 1

As a follow up, increasing the TX buffer size in the SCB UART solved the problem.

   

I also just realized this was not a question about PSoC Creator and this is the wrong forum... so thanks for graciously replying.

   

-Ben.

0 Likes
BeJo_335366
Level 1
Level 1

As a follow up, increasing the TX buffer size in the SCB UART solved the problem.

   

I also just realized this was not a question about PSoC Creator and this is the wrong forum... so thanks for graciously replying.

   

-Ben.

0 Likes
BeJo_335366
Level 1
Level 1

As a follow up, increasing the TX buffer size in the SCB UART solved the problem.

   

I also just realized this was not a question about PSoC Creator and this is the wrong forum... so thanks for graciously replying.

   

-Ben.

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

What makes you think, a reply is not accepted when you hit the "Post" button? There should be some changes in the forum SW to have that prevented.

   

 

   

Bob

0 Likes
BeJo_335366
Level 1
Level 1

 Hi Bob,

   

That is a bug in the forum software. I only hit the "Post" button a single time.

   

Regards,

   

Ben.

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

@jordanyte, don't sweat the small stuff, ALL forum posters have had

   

multiple posts, blank post, upload vacuum post. I fnd on high latency

   

connections I get double posts.

   

 

   

Fear not, the forum police are asleep at the switch.

   

 

   

Refards, Dana.

0 Likes