[RF/Radioelec] DSPIC30F UART RX Problem
Répondre à la discussion
Affichage des résultats 1 à 1 sur 1

DSPIC30F UART RX Problem



  1. #1
    Le0

    DSPIC30F UART RX Problem


    ------

    hey!! i'am using a DSPIC30f4013 and i'm not able to receive the correct sent carracter.

    So on 1 side i got a the PIC with the transmit routine wich work perfectly has when i look at the Tx port with a scop i can see the value been sent.

    for the receiving end it just don't give me the correct caracter sent. I feel like it's an issue with receiving buffer becuz i will get the correct data at times, when i read the Rx register in interrupt routine.

    i set the pic to generate interrupt on a full buffer and only on one caracter received but same result: can have the expected data sent

    ============================== ============================== ==============================

    bonjour, j'essaye de mettre en place une comm avec UART de Mon DSPIC
    La transmission est réussi par lecture du port de TX du module
    Par contre la reception NON! le code de la reception est joint et aussi simple qu'il puisses paraitre il semble y avoir de la gestion de tempons a faire ''je penses''
    mais que faire? avez vous des suggestions?


    here is my routine:

    Code:
    		.equ __30F4013, 1
    		.include "p30f4013.inc
    		
    ; -----------------------------------------------------------------------------
    ;    Global Declarations
    ; -----------------------------------------------------------------------------
    config __FOSC, XT_PLL4 & CSW_FSCM_OFF
    ; config __FWDT 0x3F ; 
     config __FWDT, WDTPSB_16 & WDTPSA_512 & WDT_OFF
    ; config __FBORPOR 0x87B3 ; 
     config __FBORPOR, PWRT_64 & BORV20 & PBOR_ON & MCLR_EN
    ; config __FGS 0x7 ; 
     config __FGS, GWRP_OFF & CODE_PROT_OFF
    ; config __FICD 0xC003 ; 
     config __FICD, ICS_PGD
     
     #include <xc.h>
    
    ; ------------------------------------------------------------------------------
    		
    			        .global  _Init_UART
    		                .global __reset 
    				.global _wreg_init
    				.global PORT_init
    				.GLOBAL __U2RXInterrupt
    				.global __OC1Interrupt
    				.global __T2Interrupt 
    				
    	
    				
    ; -----------------------------------------------------------------------------
     .section .nbss, bss, near
                                         
    PotRP1:	      .space 2 
    
    
    ;..............................................................................
    ;Code Section in Program Memory
    ;..............................................................................
    .text                             ;Start of Code section
         
    __reset:
            MOV #__SP_init, W15       ;Initalize the Stack Pointer
            MOV #__SPLIM_init, W0     ;Initialize the Stack Pointer Limit Register
            MOV W0, SPLIM
            NOP     
    	
    	call _wreg_init
    	call PORT_init
    	call _Init_UART
    		
    	
    RECEPTION:	
    	
    	BRA RECEPTION
    	
    					       
    	
    
    PORT_init:
        
    	BCLR  TRISC,#RC14				 
    	BCLR  TRISC,#RC13
    	
    	return
    	
    _Init_UART:                           
        
    	mov #95, w0
    	mov w0, U2BRG
    	BSET IPC6,#U2RXIP2 
    	BCLR IPC6,#U2RXIP1 
    	BCLR IPC6,#U2RXIP0 
    	
    	clr U2STA
    	mov #0x8800, w0		;
    	mov w0, U2MODE 
    	
    	BSET IEC1, #U2RXIE
    	BSET U2STA,#UTXEN
    	 
    
    	return
                
    	
        	  
    ;..............................................................................
    ;Subroutine: Initialization of W registers to 0x0000
    ;..............................................................................
    
    	
    _wreg_init:
            CLR W0
            MOV W0, W14
            REPEAT #12
            MOV W0, [++W14]
            CLR W14
            RETURN
        
    __U2RXInterrupt:
        
    	PUSH W10
    	
    	clr w10
    	mov  U2RXREG, W10
    	
            BCLR IFS1, #U2RXIF 	
    	
    	PUSH W10
    	
    	retfie	
    	
    	.end
    ;..............................................................................
    ;Subroutine: portf Init 
    ;..............................................................................

    -----
    Dernière modification par gienas ; 04/09/2021 à 07h23. Motif: Ajouté les balises code obligatoires pour les programmes

Discussions similaires

  1. Impossible de programmer dsPIC30F
    Par invitec51e91ed dans le forum Électronique
    Réponses: 5
    Dernier message: 31/01/2013, 14h23
  2. Dspic30f
    Par invitec99a3210 dans le forum Électronique
    Réponses: 1
    Dernier message: 02/05/2010, 11h13
  3. CAN sur dsPIC30F
    Par invite25df009a dans le forum Électronique
    Réponses: 5
    Dernier message: 25/02/2010, 07h55
  4. Aide CAN sur dsPIC30f
    Par invite25df009a dans le forum Électronique
    Réponses: 3
    Dernier message: 14/01/2010, 14h14
  5. Dspic30f --- I2c --- Cmps03
    Par invite018af9d8 dans le forum Électronique
    Réponses: 1
    Dernier message: 11/10/2007, 14h06
Dans la rubrique Tech de Futura, découvrez nos comparatifs produits sur l'informatique et les technologies : imprimantes laser couleur, casques audio, chaises gamer...