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

Cascading timers need to be enabled to count #2812

Closed
LunarLambda opened this issue Feb 3, 2023 · 3 comments
Closed

Cascading timers need to be enabled to count #2812

LunarLambda opened this issue Feb 3, 2023 · 3 comments
Labels
platform:GBA Game Boy Advance-related issues
Milestone

Comments

@LunarLambda
Copy link
Contributor

bool sioWait()
{
    // 50 ms timeout
    REG_TM0CNT = TIMER_FREQ_16KHZ;
    REG_TM0VAL = 65536 - 819;
    REG_TM1CNT = TIMER_FREQ_CASCADE;
    REG_TM1VAL = 0;
    REG_TM0CNT |= TIMER_ENABLE;

    while (!REG_TM1VAL);

    return hadTrans;
}

Had this code hang on hardware, despite working fine in mGBA. Turns out hardware demands the TIMER_ENABLE flag be set on both TM0 and TM1 for TM1 to count up.

@endrift endrift added this to the mGBA 0.10.2 milestone Feb 3, 2023
@endrift endrift added the platform:GBA Game Boy Advance-related issues label Feb 3, 2023
@endrift
Copy link
Member

endrift commented Feb 3, 2023

This sounds like a simple oversight on my part.

@endrift
Copy link
Member

endrift commented Feb 3, 2023

image
I really should look for more of these TODOs in my code.

@LunarLambda
Copy link
Contributor Author

😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:GBA Game Boy Advance-related issues
Projects
None yet
Development

No branches or pull requests

2 participants