usart clock

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

usart clock

2,404 Views
syedhashmiraza
Contributor III

helllo iam using lpc55s69 board and in that iam taking two usart zero for rx tx and usart 1 for genrate clock for iso7816 protocol communication with smatcard in that i want to genatrate 705mhz  clock in usart 1 how to genarate clock in usart 1?

Tags (1)
0 Kudos
Reply
6 Replies

2,378 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that the uart of LPC55xx does not support iso7816 protocol,  if you do want a chip which supports iso7816 protocol, I suggest you consider

MCXN family for example MCXN947, which has dedicated EMVSIM module

https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mc...

 

xiangjun_rong_0-1733112525465.png

 

Hope it can help you

BR

Xiangjun Rong

 

0 Kudos
Reply

2,370 Views
syedhashmiraza
Contributor III

hello my question is how to genarate clock on usart for lpc5569

Tags (1)
0 Kudos
Reply

2,357 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Regarding your question, the UART driving clock can not exceed 44Mhz.

For the FRG module, each FCx module has it's own FRGx module. The FRG has MULT and DIV parts, the DIV is fixed to be 0xFF or 256 in decimal.

The uart driving clock is from FRG, the FRG clock is

CLK/(1+MULT/DIV)=CLK*DIV/(MULT+DIV)

 

 

xiangjun_rong_1-1733119587705.png

The CLK configuration tools has the GUI to set the FC module clock

xiangjun_rong_2-1733123098795.png

The Multiply is fixed 256 in decimal, the DIV is from 256 to 511 in decimal

so you can configure the uart clock, but it can not exceed 44mhz.

If you set the FRGCTRLx_DIV as 436, the uart driving clock can be 44MHz.

Hope it can help you

BR

XiangJun Rong

 

0 Kudos
Reply

2,135 Views
syedhashmiraza
Contributor III

HELLO  I Tried this one but in usart not genrating clock , can you provide a code or more information?

Tags (1)
0 Kudos
Reply

2,083 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Can you post you project and tell us the target so that we  can support you

BR

XiangJun Rong

0 Kudos
Reply

2,072 Views
syedhashmiraza
Contributor III

hello i want to genarate clock on usart 7.5mhz , and the clock generate continous , how i can genarte the usart clock?

#include "pin_mux.h"
#include "board.h"
#include "fsl_usart.h"
#include <stdbool.h>
#include "fsl_power.h"
 
/*******************************************************************************
 * Definitions
 ******************************************************************************/
#define DEMO_USART            USART0
#define DEMO_USART_CLK_SRC    kCLOCK_Flexcomm1
#define DEMO_USART_CLK_FREQ   CLOCK_GetFlexCommClkFreq(0U)
#define DEMO_USART_IRQHandler FLEXCOMM0_IRQHandler
#define DEMO_USART_IRQn       FLEXCOMM0_IRQn
 
/*! @brief Ring buffer size (Unit: Byte). */
#define DEMO_RING_BUFFER_SIZE 16
 
/*******************************************************************************
 * Prototypes
 ******************************************************************************/
 
 
#define CARD_CLK           6000000                      ///< Target card clock rate.
#define CARD_CLK_DIV       (SystemCoreClock / CARD_CLK) ///< Clock divisor from core clock to card clock.
#define DEFAULT_ETU        372
#define GPIO_PORT 1
#define GPIO_PIN  9
 
//#define    IOCON_INDEX_PIO0_9
//#define IOCON_PIN_CARD_CLK IOCON_INDEX_PIO0_9
 
static uint16_t currentETU = DEFAULT_ETU;
 
 
/*******************************************************************************
 * Variables
 ******************************************************************************/
uint8_t g_tipString[] =
    "USART functional API interrupt example\r\nBoard receives characters then sends them out\r\nNow please input:\r\n";
 
uint8_t demoRingBuffer[DEMO_RING_BUFFER_SIZE];
volatile uint16_t txIndex;
volatile uint16_t rxIndex;
volatile uint16_t lastRxIndex; // Variable to store the last received index
 
/*******************************************************************************
 * Code
 ******************************************************************************/
void ISO7816_SetClocks() {
CLOCK_EnableClock(kCLOCK_FlexComm0);
CLOCK_AttachClk(kMAIN_CLK_to_FLEXCOMM0);
CLOCK_EnableClock(kCLOCK_FlexComm1);
CLOCK_AttachClk(kMAIN_CLK_to_FLEXCOMM1);
}

 

 

int main(void)                                 
{
 
    CLOCK_SetupFROClocking(12000000U);
//CLOCK_SetMainClkSrc(kCLOCK_MainClkSrcFro);
        CLOCK_GetMclkClkFreq();
SystemCoreClockUpdate();
 
 
 
    usart_config_t config;
 
    POWER_SetBodVbatLevel(kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false);
    CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH);
    BOARD_InitBootPins();
    BOARD_BootClockFRO12M();
    BOARD_InitDebugConsole();
 
 
         CLOCK_EnableClock(kCLOCK_Iocon);
CLOCK_EnableClock(kCLOCK_Gpio0);
CLOCK_EnableClock(kCLOCK_Gpio1);
ISO7816_SetClocks();
ISO7816_Init();
// GPIO_PinWrite(GPIO, GPIO_PORT, GPIO_PIN, 1);
 
  IOCON_PinMuxSet(IOCON,GPIO_PORT ,GPIO_PIN, IOCON_MODE_PULLDOWN);
 
    USART_GetDefaultConfig(&config);
    config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;
    config.enableTx     = true;
    config.enableRx     = true;
    USART_Init(DEMO_USART, &config, DEMO_USART_CLK_FREQ);
}

 

Screenshot 2024-12-06 181540.pngScreenshot 2024-12-06 181552.pngScreenshot 2024-12-06 181605.png

Screenshot 2024-12-06 181643.png

Tags (1)
0 Kudos
Reply