打印
[技术问题解答]

关于K21的7816接口的问题

[复制链接]
2471|17
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
void main (void)
{
  unsigned int i,core_clk_mhz,periph_clk_mhz;     
  extern int mcg_clk_hz,core_clk_khz,periph_clk_khz;
#ifdef VLPR_TEST
  int fast_irc_freq = 4000000;
        /* auto trim internal fast IRC to 4MHz */
        atc(FAST_IRC, fast_irc_freq, mcg_clk_hz);
        
        /* PEE -> PBE */
        mcg_clk_hz = pee_pbe(CLK0_FREQ_HZ);
        /* PBE -> FBE */
        mcg_clk_hz = pbe_fbe(CLK0_FREQ_HZ);
        /* FBE -> FBI */
        mcg_clk_hz = fbe_fbi(fast_irc_freq,FAST_IRC);
        /* FBI -> BLPI */
        mcg_clk_hz = fbi_blpi(fast_irc_freq,FAST_IRC);   
        SIM_CLKDIV1  =  0x00110000;   
        core_clk_khz = mcg_clk_hz/1000;
        periph_clk_khz = core_clk_khz;
        /* Change UART baud rate to 19200 under VLPR mode*/
        uart_init (TERM_PORT, core_clk_khz, 19200);
        printf("\n In blpi mode now ready for entry into VLPR  \n\n");
        enter_vlpr(0);
        PORTC_PCR3 = ( PORT_PCR_MUX(1));
        PORTA_PCR18 = PORT_PCR_MUX(4);//PTA18 as FTM_CLKIN0
#endif
        core_clk_mhz = core_clk_khz/1000;
        periph_clk_mhz = periph_clk_khz/1000;
      
        <span style="background-color: Red;">//CPU =96M, Bus =48M
        //init GPIO, refer to the Firebird Daughter card schematic
        </span>
        // SIM0_VEN - LCD_P33/PTC13/UART4_CTS
        PORTC_PCR13 = PORT_PCR_MUX(1);
        GPIOC_PDOR &= ~(SIM0_VEN_BIT); //VEN set as 0
        GPIOC_PDDR |= (SIM0_VEN_BIT);
         
        // SIM0_RST - LCD_P39/PTC19/UART3_CTS
        PORTC_PCR19 = PORT_PCR_MUX(1);
        GPIOC_PDOR &= ~(SIM0_RST_BIT); //reset set as 0
        GPIOC_PDDR |= (SIM0_RST_BIT);
        
#ifndef VLPR_TEST// in VLPR mode , use FB_CLK for SIM_CLK         
        // SIM0_CLK - LCD_P46/PTD6/FTM0_CH6/FTM0_FLT0
        PORTD_PCR6 = PORT_PCR_MUX(4);//FTM0
#endif                  
        // SIM0_PD - LCD_P38/PTC18/UART3_RTS
        PORTC_PCR18 = PORT_PCR_MUX(1);
        GPIOC_PDDR &= ~(SIM0_PD_BIT);//GPIO input
         
        // SIM0_DATA - LCD_P47/PTD7/CMT_IRO/_UART0_TX
        PORTD_PCR7 = PORT_PCR_MUX(3);
        //PORTB_PCR17 = PORT_PCR_MUX(3);
          printf("\n Kinetis ISO7816 test \n");
        
        if(SIM_PD)
          printf("No Smart Card insert in slot 0\n");
        while(SIM_PD);
        printf("Smart Card inserted in slot 0\n");
#ifndef VLPR_TEST        
        //init the SIM clock, using FTM0_CH6
        SIM_SCGC6 |= SIM_SCGC6_FTM0_MASK;
        FTM0_STATUS;
        FTM0_STATUS = 0;
        //prescale = 1, clock source = bus clock
        <font color="Red">FTM0_CNTIN = 0;</font>

        FTM0_C6SC = FTM_CnSC_MSA_MASK|FTM_CnSC_ELSA_MASK; //ELSB:ELSA= 0b01, MSB:MSA= 0b01 means output compare, tougle output on match
        FTM0_C6V = 1;
        <font color="Red">FTM0_MOD = (periph_clk_mhz/2)/SIM_CLK -1; //generate 2MHz CLK
</font>
        FTM0_MODE |= FTM_MODE_FTMEN_MASK;
        FTM0_OUTMASK &= ~FTM_OUTMASK_CH6OM_MASK;
        <font color="Red">FTM0_SC = FTM_SC_PS(0)|
                  FTM_SC_CLKS(1);</font>
#else
        PORTC_PCR3 = ( PORT_PCR_MUX(0x5));
#endif   
        //init UART to ISO7816 format
        //The SIM_CLK is 2MHz, so the baudrate is 2M/372
        status = IDLE_STATE;
        i = (uint16)((core_clk_mhz)*Fi/(SIM_CLK * 16));
//        SIM_SOPT5 = SIM_SOPT5_UART0TXSRC(0)|SIM_SOPT5_UART0RXSRC(0);
        SIM_SCGC4 |=  SIM_SCGC4_UART0_MASK;
        UART0_BDH |= UART_BDH_SBR(((i & 0x1F00) >> 8));
        UART0_BDL = (uint8)(i & UART_BDL_SBR_MASK);
#ifdef VLPR_TEST
        UART0_C4 = 0x10;  //refine the baudrate
#else
        UART0_C4 = 0x00;
#endif
        //printf("UART0_WP7816T1 = 0x%x\n",UART0_WP7816T1);
        UART0_WP7816T0 = 1; UART0_WF7816 = 1;//set the WT = 960*1*1 =960 etu
//       UART0_WP7816T0 = 1; UART0_WF7816 = 10;//set the WT = 960*1*10 =9600 etu
        //UART0_C7816 |= UART_C7816_TTYPE_MASK;
        //UART0_C7816 |= UART_C7816_ISO_7816E_MASK;
        //printf("UART0_WP7816T1 = 0x%x\n",UART0_WP7816T1);
        //one wire mode, 9bit mode, Even parity
        UART0_C1 = UART_C1_LOOPS_MASK |
                   UART_C1_RSRC_MASK |
                   UART_C1_M_MASK |
//                 UART_C1_PT_MASK| //set Odd parity to see if the NACK error detect and retransfer
                   UART_C1_PE_MASK;
        
        UART0_S2 = 0;
#ifdef INVERSE
        UART0_S2 |= UART_S2_MSBF_MASK | UART_S2_RXINV_MASK;  // inverse mode
#endif
        UART0_MODEM = 0;
        UART0_C3 |= (UART_C3_ORIE_MASK|UART_C3_NEIE_MASK|UART_C3_FEIE_MASK|UART_C3_PEIE_MASK);
#ifdef INVERSE
//        UART0_C3 |= UART_C3_TXINV_MASK; //inverse mode
#endif
        UART0_C4 &= ~(UART_C4_MAEN1_MASK|UART_C4_MAEN2_MASK);
        UART0_C5 = 0;
        UART0_C7816 = UART_C7816_INIT_MASK |
                      UART_C7816_ISO_7816E_MASK |
                      UART_C7816_ONACK_MASK |
                      UART_C7816_ANACK_MASK;
        UART0_C2 =   UART_C2_TE_MASK | UART_C2_RE_MASK;
        
#ifdef  NACK_THRESHOLD_TEST
//        UART0_PFIFO = UART_PFIFO_TXFE_MASK | UART_PFIFO_RXFE_MASK;
        txt_cnt = 0;
        rxt_cnt = 0;
        i = 1;
        UART0_ET7816 = (i<<4)|i;
#endif
//        UART0_IE7816 |= (UART_IE7816_WTE_MASK|UART_IE7816_CWTE_MASK|UART_IE7816_BWTE_MASK|UART_IE7816_GTVE_MASK);
//        UART0_IE7816 |= (UART_IE7816_WTE_MASK|UART_IE7816_GTVE_MASK);
#if 0        
        UART0_C3 |= UART_C3_TXDIR_MASK; //set the TX pin as output

        UART0_TL7816 = 2; //the TLEN does not count the NAD, PCB, LEN, LRC, if use CRC, it should + 1
        UART0_C2 |= UART_C2_TE_MASK; //enable TX
        UART0_D = 0x55;
        UART0_D = 0xaa;
#endif
        if(ATR()!=0)
        {
          printf("ATR failed!\n");
          goto exit0;
        }
        else
          printf("ATR successfull!\n");

        //T=0 transport
        Trans_T0();
        
        //T=1 transport
        Trans_T1();
exit0:
        while(1)
        {
         }
}
以上是7816的demo中代码,对于以上代码的理解是
1、7816协议接口的clk由FTM产生;
2、根据代码中给定sysclk 【Bus Clock=48M】,由FTM0_SC的配置可以得到 FTM_CLK=sysclk/(2^0);
又FTM0_CNT=0(默认为0);FTM0_CNTIN=0;                       
PWM周期= (MOD - CNTIN+1)*FTM_CLK
这个和代码中注释的信息generate 2MHz CLK是否是有问题【备注不定义 VLPR_TEST】
即代码中MOD=(periph_clk_mhz/2)/SIM_CLK -1=48M/2/2 -1=12M-1 【其中#define SIM_CLK 2 //in MHz from FTM0_CH6】

