Searching \ for '[PIC] dsPIC33 UART' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'dsPIC33 UART'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] dsPIC33 UART'
2011\06\29@052343 by IVP

face picon face
part 1 4725 bytes content-type:text/plain; charset="iso-8859-1" (decoded quoted-printable)

Hi all,

does anyone have a code example for a dsPIC33 UART using flow
control ?

I'm trying to set up comms between the PIC and a Vinculum Vdrive2
using Tx/Rx/RTS/CTS but getting getting inconclusive results. Section
17 of the dsPIC datasheet

mentions what RTS and CTS do but doesn't explain all that much,
nor include them in timing diagrams, which would have been helpful.
I've looked around Microchip's site, no obvious AN

Below are various settings. After the initialisation, executing

          mov     #0x000d,w0
          mov     w0,U1TXREG

confirms timing with 104us bit times on Tx. The Vdrive2 does put
out data on power-up (although I've yet to find the short sequences
of characters in its manual so they're possibly random), also 104us
bit times, seen on Rx. There's no acivity on either RTS or CTS. What
I expected to see was RTS low before and after sending the Carriage
Return, and high during the transmission. CR is a 'flashdrive present ?'
query to the Vdrive2 that should elicit a response from it

RTS and CTS have 16k pullups

Attached is what is seen after /mclr goes high. A flurry of so-far
unidentified data from the Vdrive2, then my pause and two CRs
sent, 10ms apart. Note that RTS does change state 5ms after the
reset. This is well after the PIC's registers have been configured
and in the middle of a simple 10ms delay that involves no pins

Any help would be much appreciated. At this stage I'm in a "Jim
Hacker" situation - don't know what I don't know ;-)) !!




          mov     #0b0000000000001110,w0
;                           0000            LCD data
;                               0           En
;                                0          RS
;                                 1         /CTS (in)
;                                  1        TX
;                                   1       RX
;                                    0      /RTS (out)
          mov     w0,TRISB

;peripheral pin assignments

; RP0 = RTS  RB0 o/p
; RP1 = RX   RB1 i/p
; RP2 = TX   RB2 o/p
; RP3 = CTS  RB3 i/p

;/U1RTS 00100 RP0 (RB0) tied to UART1 /RTS

          mov     #0b0000000000000100,w0
;                     ---xxxxx---00100
          mov     w0,RPOR0

; U1TX 00011 RP2 (RB2) tied to UART1 Tx

          mov     #0b0000000000000011,w0
;                     ---xxxxx---00011
          mov     w0,RPOR1

;  U1RX 00001 RP1 (RB1) tied to UART1 Rx
;/U1CTS 00011 RP3 (RB3) tied to UART1 /CTS

          mov     #0b0000001100000001,w0
;                     ---00011---00001
          mov     w0,RPINR18

          mov     #0b1000001000010010,w0
;                     1                     UART enabled
;                      x
;                       0                   continue in Idle mode
;                        0                  IrDA disabled
;                         0                 /RTS pin in Flow Control mode
;                          x
;                           10              Tx, Rx, /RTS and /CTS enabled
;                             0             Wake-up disabled
;                              0            Loop-back disabled
;                               0           Auto-baud disabled
;                                1          Rx idle state = '0'
;                                 0         BGRH = 0, low speed mode
;                                  01       8, N
;                                    0      1 stop bit
          mov     w0,U1MODE

          mov     #0b0000010000000000,w0
;                     0 0                   transmit interrupt mode
;                      0                    Tx idle state = '0'
;                        x
;                         0                 Synch break disabled
;                          1                transmit enabled
;                           -               Transmit Buffer status
;                            -              Transmit Shift Register status
;                             00            receive interrupt mode
;                               -           Address detect
;                                -          receiver idle
;                                 -         parity error
;                                  -        framing error
;                                   -       over-run error
;                                    -      receive data available
          mov     w0,U1STA

;Fcy = 27.648MHz, baud rate = 9600

;UxBRG = ((Fcy/baud rate)/16)-1

;UxBRG = ((27648000/9600)/16)-1

;UxBRG = 179

          mov     #179,w0                  ;baud rate, 9600 8 N 1
          mov     w0,U1BRG

part 2 5456 bytes content-type:image/gif; name="dsPIC_Vdrive2_reset.gif" (decode)

part 3 181 bytes content-type:text/plain; name="ATT00001.txt"
(decoded base64)

-- PIC/SX FAQ & list archive
View/change your membership options at

2011\06\30@022108 by cdb


I haven't used the dsPicc33 as yet and none of the books (like Creed Huddleston) demo code uses RTS/CTS etc.

Would it help if I sent you Microchips 'C' code setup examples from their C30 library, to see if their figures agree with yours?

Does your Pic have reconfigurable pins, if so have they been reconfigured correctly?

cdb, on 30/06/2011
Web presence:   Hosted by:

More... (looser matching)
- Last day of these posts
- In 2011 , 2012 only
- Today
- New search...