Quality RTOS & Embedded Software

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


Loading

Serial -> lwIP Embedded WEB Server Demo

Posted by Nobody/Anonymous on March 19, 2007
I'm using the lwIP Embedded WEB Server Demo using GCC on an AT91SAM7X256.
Now I like to communicate via the comport. So I need serial.c and serialISR.c
Anybody knows where I can find these files? Regards, Rick

RE: Serial -> lwIP Embedded WEB Server Demo

Posted by Allure99 on September 6, 2007
yes i have the same problem. I can find serial.h in(full & minimal) folder but i just can't find serial.c and SerialISR.c.
can any one contribute?

RE: Serial -> lwIP Embedded WEB Server Demo

Posted by Dave on September 6, 2007
The SAM7S IAR demo has these files. Start with these then convert them to use the GCC syntax for the interrupt handler.

RE: Serial -> lwIP Embedded WEB Server Demo

Posted by Allure99 on September 7, 2007
Thanks Dave,

I Manage to get the serial working with the ISR in Normal mode.

I am developing code for interfacing the serial with GPRS modem and i will need the serial in Modem or Hardware Mode.

I define my USART mode as follow the it doesn't work:
// Define the USART mode
//serCOM0->US_MR = AT91C_US_USMODE_NORMAL | /* Normal Mode */
//serCOM0->US_MR = AT91C_US_USMODE_MODEM | /* Modem Mode */
serCOM0->US_MR = AT91C_US_USMODE_HWHSH| /* Hardware Handshaking*/
AT91C_US_CLKS_CLOCK | /* Clock = MCK */
AT91C_US_CHRL_8_BITS | /* 8-bit Data */
AT91C_US_PAR_NONE | /* No Parity */
AT91C_US_NBSTOP_1_BIT; /* 1 Stop Bit */

Is this the right setting? or i will need more to get the MODEM or HWHSH mode working?

Ta..

RE: Serial -> lwIP Embedded WEB Server Demo

Posted by Allure99 on September 7, 2007
//According to the AT91SAM7x256 datasheet (page316-317),
hardware handshaking mode (RTS/CTS flow control).

I used the Hyperterminal to test it but failed.


//My code is as follows:

//Code:
void Usart_init ( void )
{

COM0= AT91C_BASE_US0;

AT91F_PIO_CfgPeriph(
AT91C_BASE_PIOA, // PIO controller base address
((unsigned int) AT91C_PA5_RXD0 ) |
((unsigned int) AT91C_PA8_CTS0 ) |
((unsigned int) AT91C_PA7_RTS0 ) |
((unsigned int) AT91C_PA6_TXD0 ), // Peripheral A
0); // Peripheral B ;


AT91F_PMC_EnablePeriphClock ( AT91C_BASE_PMC, 1<<AT91C_ID_US0 ) ;

// Usart Configure
AT91F_US_Configure (COM0, MCK,AT91C_US_ASYNC_MODE_HW,USART_BAUD_RATE , 0);
//I defined AT91C_US_ASYNC_MODE_HW in library

// Enable usart
COM0->US_CR = AT91C_US_RXEN | AT91C_US_TXEN;
AT91F_PDC_Open (AT91C_BASE_PDC_US0);

COM0->US_RTOR = 0xFFFF;
COM0->US_RPR = (unsigned int)receive;
COM0->US_RCR = 8;
}


//Code:
void main(void)
{

Usart_init();

while(1){

AT91F_US_ReceiveFrame (COM0, receive, 8, 0,0 );
while (AT91F_PDC_IsRxEmpty (AT91C_BASE_PDC_US0)==0){}

AT91F_US_SendFrame(COM0, receive,8,0,0);
while (AT91F_PDC_IsTxEmpty (AT91C_BASE_PDC_US0)==0){}
}
}


//This code is basically to receive a data buffer from Hyperterminal and echo back.

//The Hyperterminal is set in Hardware Flow Control mode.

//However, the UART could not receive anything from PC after I typed some characters in the Hyperterminal window. I probed the RTS0 pin (PA3) using oscilloscope and found that this pin was low (which was active). RTS low indicated to the remote device that it could start transmitting. So the UART was supposed to receive the buffer. Moreover, I used the PDC channel for reception as the datasheet stated.

//I have no idea why it does not work! All followed the datasheet. Anyone knows the RTS/CTS flow control can give me some hints?


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




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

Latest News

FreeRTOS kernel V10.0.1 is available for immediate download. Now MIT licensed.

Video: Watch James Gosling & Richard Barry at re:Invent, Las Vegas 2017.

New FAQ page about the FreeRTOS kernel and Amazon FreeRTOS.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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