I am trying to use a debugger to poke values into the registers to get the QADC to do a single pass reading the ADC values. I'm confident I have the CCW registers setup properly. I just cannot get it to kick off a single pass software scan.
解決済! 解決策の投稿を見る。
Complicated piece of kit, isn't it? At least it is well documented, unlike the modern extremely complicated kit in newer CPUs.
> c) (FFF20E) = 0040
> Set QACR2 to disable Queue2, and only run queue 1. Note, this should be the default value.
According to my manual, the default value is 0027 and the 0040 bit in that register is "not used". It looks to me like you've set the queue start to ZERO. "8.12.7 Conversion Command Word Table" says to set BQ2 to "a value greater than 39" to disable the queue, which would be 40 or 0x28. So the documented default of 0x27 is just weird...
You're meant to set it to "40 DECIMAL". You've set it to "40 HEX"!
The command table looks OK.
The command looks OK, but I'd suggest 0x2500 to see if you can get it continuously scanning. Then look at CS and CWP in the Status register.
I wouldn't assume zero in the result registers means it didn't run. The conversions may have turned out to be zero. One or more of the reference voltages may be wrong (the ADC analog hardware may not be powered) so it may be giving that result.
It should be setting the CF1 bit in QASR if it runs.
> If I zero result registers,
How about writing other patterns?
There may still be some interaction with the debug mode that may stop it from working. I'd suggest loading a small function into memory to initialise and start the QADC and then run it from the debugger.
It would help if you detailed how you are setting the QADC up and what values you are writing to what register addresses.
Have you got the STOP and FRZ bits clear?
Have you set up all of the QADC Control registers? Have you read them back to make sure your writes are working? What is showing up in the STATUS register after your attempted commands?
It is possible the registers only respond to WORD writes, and your debugger is doing everything as BYTE writes. That is a common problem.
Tom
Thank you for looking at this.
First, I believe the debugger is doing word writes. Any attempt to do a pokew to an odd address causes a fault. I would not expect that if it were doing byte writes.
I setup the QADC as follows:
Initialize the QADC Module Configuration Register, and QADC Prescale Register.
- a) (FFF200) = 0000
Set QADC64 mcr for normal operation (should be default)
- b) (FFF20A) = 0033
Set QACR0 to have a high prescale of 4 & low prescale of 4. PSH = 3 PSL = 3.
Internally muxed. (Non Muxed externally)
- c) (FFF20E) = 0040
Set QACR2 to disable Queue2, and only run queue 1. Note, this should be the default value.
Initialize the Command Conversion Words (CCW), No Bypass (BYP), No Pause (P), Input Sample Time QCLK Period x 16
Set QACR1 for a single scan
(FFF20C) = 2100
That is my process. I scripted it so I can repeat it. Before and after writing to QACR1 I check the result registers and they have not changed. If I zero result registers, then try to get a scan, they do not change. Therefore I'm assuming the QADC is not running a scan.
Thank you,
Michael
Complicated piece of kit, isn't it? At least it is well documented, unlike the modern extremely complicated kit in newer CPUs.
> c) (FFF20E) = 0040
> Set QACR2 to disable Queue2, and only run queue 1. Note, this should be the default value.
According to my manual, the default value is 0027 and the 0040 bit in that register is "not used". It looks to me like you've set the queue start to ZERO. "8.12.7 Conversion Command Word Table" says to set BQ2 to "a value greater than 39" to disable the queue, which would be 40 or 0x28. So the documented default of 0x27 is just weird...
You're meant to set it to "40 DECIMAL". You've set it to "40 HEX"!
The command table looks OK.
The command looks OK, but I'd suggest 0x2500 to see if you can get it continuously scanning. Then look at CS and CWP in the Status register.
I wouldn't assume zero in the result registers means it didn't run. The conversions may have turned out to be zero. One or more of the reference voltages may be wrong (the ADC analog hardware may not be powered) so it may be giving that result.
It should be setting the CF1 bit in QASR if it runs.
> If I zero result registers,
How about writing other patterns?
There may still be some interaction with the debug mode that may stop it from working. I'd suggest loading a small function into memory to initialise and start the QADC and then run it from the debugger.
You found the error. Thank you. Sometimes looking at the same thing too long and I just can't see what's happening. If you were to contact me off list, I would like to send you a Thank You.
Glad to help. Reading the manuals and working these things out is what I do for fun. That you got it working is its own reward.
I can't see why writing 0x40 to the second queue's control register should stop the first queue from working though. You didn't trigger the second queue. Maybe that "unused" bit isn't unused after all?
Tom
Thank you.
Michael