相关帖子

沙发
FSL_TICS_ZJJ| | 2015-1-22 14:50 | 只看该作者
楼主代码哪来的?
还有你用的芯片全称是什么?

使用特权

评论回复
板凳
LZR13179|  楼主 | 2015-1-23 09:06 | 只看该作者
FSL_TICS_ZJJ 发表于 2015-1-22 14:50
楼主代码哪来的?
还有你用的芯片全称是什么?

代码是参考这个代码
目前使用的单片机的全称是K21F120M

使用特权

评论回复
地板
LZR13179|  楼主 | 2015-1-23 09:09 | 只看该作者
刚才的链接是个K53的ISO7816的代码,

iso7816.rar

6.04 KB

使用特权

评论回复
5
LZR13179|  楼主 | 2015-1-23 09:10 | 只看该作者
FSL_TICS_ZJJ 发表于 2015-1-22 14:50
楼主代码哪来的?
还有你用的芯片全称是什么?

我将参考的代码的源码上传到第4楼

使用特权

评论回复
6
LZR13179|  楼主 | 2015-1-23 09:32 | 只看该作者
现在可以看到波形的实践波形是为2MHz的

scope_15.bmp (1.23 MB )

scope_15.bmp

使用特权

评论回复
7
LZR13179|  楼主 | 2015-1-23 10:06 | 只看该作者
FSL_TICS_ZJJ 发表于 2015-1-22 14:50
楼主代码哪来的?
还有你用的芯片全称是什么?

