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

Error in schedule handler after ISR2 #279

Closed
mcerdeiro opened this issue Jun 19, 2015 · 1 comment
Closed

Error in schedule handler after ISR2 #279

mcerdeiro opened this issue Jun 19, 2015 · 1 comment
Assignees

Comments

@mcerdeiro
Copy link
Contributor

El error se genera en la función Schedule(), en la línea de 137: ret = E_OS_RESOURCE;
La llamada a la función Schedule(), la realizaba SysTick_Handler(), con la macro PostIsr2_Arch(isr);
En el contexto de SysTick_Handler(), la variable OSEK_ISR2_SchedulerCall = 1
Pero cuando compara en Schedule(): if (1 == OSEK_ISR2_SchedulerCall) sale por falso. Intentando hacer un cambio de tarea con un recurso tomado, tenemos entonces un ret = E_OS_RESOURCE;
El resultado del if() es correcto dado que la variable OSEK_ISR2_SchedulerCall = 0 en el contexto del Schedule()

Cómo sucede esto?

Al momento que interrumpe el SysTick también entra una interrupción OSEK_ISR2_UARTx
Que aparentemente se ejecuta primero, entonces desde OSEK_ISR2_UART3_IRQHandler() hace que:
OSEK_ISR2_SchedulerCall = 1
y luego llama a Schedule(): if (1 == OSEK_ISR2_SchedulerCall) => verdadero y
OSEK_ISR2_SchedulerCall = 0

Al volver a SysTick_Handler(), en Schedule(): if (1 == OSEK_ISR2_SchedulerCall) => false, entonces
(dado que la anterior interrupcion bajo el flag OSEK_ISR2_SchedulerCall = 0)
ret = E_OS_RESOURCE;

El problema lo solucionamos haciendo los siguientes reemplazos:

OSEK_ISR2_SchedulerCall++;
en lugar de
OSEK_ISR2_SchedulerCall = 1;

if (0 < OSEK_ISR2_SchedulerCall)
en lugar de
if (1 == OSEK_ISR2_SchedulerCall)

OSEK_ISR2_SchedulerCall--;
en lugar de
OSEK_ISR2_SchedulerCall = 0;

Con estas modificaciones aún tenemos dudas.

@mcerdeiro mcerdeiro self-assigned this Jun 19, 2015
@mcerdeiro mcerdeiro added this to the ciaaFirmware 0.5.1 milestone Jun 19, 2015
mcerdeiro added a commit to ciaa/firmware.modules.rtos that referenced this issue Jun 19, 2015
gmuro added a commit that referenced this issue Jun 20, 2015
gmuro added a commit that referenced this issue Jun 21, 2015
@mcerdeiro
Copy link
Contributor Author

Falta cambiar la release del RTOS a 1.0.1 y ver donde poenmos y como armamos release notes por módulo del firmware.

gmuro added a commit that referenced this issue Jun 22, 2015
gmuro added a commit that referenced this issue Jun 22, 2015
gmuro referenced this issue Jul 4, 2015
…ndolo para poder hacer uso de las 9 GPIO incluidas en la EDU-CIAA, y del PONCHO interfaz de usuario(hasta ahora desarrollado los drivers del teclado y funciones de lectura y ejecucion de funciones genericas).
mcerdeiro added a commit to ciaa/firmware.modules.rtos that referenced this issue Jul 29, 2015
mcerdeiro added a commit to ciaa/firmware.modules.rtos that referenced this issue Jul 30, 2015
mcerdeiro added a commit that referenced this issue Jul 30, 2015
@mcerdeiro mcerdeiro modified the milestones: ciaaFirmware 0.6.0, ciaaFirmware 0.5.1 Aug 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant