Author Topic: Extending a 1ns pulse  (Read 2741 times)

0 Members and 1 Guest are viewing this topic.

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3712
  • Country: nl
Re: Extending a 1ns pulse
« Reply #50 on: February 14, 2024, 06:30:24 am »
Overnight it came to mind that you don't need additional hardware and can use the msb of your ECL counter, which at 8MHz can be used to clock a timer.

According to the timer cook book the external clock can be at max 1/3 of the timer internal clock. They have an example that uses 10MHz as an external clock, so 8MHz should work too.
MSB will go high as soon as it hits 0x80. I need a pulse when it goes from 0xFF to 0x00.

Only use 7 bits of your counter and the rest from the STM timer. I assume the msb will toggle with a rate of 8MHz as long as the counter keeps on running. So the moment your counter goes up from 0x7F to 0x80, the STM timer goes up to 1. The moment your counter gets there again the STM timer becomes 2, etc.

The moment the second photo detector is activated read the counter value and combine it with the state of the STM timer.

 :palm: I'm loosing my edge. Not as sharp as I used to be, because it dawned on me that the 8th bit is clocking at ~4MHz, and when using the falling edge to clock the STM32 timer it results in the upper 16 bits of a 24 bit counter.

Was thrown of by the divide by 250 and the mentioning of the counter output pulse being 4MHz. With an 8 bit binary counter the divide is by 256 of course and the actual frequency of the 8th bit is 3906250Hz roughly 3.9MHz. Well within what the STM32 can handle.

So the simplest solution is to connect the 8th bit of the ECL counter to a timer input off the STM32 and set it up for external clock mode with falling edge response. When the second photo detector is activated stop the clock, read the binary counter and put the timer bits on top of them.

No fuzzing about with extending the 1ns pulse needed.

Offline BreakingOhmsLawTopic starter

  • Frequent Contributor
  • **
  • Posts: 360
  • Country: de
  • Certified solder fume addict
Re: Extending a 1ns pulse
« Reply #51 on: February 16, 2024, 08:21:17 am »
Students that perform this experiment are typically 11-13 years old. A scope with 30+ buttons is a very daunting piece of equipment cool as hell

Fixed it for you...

Can't argue with that ;)
 

Offline BreakingOhmsLawTopic starter

  • Frequent Contributor
  • **
  • Posts: 360
  • Country: de
  • Certified solder fume addict
Re: Extending a 1ns pulse
« Reply #52 on: February 16, 2024, 08:28:00 am »
Overnight it came to mind that you don't need additional hardware and can use the msb of your ECL counter, which at 8MHz can be used to clock a timer.

According to the timer cook book the external clock can be at max 1/3 of the timer internal clock. They have an example that uses 10MHz as an external clock, so 8MHz should work too.
MSB will go high as soon as it hits 0x80. I need a pulse when it goes from 0xFF to 0x00.


Only use 7 bits of your counter and the rest from the STM timer. I assume the msb will toggle with a rate of 8MHz as long as the counter keeps on running. So the moment your counter goes up from 0x7F to 0x80, the STM timer goes up to 1. The moment your counter gets there again the STM timer becomes 2, etc.

The moment the second photo detector is activated read the counter value and combine it with the state of the STM timer.

 :palm: I'm loosing my edge. Not as sharp as I used to be, because it dawned on me that the 8th bit is clocking at ~4MHz, and when using the falling edge to clock the STM32 timer it results in the upper 16 bits of a 24 bit counter.

Was thrown of by the divide by 250 and the mentioning of the counter output pulse being 4MHz. With an 8 bit binary counter the divide is by 256 of course and the actual frequency of the 8th bit is 3906250Hz roughly 3.9MHz. Well within what the STM32 can handle.

So the simplest solution is to connect the 8th bit of the ECL counter to a timer input off the STM32 and set it up for external clock mode with falling edge response. When the second photo detector is activated stop the clock, read the binary counter and put the timer bits on top of them.

No fuzzing about with extending the 1ns pulse needed.
That is indeed the way to go and by far the most reliable solution. Duh! |O No additional parts required.
I could even stick with the /250 divider, because the MSB will go from high to low when the counter resets from 0xff to 0x04

Thanks to the forum hive mind for the many interesting contributions. Yet another example on how you can reach a goal by many different paths in electronics.
Perhaps something Dave could make a video about, ns-range digital signals can be very challenging to work with.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf