Fix hang-up when executing RQ1 SysEx on SC-55mk1 - #112
Open
shingo45endo wants to merge 3 commits into
Open
Conversation
Such behavior is not described anywhere in the H8/532 hardware manual, but the SC-55 firmware seems to be implemented on the assumption of such behavior.
Only the clear operation is valid for the SSR register, but the register is entirely overwritten at the end of the function because it does not return at the end of the DEV_SSR case.
According to the hardware manual, the initial value of the SSR register is H'87.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes a hang-up issue when executing RQ1 SysEx on the SC-55mk1.
When running Nuked-SC55 in mk1 mode, it hangs when sending such kind of RQ1 SysEx as shown below.
f0 41 10 42 11 40 01 00 00 00 10 2f f7The hang-up occurs at the following code in the SC-55 firmware (v1.21):
The buffer for RQ1 is managed as a ring buffer, with “head” stored in
H'ABFAand “tail” inH'ABFC. It loops infinitely until the head and the tail are equal (= until the ring buffer is empty), which causes a hang-up. The head does not change in this loop, but the SC-55 firmware expects the head to change in the transmit-end interrupt (TXI) handler. However, Nuked-SC55 does not issue a TXI interrupt. As a result, a hang-up happens.This pull request modifies the MCU emulator to issue a TXI interrupt if the
SSR.TDREbit is 1 when a 1 is written to theSCR.TIEbit. Such behavior is not described anywhere in the H8/532 hardware manual, but the SC-55 firmware seems to be implemented on the assumption of such behavior. According to the hardware manual, it is understood that clearingSSR.TDREtriggers a transmission of theTDRdata, and then a TXI interrupt is issued when the transmission is completed. However, it seems that the only two processes in the SC-55 firmware that explicitly clear SSR.TDRE are the process of sending the next data in the TXI interrupt handler and the transmission of active sensing. And the only SCI-related processing that the SC-55 firmware does in the RQ1 process seems to be to enableSCR.TIEbefore the infinite loop.After applying this, it will no longer hang up when sending RQ1 SysEx. (Confirmed on v1.00, v1.10, v1.20, v1.21, and v2.00) Also, by enabling
printfinMCU_UpdateUART_TX, we can confirm that the RQ1 results are correctly sent as shown below.In addition to this, there are a few other SCI implementation issues that I was concerned about, and fixed them.
SSRregister, but the register is entirely overwritten at the end of the function because it does not return at the end of theDEV_SSRcase.SSRregister isH'87.