目前K21移植demo中CLK移植正常了。但是由于参考的代码中使用是K53的ISO7816,
【这个是demo中寄存器】
UART0_WP7816T0 = 1;
UART0_WF7816 = 1;//set the WT = 960*1*1 =960 etu
【以下是K53的串口的结构体】
typedef struct UART_MemMap {
  uint8_t BDH;                                     /**< UART Baud Rate Registers:High, offset: 0x0 */
  uint8_t BDL;                                     /**< UART Baud Rate Registers: Low, offset: 0x1 */
  uint8_t C1;                                      /**< UART Control Register 1, offset: 0x2 */
  uint8_t C2;                                      /**< UART Control Register 2, offset: 0x3 */
  uint8_t S1;                                      /**< UART Status Register 1, offset: 0x4 */
  uint8_t S2;                                      /**< UART Status Register 2, offset: 0x5 */
  uint8_t C3;                                      /**< UART Control Register 3, offset: 0x6 */
  uint8_t D;                                       /**< UART Data Register, offset: 0x7 */
  uint8_t MA1;                                     /**< UART Match Address Registers 1, offset: 0x8 */
  uint8_t MA2;                                     /**< UART Match Address Registers 2, offset: 0x9 */
  uint8_t C4;                                      /**< UART Control Register 4, offset: 0xA */
  uint8_t C5;                                      /**< UART Control Register 5, offset: 0xB */
  uint8_t ED;                                      /**< UART Extended Data Register, offset: 0xC */
  uint8_t MODEM;                                   /**< UART Modem Register, offset: 0xD */
  uint8_t IR;                                      /**< UART Infrared Register, offset: 0xE */
  uint8_t RESERVED_0[1];
  uint8_t PFIFO;                                   /**< UART FIFO Parameters, offset: 0x10 */
  uint8_t CFIFO;                                   /**< UART FIFO Control Register, offset: 0x11 */
  uint8_t SFIFO;                                   /**< UART FIFO Status Register, offset: 0x12 */
  uint8_t TWFIFO;                                  /**< UART FIFO Transmit Watermark, offset: 0x13 */
  uint8_t TCFIFO;                                  /**< UART FIFO Transmit Count, offset: 0x14 */
  uint8_t RWFIFO;                                  /**< UART FIFO Receive Watermark, offset: 0x15 */
  uint8_t RCFIFO;                                  /**< UART FIFO Receive Count, offset: 0x16 */
  uint8_t RESERVED_1[1];
  uint8_t C7816;                                   /**< UART 7816 Control Register, offset: 0x18 */
  uint8_t IE7816;                                  /**< UART 7816 Interrupt Enable Register, offset: 0x19 */
  uint8_t IS7816;                                  /**< UART 7816 Interrupt Status Register, offset: 0x1A */
  union {                                          /* offset: 0x1B */
    uint8_t WP7816_T_TYPE0;                          /**< UART 7816 Wait Parameter Register, offset: 0x1B */
    uint8_t WP7816_T_TYPE1;                          /**< UART 7816 Wait Parameter Register, offset: 0x1B */
  };
  uint8_t WN7816;                                  /**< UART 7816 Wait N Register, offset: 0x1C */
  uint8_t WF7816;                                  /**< UART 7816 Wait FD Register, offset: 0x1D */
  uint8_t ET7816;                                  /**< UART 7816 Error Threshold Register, offset: 0x1E */
  uint8_t TL7816;                                  /**< UART 7816 Transmit Length Register, offset: 0x1F */
} volatile *UART_MemMapPtr;
【而在K21中没有UART0_WP7816T0 该寄存器】
下面关于WP7816相关有两处关于WP7816的相关,请问移植的时候使用那个寄存器替代UART0_WP7816T0 = 1;
typedef struct UART_MemMap {
  uint8_t BDH;                                     /**< UART Baud Rate Registers: High, offset: 0x0 */
  uint8_t BDL;                                     /**< UART Baud Rate Registers: Low, offset: 0x1 */
  uint8_t C1;                                      /**< UART Control Register 1, offset: 0x2 */
  uint8_t C2;                                      /**< UART Control Register 2, offset: 0x3 */
  uint8_t S1;                                      /**< UART Status Register 1, offset: 0x4 */
  uint8_t S2;                                      /**< UART Status Register 2, offset: 0x5 */
  uint8_t C3;                                      /**< UART Control Register 3, offset: 0x6 */
  uint8_t D;                                       /**< UART Data Register, offset: 0x7 */
  uint8_t MA1;                                     /**< UART Match Address Registers 1, offset: 0x8 */
  uint8_t MA2;                                     /**< UART Match Address Registers 2, offset: 0x9 */
  uint8_t C4;                                      /**< UART Control Register 4, offset: 0xA */
  uint8_t C5;                                      /**< UART Control Register 5, offset: 0xB */
  uint8_t ED;                                      /**< UART Extended Data Register, offset: 0xC */
  uint8_t MODEM;                                   /**< UART Modem Register, offset: 0xD */
  uint8_t IR;                                      /**< UART Infrared Register, offset: 0xE */
  uint8_t RESERVED_0[1];
  uint8_t PFIFO;                                   /**< UART FIFO Parameters, offset: 0x10 */
  uint8_t CFIFO;                                   /**< UART FIFO Control Register, offset: 0x11 */
  uint8_t SFIFO;                                   /**< UART FIFO Status Register, offset: 0x12 */
  uint8_t TWFIFO;                                  /**< UART FIFO Transmit Watermark, offset: 0x13 */
  uint8_t TCFIFO;                                  /**< UART FIFO Transmit Count, offset: 0x14 */
  uint8_t RWFIFO;                                  /**< UART FIFO Receive Watermark, offset: 0x15 */
  uint8_t RCFIFO;                                  /**< UART FIFO Receive Count, offset: 0x16 */
  uint8_t RESERVED_1[1];
  uint8_t C7816;                                   /**< UART 7816 Control Register, offset: 0x18 */
  uint8_t IE7816;                                  /**< UART 7816 Interrupt Enable Register, offset: 0x19 */
  uint8_t IS7816;                                  /**< UART 7816 Interrupt Status Register, offset: 0x1A */
  uint8_t WP7816;                                  /**< UART 7816 Wait Parameter Register, offset: 0x1B */
  uint8_t WN7816;                                  /**< UART 7816 Wait N Register, offset: 0x1C */
  uint8_t WF7816;                                  /**< UART 7816 Wait FD Register, offset: 0x1D */
  uint8_t ET7816;                                  /**< UART 7816 Error Threshold Register, offset: 0x1E */
  uint8_t TL7816;                                  /**< UART 7816 Transmit Length Register, offset: 0x1F */
  uint8_t RESERVED_2[1];
  uint8_t C6;                                      /**< UART CEA709.1-B Control Register 6, offset: 0x21 */
  uint8_t PCTH;                                    /**< UART CEA709.1-B Packet Cycle Time Counter High, offset: 0x22 */
  uint8_t PCTL;                                    /**< UART CEA709.1-B Packet Cycle Time Counter Low, offset: 0x23 */
  uint8_t B1T;                                     /**< UART CEA709.1-B Beta1 Timer, offset: 0x24 */
  uint8_t SDTH;                                    /**< UART CEA709.1-B Secondary Delay Timer High, offset: 0x25 */
  uint8_t SDTL;                                    /**< UART CEA709.1-B Secondary Delay Timer Low, offset: 0x26 */
  uint8_t PRE;                                     /**< UART CEA709.1-B Preamble, offset: 0x27 */
  uint8_t TPL;                                     /**< UART CEA709.1-B Transmit Packet Length, offset: 0x28 */
  uint8_t IE;                                      /**< UART CEA709.1-B Interrupt Enable Register, offset: 0x29 */
  uint8_t WB;                                      /**< UART CEA709.1-B WBASE, offset: 0x2A */
  uint8_t S3;                                      /**< UART CEA709.1-B Status Register, offset: 0x2B */
  uint8_t S4;                                      /**< UART CEA709.1-B Status Register, offset: 0x2C */
  uint8_t RPL;                                     /**< UART CEA709.1-B Received Packet Length, offset: 0x2D */
  uint8_t RPREL;                                   /**< UART CEA709.1-B Received Preamble Length, offset: 0x2E */
  uint8_t CPW;                                     /**< UART CEA709.1-B Collision Pulse Width, offset: 0x2F */
  uint8_t RIDT;                                    /**< UART CEA709.1-B Receive Indeterminate Time, offset: 0x30 */
  uint8_t TIDT;                                    /**< UART CEA709.1-B Transmit Indeterminate Time, offset: 0x31 */
  uint8_t RESERVED_3[8];
  uint8_t AP7816A_T0;                              /**< UART 7816 ATR Duration Timer Register A, offset: 0x3A */
  uint8_t AP7816B_T0;                              /**< UART 7816 ATR Duration Timer Register B, offset: 0x3B */
  union {                                          /* offset: 0x3C */
    struct {                                         /* offset: 0x3C */
      uint8_t WP7816A_T0;                              /**< UART 7816 Wait Parameter Register A, offset: 0x3C */
      uint8_t WP7816B_T0;                              /**< UART 7816 Wait Parameter Register B, offset: 0x3D */
    } TYPE0;
    struct {                                         /* offset: 0x3C */
      uint8_t WP7816A_T1;                              /**< UART 7816 Wait Parameter Register A, offset: 0x3C */
      uint8_t WP7816B_T1;                              /**< UART 7816 Wait Parameter Register B, offset: 0x3D */
    } TYPE1;
  };
  uint8_t WGP7816_T1;                              /**< UART 7816 Wait and Guard Parameter Register, offset: 0x3E */
  uint8_t WP7816C_T1;                              /**< UART 7816 Wait Parameter Register C, offset: 0x3F */
} volatile *UART_MemMapPtr;

使用特权

评论回复
8
FSL_TICS_ZJJ| | 2015-1-23 10:25 | 只看该作者
实际K21也是有UART0_WP7816T0寄存器的,而且地址和K53的是一样的。
你直接用UART0_WP7816T0 = 1; 会报错吗?
看看头文件中有没有这个定义。

使用特权

评论回复
9
LZR13179|  楼主 | 2015-1-23 10:33 | 只看该作者
FSL_TICS_ZJJ 发表于 2015-1-23 10:25
实际K21也是有UART0_WP7816T0寄存器的,而且地址和K53的是一样的。
你直接用UART0_WP7816T0 = 1; 会报错吗 ...

这个是K53  
union {                                          /* offset: 0x1B */
    uint8_t WP7816_T_TYPE0;                          /**< UART 7816 Wait Parameter Register, offset: 0x1B */
    uint8_t WP7816_T_TYPE1;                          /**< UART 7816 Wait Parameter Register, offset: 0x1B */
  };
和下面的
uint8_t WP7816;                                  /**< UART 7816 Wait Parameter Register, offset: 0x1B */
相同

使用特权

评论回复
10
LZR13179|  楼主 | 2015-1-23 10:35 | 只看该作者
LZR13179 发表于 2015-1-23 10:33
这个是K53  
union {                                          /* offset: 0x1B */
    uint8_t WP7816 ...

但是不明白与K21的
前面的WP7816与
union {                                          /* offset: 0x3C */
    struct {                                         /* offset: 0x3C */
      uint8_t WP7816A_T0;                              /**< UART 7816 Wait Parameter Register A, offset: 0x3C */
      uint8_t WP7816B_T0;                              /**< UART 7816 Wait Parameter Register B, offset: 0x3D */
    } TYPE0;
    struct {                                         /* offset: 0x3C */
      uint8_t WP7816A_T1;                              /**< UART 7816 Wait Parameter Register A, offset: 0x3C */
      uint8_t WP7816B_T1;                              /**< UART 7816 Wait Parameter Register B, offset: 0x3D */
    } TYPE1;
  };
的区别

使用特权

评论回复
11
FSL_TICS_ZJJ| | 2015-1-23 10:50 | 只看该作者
LZR13179 发表于 2015-1-23 10:35
但是不明白与K21的
前面的WP7816与
union {                                          /* offset: 0x3C  ...

我认为还是用之前定义的:
uint8_t WP7816;                                  /**< UART 7816 Wait Parameter Register, offset: 0x1B */
因为这个偏移地址和实际RM中的寄存器表是对应的:


而后面定义的:union {                                          /* offset: 0x3C */
    struct {                                         /* offset: 0x3C */
      uint8_t WP7816A_T0;                              /**< UART 7816 Wait Parameter Register A, offset: 0x3C */
      uint8_t WP7816B_T0;                              /**< UART 7816 Wait Parameter Register B, offset: 0x3D */
    } TYPE0;
    struct {                                         /* offset: 0x3C */
      uint8_t WP7816A_T1;                              /**< UART 7816 Wait Parameter Register A, offset: 0x3C */
      uint8_t WP7816B_T1;                              /**< UART 7816 Wait Parameter Register B, offset: 0x3D */
    } TYPE1;
  };

实际寄存器偏移地址,最高到0x31,代码定义到0X3C应该是不可用的:


使用特权

评论回复
12
LZR13179|  楼主 | 2015-1-26 14:48 | 只看该作者
本帖最后由 LZR13179 于 2015-1-26 14:51 编辑
FSL_TICS_ZJJ 发表于 2015-1-23 10:50
我认为还是用之前定义的:
uint8_t WP7816;                                  /**< UART 7816 Wait Para ...

使用 UART_WP7816_REG(ptr) = 1;在K21的工程下,出现****default_isr entered on vector 3*****;
对代码进行debug发现是执行 UART_WP7816_REG(ptr) = 1;的时候(K21使用 UART_WP7816_REG(ptr) = 1;来替代K53中UART0_WP7816T0 = 1;)

使用特权

评论回复
13
LZR13179|  楼主 | 2015-1-26 14:56 | 只看该作者
LZR13179 发表于 2015-1-26 14:48
使用 UART_WP7816_REG(ptr) = 1;在K21的工程下,出现****default_isr entered on vector 3*****;
对代码 ...

而使用 UART_WP7816A_T0_REG(base)和UART_WP7816B_T0_REG(base)来替代  K53的WP7816的时候也会出现相同的错误提示

使用特权

评论回复
14
Thefantasy| | 2015-1-26 20:46 | 只看该作者
实际K21也是有UART0_WP7816T0寄存器的,而且地址和K53的是一样的。
你直接用UART0_WP7816T0 = 1; 会报错吗?
看看头文件中有没有这个定义。

使用特权

评论回复
15
LZR13179|  楼主 | 2015-1-27 10:29 | 只看该作者
Thefantasy 发表于 2015-1-26 20:46
实际K21也是有UART0_WP7816T0寄存器的,而且地址和K53的是一样的。
你直接用UART0_WP7816T0 = 1; 会报错吗 ...

这个是K53中的WP7816T0的寄存器的
union {                                          /* offset: 0x1B */
    uint8_t WP7816_T_TYPE0;                          /**< UART 7816 Wait Parameter Register, offset: 0x1B */
    uint8_t WP7816_T_TYPE1;                          /**< UART 7816 Wait Parameter Register, offset: 0x1B */
  };
下面是K21的
  uint8_t WP7816;                                  /**< UART 7816 Wait Parameter Register, offset: 0x1B */
在使用的时候出现硬件错误的提示

使用特权

评论回复
16
LZR13179|  楼主 | 2015-1-27 10:33 | 只看该作者
LZR13179 发表于 2015-1-27 10:29
这个是K53中的WP7816T0的寄存器的
union {                                          /* offset: 0x1B  ...

那时候使用的是UART1的,现在使用UART0的看看是不是有相同的问题。觉得UART1不支持,试试uart0(这个是支持7816的)相同的设置是否还会出现相同的问题

使用特权

评论回复
17
sunriselight| | 2015-1-27 12:17 | 只看该作者
实施UART0,烧例程看看

使用特权

评论回复
18
LZR13179|  楼主 | 2015-4-8 19:19 | 只看该作者
目前uart0的7816的链路层已经配置好了

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

6

主题

87

帖子

1

粉丝