Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

AT91SAM3U4E clock frequency

Posted by vito v on June 12, 2013
Hello,
i am using the at91Sam3U4E demo board, and the relative FreeRTOS port for IAR Workbench.
I noticed that from the pin of the main clock, i can't se any wave with my oscilloscope.
I expected to look something like a square wave, but i can see just a continuous signal.
I gave a look at the LowLevelinit() function, that i haven't changed, and there i found the settings for the clock.
Maybe there is something i have to change to get the signal working ?

Thank you in advance,
Vito Vecchio

RE: AT91SAM3U4E clock frequency

Posted by Richard on June 12, 2013
Is the problem that the clock is not feeding the MCU, and therefore you cannot run the program, or just that the clock is not visible on an external pin?

Regards.

RE: AT91SAM3U4E clock frequency

Posted by vito v on June 12, 2013
I have uart and leds running fine, i was trying to develop a iso7816 driver on usart1, then trying signals with oscilloscope i noticed i did not receive the clock signal, i mean it was a flat signal, so i try to look directly on the pin 24 of the cortex m3 (the clock pin), and it's always a flat signal. I don't know if it's normal or i should see the clock wave.

Thanks in advance,
Vito Vecchio

RE: AT91SAM3U4E clock frequency

Posted by vito v on June 12, 2013
sorry, to be more detailed, the pin is the PA24

RE: AT91SAM3U4E clock frequency

Posted by Richard on June 12, 2013
Sorry - that is very chip specific and not FreeRTOS related. Without looking at your code and getting the chip user guide and data sheet out myself I would have no idea what should be on that pin when.

Regards.

RE: AT91SAM3U4E clock frequency

Posted by vito v on June 12, 2013
Hello,
i post my functions here, this is my usart1 setting code:


#define USART_MODE_ISO7816_T0 (AT91C_US_USMODE_ISO7816_0 | AT91C_US_CLKS_EXT | AT91C_US_CHRL_8_BITS | AT91C_US_PAR_EVEN | AT91C_US_NBSTOP_2_BIT | AT91C_US_CKLO)

#define BOARD_PIN_USART_RXD PIN_USART1_RXD
#define BOARD_PIN_USART_TXD PIN_USART1_TXD
#define BOARD_PIN_USART_CTS PIN_USART1_CTS
#define BOARD_PIN_USART_RTS PIN_USART1_RTS
#define BOARD_USART_BASE AT91C_BASE_US1
#define BOARD_ID_USART AT91C_ID_US1

#define BOARD_ID_SMART AT91C_ID_US1


#define PINS_ISO7816_SMART PIN_USART1_TXD, PIN_USART1_SCK, PIN_ISO7816_RST_SMART, PIN_SMART_CONF_A, PIN_SMART_CONF_B

xComPortHandle xSmartPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
{
xComPortHandle xReturn = ( ( xComPortHandle ) 2 );
extern void ( vUART_ISR )( void );
const Pin xUSART_Pins[] = { PINS_ISO7816_SMART };




/* Create the queues used to hold Rx and Tx characters. */
xRxedISOChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
xTxedISOChars = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );

/* If the queues were created correctly then setup the serial port
hardware. */
if( ( xRxedISOChars != serINVALID_QUEUE ) && ( xTxedISOChars != serINVALID_QUEUE ) )
{
portENTER_CRITICAL();
{
/* Enable the peripheral clock in the PMC. */
PMC_EnablePeripheral( BOARD_ID_SMART );

/* Configure the USART. */
USART_Configure( BOARD_SMART_BASE, USART_MODE_ISO7816_T0, ulWantedBaud, configCPU_CLOCK_HZ );


/* Configure the interrupt. Note the pre-emption priority is set
in bits [8:15] of the priority value passed as the parameter. */
IRQ_ConfigureIT( BOARD_ID_SMART, ( configMAX_SYSCALL_INTERRUPT_PRIORITY << 8 ), USART1_IrqHandler );
IRQ_EnableIT( BOARD_ID_SMART );


/* Configure IO for USART use. */
PIO_Configure( xUSART_Pins, PIO_LISTSIZE( xUSART_Pins ) );


}
portEXIT_CRITICAL();
}
else
{
xReturn = ( xComPortHandle ) 0;
}

/* This demo file only supports a single port but we have to return
something to comply with the standard demo header file. */
return xReturn;
}




where USART_Configure is:


void USART_Configure(AT91S_USART *usart,
unsigned int mode,
unsigned int baudrate,
unsigned int masterClock)
{
// Reset and disable receiver & transmitter
usart->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX
| AT91C_US_RXDIS | AT91C_US_TXDIS;

// Configure mode
usart->US_MR = mode;

usart->US_IDR = -1;
usart->US_FIDI = 372;
// Configure baudrate
// Asynchronous, no oversampling
if(mode==USART_MODE_ISO7816_T0){
usart->US_BRGR = (masterClock / 3571200);
}


USART_SetTransmitterEnabled(usart, 1);
USART_SetReceiverEnabled(usart, 1);


// TODO other modes
}


where i didn't report the macro, is used the standard value as freeRTOS did.
It could be something missing in the USART_Configure ?

So i expected to find the clock signal on the PA24, since i enabled it with PMC_EnablePeripheal(), but can't see anything.


Thanks in advance for the reply,
Vito Vecchio


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner