Most efficient way to decode a pulse stream

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

cross mob
Anonymous
Not applicable

I am looking for an expert advice on how to decode 2 asyncronous pulse streams with a PSOC4 BLE.

I have 2 signals with a strange proprietary protocol. The maximum pulse length is 200µs and the minimal pulse length 10µs. I need to measure the pulse length with at least 1,5µs resoluton.

Now I am looking at the most efficient use of internal resources to archeive this with the minimul amount of CPU time possible (the CPU needs to handle the BLE communication and this shouldn't interfere with the measurements).

What would be the "best" timer configuration for this?

0 Likes
1 Solution

Because resetting the timer after pulse measure is a required action using DMA will get rather complicated (if possible at all).

I would try using a connection as shown below.

pastedImage_4.png

Setting the timer period accordingly will give you an interrupt when the 500µs expire, otherwise the capture interrupt will get you the signal width with 0.5 µs resolution.

Bob

View solution in original post

0 Likes
8 Replies
AlanH_86
Employee
Employee
100 replies posted 50 replies posted 25 solutions authored

A TCPWM setup as a Timer is the right answer.

A 1MHz input clock will give you 1us resolution.

You can use a falling edge capture.

A falling edge interrupt ... and an ISR to reset the time and read the capture.

The next question will be what/how you will do with the different pulses... and how fast they come.

0 Likes
Anonymous
Not applicable

The question is how to handle the 2 asyncronous data streams in an efficient way. The signal consists of a sequence of 4 to 10 pulses and than there is a pause of approximately 500µs.

Should I use differtent timer for each one or a single 8Bit timer? Is it better to have a "free running" timer or to reset it after every catch? Can I use the DMA Peripheral?

0 Likes

Because resetting the timer after pulse measure is a required action using DMA will get rather complicated (if possible at all).

I would try using a connection as shown below.

pastedImage_4.png

Setting the timer period accordingly will give you an interrupt when the 500µs expire, otherwise the capture interrupt will get you the signal width with 0.5 µs resolution.

Bob

0 Likes

It is almost like you have programmed a PSoC before.


Though Im not sure why you clock it at 2mhz instead of 1 given that he only needed 1.5us accuracy?

0 Likes

Though Im not sure why you clock it at 2mhz instead of 1 given that he only needed 1.5us accuracy?

Because I can 😉

Bob

0 Likes

Hmmm....

power ~= ~C*V^2*F

🙂

0 Likes

Power = kg * m² / s³ for all that are metric. Must be quite difficult to express using ounces, miles and am/pm times...

BOB

0 Likes
Anonymous
Not applicable

Link with related clock power analysis thread: electric circuits - How does power consumption vary with the processor frequency in a typical comput...

Power: the ability to do something or act in a particular way, especially as a faculty or quality

😜

0 Likes