Can't get QB4 to work with internal oscillator or external

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Can't get QB4 to work with internal oscillator or external

5,169件の閲覧回数
penguin
Contributor I
I am a newbie and I believe that the assembler program I wrote to toggle the PortB output pins works.  I believe this since I used P&E Cyclone Pro in HC08 debugger mode and ran the code and it produced a square wave as I expected on the PortB pins,  I then tryed to run it on a prototype board and it won't produce any output on the PortB pins.  I have checked to ensure that there is power and ground supplied.  I also have the reset pin tied High and the IRQ pin tied high through external pullup resistors.  I have also got the Ceramic and Tanalum bypass Capacitors  on VDD.
 
When I ran the code on the P&E Cyclone Pro I got a square wave with a period of 40 usec.  20 usecs high and low.  Here is my code that I used.
 
        org   START
 
****************************************
           rsp
        
test4     lda   #%11111110
            sta   PORTB   ;
        
        
test5     sta   COPCTL
            lda   #%11111110
            sta   DDRB    ;PTB,5 is output because NC
        
            LDA PORTB
TEST7  EOR #%11111110
            STA PORTB; toggle portb output         
            BRA   TEST5
Your help would be much appriciated  
ラベル(1)
0 件の賞賛
返信
5 返答(返信)

912件の閲覧回数
penguin
Contributor I
Thank you for your help Encoder but, I tryed your S19 file on the prototype board and got nothing.   I have been using the P&E Cyclone Pro to program and the HC08 Debugger to test the code.  I am using CASM08 to asseble and build the S19 file that I use for programming.  The code works ok when it is used in the Cyclone Pro Debugger program, but not on the prototype board.
0 件の賞賛
返信

912件の閲覧回数
Encoder
Contributor I
Sorry for that.
I can't see anything obviously wrong on your code and infact it works, provided initial declarations. My interrupt dummy entries are only optional.
My hardware is the 50$ DEMO908QB8 board from Axiom for Freescale, connected via on board USB P&E interface to Codewarrior.
 
I am not familiar with Cyclone Pro, but I liked P&E tools and CASM which I used for HC705 environment. Unfortunately Codewarrior assembly is much more complex than that required by CASM and not immediately easy to translate. .prm file is much C-like and it was hard for me to discover how it worked (it is still a bit misterious).
 
I suspect that you have some problem with the QB4 memory map or the vector initialization. Can you try to load my Codewarrior file to Cyclone Pro? I know it is supported and you shoud be able to operate simply changing the target hardware from my "class 7" to what needed by Cyclone Pro (I think "class 8"). And Codewarrior is free for this task...
 
At the end I tried to write the whole program, including declaration in (what I remember as) CASM fashion, I am not shure of it but it may work. I cannot test. It could be:
 
*********************************************
* QB4 TEST #1 sample program for 908qb4
*********************************************
; QB4 standard equates (excerpt)
PORTA   EQU   $00      ;I/O port A
PORTB   EQU   $01      ;I/O port B
DDRA    EQU   $04      ;Data direction port A
DDRB    EQU   $05      ;Data direction port B
OSCSC   EQU $36
IntOSCm EQU %00000000 ;Set int. oscillator
ExtOSCm EQU %01000000 ;Set ext. oscillator
MHz4m   EQU %00000000 ;Set int. clock to 4MHz
MHz8m   EQU %00010000 ;Set int. clock to 8MHz
MHz12m8 EQU %00100000 ;Set int. clock to 12.8MHz
OSCTRM        EQU $0038
OSCTRMDEFAULT EQU $FFC0 ;Factory preset oscill. trim factor
 
; Memory area equates
RAMStart  EQU  $0080    ;Start of on-chip RAM
ROMStart  EQU  $EE00    ;Start of on-chip FLASH
Vectors   EQU  $FFDE    ;Interrupt vector area
ResetVec  EQU  $FFFE    ;Reset vector address
 
; Program variables
       ORG  RAMStart  ;RAM area allocations
*
*
************************************************
* Main program area
************************************************
       ORG  ROMStart
; COP is active by default to 262128 oscillator
; cycles (nearly 20ms)
;  bset  COPD,CONFIG1      ;Disables COP
 
Start  rsp
      lda  OSCTRMDEFAULT
      sta  OSCTRM  ;Preset oscill. trim factor
      mov  #(IntOSCm+MHz12m8),OSCSC
; Enables internal oscillator & set bus freq. 
; Bus clock= 3.2MHz 
test4 lda   #%11111110
      sta   PORTB
       
main_loop:
       
test5 sta   COPCTL   ; manages COP
      lda   #%11111110
      sta   DDRB     ; all PTB lines as output but PB0
       
      lda   PORTB
test7 eor   #%11111110
      sta   PORTB     ;toggle portb output
      bra   test5     ; Forever

************************************************
* Reset vector initialization
************************************************
       ORG  ResetVec
RESETV DW   Start
 
Encoder
0 件の賞賛
返信

912件の閲覧回数
joerg
Contributor II
Dear penguin

You can try the EBS08 for the QBx micros, i have adjusted the Qx version for the QB family, so why do not try it?

he whole project can be found:

http://www.systech-gmbh.ch -> EBS08

Saluti joerg
0 件の賞賛
返信

912件の閲覧回数
penguin
Contributor I

Thank You Joerg and Encoder for your help.

 We finally figured out what the problem was, it was that for some reason the Cyclone Pro programmer and debuger had to program the QB4's twice in a row without erasing them in between for the QB4's to work.   The funny thing was that the 4 QB4's would program and verify if they were only programmed once like you are supposed too.  I have to talk to Freescale and P&E to see why this is so. 

 

Thanks for all your help once again.

0 件の賞賛
返信

912件の閲覧回数
Encoder
Contributor I
Your sample program is perfectly functional: I tested it on DEMO908QB8 board.
 
Obviously it lacks some initialization and declarations. How have you assembled and loaded the program?
I assembled it with Codewarrior 3.1 on a framework I used for slightly wider purposes. Note that the original QB_regs.inc for QB4/8 supplied as example was wrong and I entirely rewrote it.
 
All portB pins but PTB0 are toggling at some 24us cycle on my old home tek with and without the pc-pod. The main program was intentionally last "as it was" other than declarations and initialization. Interrupt service routine entries were left for future use, but are not used and can be removed.
 
The program is very small but the revised QB8.inc is much bigger. It includes also the .prm file for linking. I don't know how to do: I will try to attach the whole zipped codewarrior file (QB8_asm_test1.zip 38k). It may be used as a starter framework.
0 件の賞賛
返信