Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insufficient checking on spike delay timer. #431

Closed
SimonDavidson opened this issue Nov 17, 2017 · 6 comments
Closed

Insufficient checking on spike delay timer. #431

SimonDavidson opened this issue Nov 17, 2017 · 6 comments
Labels

Comments

@SimonDavidson
Copy link
Contributor

In file sPyNNaker/neural_modelling/src/neuron/neuron.c, beginning at line 443.

While loop to wait enough time to space out spikes.

If the while loop is interrupted and the timer wraps around during the time when the interrupt is being serviced, when it returns from the interrupt it must wait for the timer to count down almost the entire timer tick again before continuing.

Solution may be to check (inside the while loop) if a timer wraparound has occurred and to escape the wait loop immediately if this is the case.

@rowleya
Copy link
Member

rowleya commented Nov 17, 2017

This is true - the issue is that if you overrun your timer just once, you will probably get stuck always overrunning it!

Another idea is to set up timer2 to be the same as timer 1 but without looping. Then you can just run the check on timer2. Alternatives include setting up timer2 with the actual wait time and then having a spin1_wfi to wait for the interrupt.

@alan-stokes
Copy link
Contributor

so just quickly jumping in as a fly by. But if that's to do with the spreader. we did some stuff with icub code for tdma'ing so that we handle the edge case. code below:

//calculate max_counter;
max_counter = timer_period * sv->cpu_clk;

   int dt = current_time - tc[T1_COUNT];
   if(dt < 0) dt += max_counter;
   while(dt < my_tdma_id * TDMA_WAIT_PERIOD) {
        dt = current_time - tc[T1_COUNT];
        if(dt < 0) dt += max_counter;
   }

woudl that help you guys at all?

@rowleya
Copy link
Member

rowleya commented Nov 17, 2017

Not sure - looks like that could work too.

@alan-stokes
Copy link
Contributor

if so, big thanks go to Arren Glover who generated that code in the first place.

@andrewgait
Copy link
Contributor

I think the code in neuron.c has been updated to take this issue into account, so this can probably be closed?

@rowleya
Copy link
Member

rowleya commented Jul 22, 2019

Fixed in #539

@rowleya rowleya closed this as completed Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants