POC VERSION TWO
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: POC VERSION TWO: Progress to Report
Dr Jefyll wrote:
Hm, that's plausible, but not yet proven,so best to leave a little room for doubt. When I get stuck on a problem it's often because I was premature in zooming in on one particular theory.
Quote:
Aside from DUART vs QUART, what else differs between POC V1.1 and POC V2.0? Could there be a wiring problem with POC V2.0? I assume you've checked that you're able to access all the QUART registers at the expected addresses, and with the bits in the right place within the byte.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: POC VERSION TWO: Progress to Report
BigDumbDinosaur wrote:
BigDumbDinosaur wrote:
I think I've licked the problems with getting the QUART to do what it's told...The next step will be to get all of that TIA-232 mish-mash working via interrupts.
The wrinkle with the transmit code is that when there is no data in the circular FIFO the transmitter must be taken off line in some fashion so it doesn't keep bugging the MPU with interrupts—the system will otherwise deadlock. In NXP UARTs, this can be accomplished by squelching the transmitter interrupt or disabling the transmitter itself. Of the two, the latter is more efficient, as it is a simple write to a channel register. As part of this feature, a bit field in direct page maintains a flag for each channel's transmitter status so an offline transmitter can be placed on line when new data is ready for transmission. The TRB and TSB instructions come in handy for manipulating this bit field.
It all works on paper!
———————————————————————————
EDIT: I tested the above code in POC V1.1 and it works without a hitch. It does not work in POC V2.0, which means I still lack full understanding of how the QUART generates interrupts.
To me the RX section looks very well and should work fine.
Within the TX part I´m not sure how
Code: Select all
.iirq230 lda #nxpcrtxd ;tell UART to...
sta (tiacr,x) ;disable transmitter
As far as I have looked into the datasheet, perhaps using the IMR to suppress IRQs from an empty TX may be an easy way.
I agree the documentation is ... well it´s a complex circuit and that should cause a very clear structured manual. But such things are rare, very rare.
Arne
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: POC VERSION TWO: Progress to Report
GaBuZoMeu wrote:
May I asked what "It does not work" means more specifically?
A timing issue is a theoretical possibility, as everything that goes on in the QUART is slaved to the 3.6864 MHz X1 clock. Assuming the instruction to read the CIR immediately follows the instruction to update the CIR, only four Ø2 cycles will elapse between the two operations, which could be too fast for the QUART (however, I/O accesses are wait-stated, which does give the QUART more time to respond). However, I think I may have ruled out timing, as I've tested for that by placing some NOPs between the "update CIR" and "read CIR" instructions. That had no apparent effect.
Quote:
Within the TX part I´m not sure how
works - which control register is written?
Code: Select all
.iirq230 lda #nxpcrtxd ;tell UART to...
sta (tiacr,x) ;disable transmitterThe use of indexed indirect addressing to access chip registers, such as in the above code fragment, has been tested and verified on the 28L92 DUART in POC V1.1.
Quote:
As far as I have looked into the datasheet, perhaps using the IMR to suppress IRQs from an empty TX may be an easy way.
Quote:
I agree the documentation is ... well it´s a complex circuit and that should cause a very clear structured manual. But such things are rare, very rare.
Last edited by BigDumbDinosaur on Sun Mar 05, 2017 9:12 pm, edited 1 time in total.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: POC VERSION TWO
OK, the CIR isn´t reflecting the source of IRQ.
This should happen after /IACK or writing into $2A. I assume /IACK is not used.
Hmm, can you detect any change in CIR say before and after an IRQ?
After /RESET CIR should be $00. Setting up baudrates and enabling say a single TX channel should leave CIR unchanged. Perhaps a TxBufferEmpty_IRQ could appear - I am not sure whether this requires a previous transmission or simply corresponds to the buffer state.
If an IRQ appears then CIR should change (after writing into $2A).
If no IRQ appears, then filling the buffer with some characters and wait for their transmission should cause an IRQ.
If the CIR doesn´t reflect this - well then things getting ugly
Arne
This should happen after /IACK or writing into $2A. I assume /IACK is not used.
Hmm, can you detect any change in CIR say before and after an IRQ?
After /RESET CIR should be $00. Setting up baudrates and enabling say a single TX channel should leave CIR unchanged. Perhaps a TxBufferEmpty_IRQ could appear - I am not sure whether this requires a previous transmission or simply corresponds to the buffer state.
If an IRQ appears then CIR should change (after writing into $2A).
If no IRQ appears, then filling the buffer with some characters and wait for their transmission should cause an IRQ.
If the CIR doesn´t reflect this - well then things getting ugly
Arne
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: POC VERSION TWO
GaBuZoMeu wrote:
OK, the CIR isn´t reflecting the source of IRQ.
This should happen after /IACK or writing into $2A. I assume /IACK is not used.
Hmm, can you detect any change in CIR say before and after an IRQ?
This should happen after /IACK or writing into $2A. I assume /IACK is not used.
Hmm, can you detect any change in CIR say before and after an IRQ?
Quote:
After /RESET CIR should be $00. Setting up baudrates and enabling say a single TX channel should leave CIR unchanged. Perhaps a TxBufferEmpty_IRQ could appear - I am not sure whether this requires a previous transmission or simply corresponds to the buffer state.
Quote:
If an IRQ appears then CIR should change (after writing into $2A).
If no IRQ appears, then filling the buffer with some characters and wait for their transmission should cause an IRQ.
If the CIR doesn´t reflect this - well then things getting ugly
If no IRQ appears, then filling the buffer with some characters and wait for their transmission should cause an IRQ.
If the CIR doesn´t reflect this - well then things getting ugly
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: POC VERSION TWO
What does happened if you send a dummy char via TXn regardless of the IRQ state? Will then appear a TX_Empty_IRQ?
(In the datasheet i didn´t found a clear statement, that enabling TX interrupts will cause IRQs even if the corresponding channel was never used so far.)
Arne
(In the datasheet i didn´t found a clear statement, that enabling TX interrupts will cause IRQs even if the corresponding channel was never used so far.)
Arne
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: POC VERSION TWO
GaBuZoMeu wrote:
What does happened if you send a dummy char via TXn regardless of the IRQ state? Will then appear a TX_Empty_IRQ?
Quote:
(In the datasheet i didn´t found a clear statement, that enabling TX interrupts will cause IRQs even if the corresponding channel was never used so far.)
In all NXP 26- and 28-series "industrial" UARTs, TxD will interrupt any time its FIFO is empty.¹ As soon as at least one datum is written to the FIFO the interrupt will be "withdrawn," which simply means the interrupting condition will no longer be present and the IRQN output will no longer be driven low.
RxD works the same in reverse: as soon as at least one datum is de-serialized and stored in the FIFO an interrupt will occur, and the interrupt will be withdrawn when a datum is read from the FIFO.² This is, of course, assuming the relevant bits in the interrupt mask register (IMR) have been set.
———————————————————————————————————————————————————
¹TxD can be configured to interrupt any time there is an empty position in the FIFO or can be configured to only interrupt when the FIFO is completely emptied. I use the latter configuration, as it produces fewer interrupts during a period of continuous transmission.
²RxD can be configured to interrupt only when the FIFO is full and to withdraw its interrupt as soon as at least one datum is read from the FIFO, which is the method I use. Doing so creates an interesting problem of "stale data," for which the solution is to enable the RxD watchdog IRQ, which will happen if data becomes stale for a period of 64 bit times, which is approximately 556 microseconds at a 115.2Kbps data rate. Use of the watchdog feature means an IRQ will occur in response to a single datum being transferred from the serial shift register into the FIFO, but not right at the time of the transfer.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: POC VERSION TWO
Of course, writing into TxBuffer withdraws the IRQ, but when the char is then transmitted the buffer becomes empty, which should trigger the IRQ. I would not wonder if this happens. This would simply means the Tx_Empty_IRQ_statusbit would only trigger bidding and so on if the FIFO becomes empty.
Don´t misunderstand me, I don´t want to fool you with dull questions and/or suggestions. I have no equivalent hardware, so I cannot try this by myself. Nor do I remember whether this QUART had been used in some machine so I might take a look, how init was performed there.
Arne
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: POC VERSION TWO
GaBuZoMeu wrote:
Nor do I remember whether this QUART had been used in some machine so I might take a look, how init was performed there.
The 2698B doesn't have TxD FIFOs or an interrupt arbitration system and hence is not very efficient in using host resources, as it generates an IRQ for each datum transmitted from each active port. For example, a full screen repaint of a WYSE 60 running at 38.4 Kbps attached to one port would have meant 1920 IRQs generated during a period of 500 milliseconds. If all eight ports were simultaneously transmitting, which was often the case in the terminal server application, 15,360 IRQs could be generated in rapid succession. It got really onerous at high CBAT data rates, often causing an interrupt storm that would all but kill foreground processing.
When I designed POC V1.0, I used an NXP 2692, which is essentially one of the four blocks in a 2698B. It was the quickest way to getting a functioning design. Once I had it working I decided to try out the 26C92, which has 8-deep FIFOs on both RxD and TxD. That then led to use of the 28L92, whose FIFOs are twice as deep as those of the 26C92 and 28C94—the 28L92 is what is currently in POC V1.1.
There is another QUART in the NXP lineup, the 28L194, which is sort of like two 28L92s in a single package. Unlike the 28C94, the 28L194 uses an external clock (presumably Ø2 in a 65xx system) to sequence internal operations, and may be operated synchronously or asynchronously. I haven't a clue at this time if it can be adapted to the 65xx bus. If it turns out it is adaptable then that means the 28L198 OCTART would also be adaptable, as it too uses an external clock, although the minimum frequency has to be 33 MHz. That might not be a problem in a system using a WDC 65C02 or 65C816, since the clock can be divided by a flop to generate Ø2 in a range that is acceptable to the MPU.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: POC VERSION TWO
I´ve found this:
I wonder that they use COS interrupt.
I have also studied the 26C92. It is easier to read
but again it is not stated whether enabling of a transmitter (nerver used before) will cause an immediate interrupt (due to TxEMT). But as you have used that in POC-1 you know how it behave.
I have also studied the 26C92. It is easier to read
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: POC VERSION TWO
GaBuZoMeu wrote:
I´ve found this:
I wonder that they use COS interrupt.
Quote:
I have also studied the 26C92. It is easier to read
but again it is not stated whether enabling of a transmitter (nerver used before) will cause an immediate interrupt (due to TxEMT). But as you have used that in POC-1 you know how it behave.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: POC VERSION TWO
I have scanned all old projects, sadly none uses the 28C94. But I have found this http://man.openbsd.org/OpenBSD-5.9/qsc.4. I have no experience how to get access to that driver they mentioned there, but perhaps you.
In Philips Components Data Communication Products Handbook 1990, the Preliminary Product Specification for the SC26C94/SC68C94 says ICR threshold is reset to $3F (!) - this may simply be wrong but would very well suppress any Tx IRQs.
EDIT(1): perhaps therein you may found some clues:
In Philips Components Data Communication Products Handbook 1990, the Preliminary Product Specification for the SC26C94/SC68C94 says ICR threshold is reset to $3F (!) - this may simply be wrong but would very well suppress any Tx IRQs.
EDIT(1): perhaps therein you may found some clues:
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: POC VERSION TWO
GaBuZoMeu wrote:
I have scanned all old projects, sadly none uses the 28C94. But I have found this http://man.openbsd.org/OpenBSD-5.9/qsc.4. I have no experience how to get access to that driver they mentioned there, but perhaps you.
In Philips Components Data Communication Products Handbook 1990, the Preliminary Product Specification for the SC26C94/SC68C94 says ICR threshold is reset to $3F (!) - this may simply be wrong but would very well suppress any Tx IRQs.
EDIT(1): perhaps therein you may found some clues:
In Philips Components Data Communication Products Handbook 1990, the Preliminary Product Specification for the SC26C94/SC68C94 says ICR threshold is reset to $3F (!) - this may simply be wrong but would very well suppress any Tx IRQs.
EDIT(1): perhaps therein you may found some clues:
I have two data sheets for the 28C94, one from 1998 and the current version. Neither mentions the ICR threshold being set to any specific value at reset (BTW, I do have the active high reset wired up and functioning).
However, your comment kicked a little thought in my head that has to do with undocumented hardware quirks. When I built POC V1.0 I ran into a seemingly obdurate hardware glitch involving use of <addr>,X addressing in order to select a specific register in the SCC2692. As it turned out, it was a characteristic of the 65C816 that was provoking the problem (and solved with VDA and VPA address qualification). In troubleshooting the matter, I discovered that NXP's statement concerning consecutive accesses of a command register was not correct. They were saying that consecutive writes to the command register had to be separated by at least three X1 clocks so the DUART would correctly process the previous command. It turned out that consecutive accesses were what mattered, not just writes. I took care of that little issue by intentionally making the process of loading the registers during POST a bit on the slow side.
In the process of sorting out this current mess, I accidentally downloaded the data sheet for the 28L202 DUART, which is a souped-up version of the 28L92, and discovered that its write-up on the interrupt arbitration makes more sense. In reading it, it became glaringly apparent that the 28C94's documentation is rough around the edges and guilty of some omissions. That, along with your statements, made me suspect that some type of non-zero value must be written into the ICR to activate interrupt arbitration, which I haven't done up until now. The ICR is read/write, and during my experimentation, I determined the ICR is loaded with $00 following reset. I mistakenly assumed that if ICR contained $00 any interrupt would be active. The four bidding control registers (BCR, also read/write) are likewise defaulted to $00 at reset, but apparently need to be non-zero so the counter/timer interrupt, which is crucial to the firmware's operation, will occur.
So the new plan of attack is to work out proper values for the ICR and BCRs, add them to the setup data tables, and see if things start working.
I have actually considered redesigning POC V2 and eliminating the 28C94, replacing it with a pair of 28L92s, just to get this problem out of my hair. However, that would be tantamount to quitting—and when it comes to solving computer hardware problems, I tend to keep going, even when quitting would be the smart thing to do.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: POC VERSION TWO
I´m sure you will get your quadriga the way you want.
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: POC VERSION TWO
GaBuZoMeu wrote:
I´m sure you will get your quadriga the way you want.
x86? We ain't got no x86. We don't NEED no stinking x86!