<p>Indeed, the problem was the use of global variables being accessed by multiple tasks. Using the struct to contain the global variables, or turning every global variable into an array sized the number of tasks seems to solve the problem.<br>
Thank you very much once again.</p>