Problem receiving

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem receiving

1,735 Views
kacto
Contributor I
I`m sending bytes trough sci to pc, but not receiving what i'm supossed to, can anyone tell me why?
Here is my test code for a gp32.  9600 bd, 1 bit stop, no parity
 
main: rsp
          mov     #$00,CONFIG2  
          mov     #$11,CONFIG1   
          nop
          nop
          cli
          mov   #$20,SCBR      ; Baud Rate = 9600
          mov   #$40,SCC1      ; Enable the SCI peripheral
          mov   #$0C,SCC2     ; Enable TX and Rx
          lda   scs1    
REP:brclr   7,scs1,*
        mov     'H',scdr
        brclr   7,scs1,*
        mov     'E',scdr
        brclr   7,scs1,*
        mov     'L',scdr
        brclr   7,scs1,*
        mov     'L',scdr
        brclr   7,scs1,*
        mov     'O',scdr
        brclr   7,scs1,*
        jmp     REP
 
I also tried using    "mov  #'H',scdr"       but din't work neither.
 
This is what i get on Realterm Software in hex
 
EC 69 98 2F 09 6C 29 98 2F 2B EC 29 98 6F 09 EC 29 18 2F 09 EC 6B 98 2F
09 4C 29 98 2F 23 EC 29 98 6F 09 EC 29 98 2F 09 EC 29 98 2F 09 F6 8C 65............
 
This is what appears watching the ascii code
 
öŒe¥$zŒe¥$zLf¥$zŒe¥ä{Œe$zŒ%¥$zLf¥$zŒe¥Æ{Œe $zŒg¥$zNf¥${Œe¥Æ{Œe)˜/             
Œe$zŒe¥$zLf¥$zŒe¥Ä{Œe $zŒg¥$zNf¥${Œe¥Æ{Œe $zŒg¥$zŒe¥${Œe¥$zŒe)˜/)ì)˜o ........
Any help will be good.
Regards
 

 
Labels (1)
0 Kudos
4 Replies

529 Views
Ake
Contributor II
Hi,
I took your code and tried to to run it on a ICS08GP board.
The baudrate seemed to be too high, so I corrected
          mov   #$21,SCBR      ; Baud Rate = 9600
 
Then the TE bit was not set. Instead the TCIE bit was set.
I changed that to.
          mov   #mSCC2_TE,SCC2     ; Enable TX 
   
and now it works!
 
Regards,
Ake
0 Kudos

529 Views
bigmac
Specialist III
Hello,
 
Your code should definitely be modified for immediate addressing mode, i.e.  mov #'H',scdr.  Your code would otherwise be reading values from various locations in page zero - not what you intend.
 
If you still have problems after these changes, maybe your bus frequency isn't quite what you have assumed for the SCBR setting.
 
Regards,
Mac
 
0 Kudos

529 Views
peg
Senior Contributor IV
Hi ,
Well you definately need those #'s
If you re-arrange the hex output, you get:

EC 69 98 2F 09
6C 29 98 2F 2B
EC 29 98 6F 09
EC 29 18 2F 09
EC 6B 98 2F 09
4C 29 98 2F 23
EC 29 98 6F 09
EC 29 98 2F 09
EC 29 98 2F 09
F6 8C 65

This is I assume without the #'s
But you can see you are mostly just getting single bit errors.
This would tend to suggest thaat the baudrate is in the ballpark but not close enough.
BTW you are looking for
48 45 4C 4C 4F

0 Kudos

529 Views
kacto
Contributor I
I've already fixed it. I miss calculated de baud rate. I asumed it was 9600 but it was 19200 so i corrected that and now is working fine. I used the "#" in my original code, I just changed it to see if that was the problem, but now that i know what was wrong i put it back again. Thanks
 
Regards 
Kacto
0 Kudos