This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Timer Prescaler

I have a nRF51 DK board and its flashed with the SD 110

I want to have a timer which will interrupt every 50us.

This is how I set up the timer:

#define APP_TIMER_PRESCALER             4                                           
#define APP_TIMER_MAX_TIMERS            (3 + BSP_APP_TIMERS_NUMBER)                
#define APP_TIMER_OP_QUEUE_SIZE         4                                          
#define MEIN_50us_INTERVAL		        APP_TIMER_TICKS(50,APP_TIMER_PRESCALER)

With this set up I will have an interrupt every 50ms. Now if I change the prescaler nothing will change. I will still get interrupts every 50ms.

But if I change the prescaler, the time for interrupts should also change....

Or what I have to change when I need faster interrupts?

This is how the protocol looks like:

image description

I need to be able, to set every single bit. Is this possible with the new nRF52 preview board?

Parents
  • ok - if you check you'll find multiple posts every week from people trying to use timer interrupts to do precise timing/bitbanging operations while the softdevice is running. Most of them aren't even trying for something like 50µs either, they are trying to do timing operations measured in milliseconds. The softdevice, when doing anything bluetooth, interrupts constantly, has higher priority than anything else in the system and your interrupts will be delayed constantly and randomly by milliseconds at a time.

    I just googled the LIN bus protocol, the timing requirements seem very strict and it's a 1-wire protocol so you're really going to have a hard time bitbanging it with the softdevice doing anything. Well more than a hard time. Have you looked into a creative use of the UART or even SPI hardware to fake the protocol, at least you have some hardware support there?

Reply
  • ok - if you check you'll find multiple posts every week from people trying to use timer interrupts to do precise timing/bitbanging operations while the softdevice is running. Most of them aren't even trying for something like 50µs either, they are trying to do timing operations measured in milliseconds. The softdevice, when doing anything bluetooth, interrupts constantly, has higher priority than anything else in the system and your interrupts will be delayed constantly and randomly by milliseconds at a time.

    I just googled the LIN bus protocol, the timing requirements seem very strict and it's a 1-wire protocol so you're really going to have a hard time bitbanging it with the softdevice doing anything. Well more than a hard time. Have you looked into a creative use of the UART or even SPI hardware to fake the protocol, at least you have some hardware support there?

Children
No Data
Related