Hi everyone.. Its unbelievable...! I can't initalise my COM-Port..!??!?!???!? Ive got the AT91SAM7A3-Evalutation-Kit from Atmel. I work with the IAR-Workbench. I want to send somthing on USART0 and measure it with a KO. The LIN-Driver is disconnect on S22 to S25. So i Can measure singnals there (By S22 To S25 directly from the uC!) MCK = 47923200 My initialisation..: void init_UART0(void) { //Setting Pin (PIO) //RXD0 (*(volatile unsigned int*)0xFFFFF404) = (0x1<<2); //Disable Register (PIOA) (*(volatile unsigned int*)0xFFFFF470) = (0x1<<2); //Select A Register (*(volatile unsigned int*)0xFFFFF400) = (0x1<<2); //Output Enable (PIOA) //TXD0 (*(volatile unsigned int*)0xFFFFF404) = (0x1<<3); //Disable Register (PIOA) (*(volatile unsigned int*)0xFFFFF470) = (0x1<<3); //Select A Register (*(volatile unsigned int*)0xFFFFF400) = (0x1<<3); //Output Enable (PIOA) //CTS0 (*(volatile unsigned int*)0xFFFFF404) = (0x1<<6); //Disable Register (PIOA) (*(volatile unsigned int*)0xFFFFF470) = (0x1<<6); //Select A Register (*(volatile unsigned int*)0xFFFFF400) = (0x1<<6); //Output Enable (PIOA) (*(volatile unsigned int*)0xFFFC0000) = 0x1AC; //-> Disable and Reset Rx Tx (*(volatile unsigned int*)0xFFFC0028) = 0X0; // (US0) Transmitter Time-guard Register -> Disable (*(volatile unsigned int*)0xFFFC0004) = 0x25808C0; // (US0) Mode Register -> Baud to MCK, 8Bit, No Parity, 1 StopBit (*(volatile unsigned int*)0xFFFC000C) = 0xFFFFF; // (US0) Interrupt Disable Register-> Interrupt Disable (*(volatile unsigned int*)0xFFFC0020) = 0x1A; // (US0) Baud Rate Generator Register -> Baude=115200 (*(volatile unsigned int*)0xFFFC0024) = 0x0; // (US0) Receiver Time-out Register -> Disable (*(volatile unsigned int*)0xFFFC0000) = 0x50; // -> Enable Rx Tx } Now i want to send something and measure it with a KO. ( To test if something coming out of USART 0 and the init works..) How can I do that? I think i must to write into The THR-Register. I tastet like this: (*(volatile unsigned int*)0xFFFC001C) = 0xC &0x1FF; // (US0) Transmitter Holding Register while ((*(volatile unsigned int*)0xFFFC0014) & 0x2 != 0x2); // (US0) Channel Status Register So i wait until the THR is Ready. And it goes on! But nothing comming out! Is something else needet to send? What do i Wrong??? Best Regarts Desperatet Programmer
I think that when you write to the PIO_PER, PIO_PDR and PIO_ASR registers at addresses 0xFFFFF400, 0xFFFFF404 and 0xFFFFF470, you need to enable the peripheral functions for the RXD0, TXD0 and CTS0 all in one step instead of one bit at a time. In other words, instead of: (*(volatile unsigned int*)0xFFFFF400) = (0x1<<2); //Output Enable (PIOA) (*(volatile unsigned int*)0xFFFFF400) = (0x1<<3); //Output Enable (PIOA) (*(volatile unsigned int*)0xFFFFF400) = (0x1<<6); //Output Enable (PIOA) I think you need: (*(volatile unsigned int*)0xFFFFF400) = (0x1<<2)+(0x1<<3)+(0x1<<6); //Output Enable (PIOA) Otherwise each time you write another "1" bit to the register, you are clearing to "0" any bits you have already written to the register. And you can't logically "or" the configuration bits into these registers either, because the registers are write-only. Keith Rubow Desperatet Prgrammer wrote: > > Hi everyone.. > > > Its unbelievable...! I can't initalise my COM-Port..!??!?!???!? > > Ive got the AT91SAM7A3-Evalutation-Kit from Atmel. > I work with the IAR-Workbench. > > I want to send somthing on USART0 and measure it with a KO. > The LIN-Driver is disconnect on S22 to S25. > So i Can measure singnals there (By S22 To S25 directly from the uC!) > > MCK = 47923200 > > My initialisation..: > > > void init_UART0(void) > { > //Setting Pin (PIO) > > //RXD0 > (*(volatile unsigned int*)0xFFFFF404) = (0x1<<2); //Disable Register > (PIOA) > (*(volatile unsigned int*)0xFFFFF470) = (0x1<<2); //Select A > Register > (*(volatile unsigned int*)0xFFFFF400) = (0x1<<2); //Output Enable > (PIOA) > > //TXD0 > (*(volatile unsigned int*)0xFFFFF404) = (0x1<<3); //Disable Register > (PIOA) > (*(volatile unsigned int*)0xFFFFF470) = (0x1<<3); //Select A > Register > (*(volatile unsigned int*)0xFFFFF400) = (0x1<<3); //Output Enable > (PIOA) > > //CTS0 > (*(volatile unsigned int*)0xFFFFF404) = (0x1<<6); //Disable Register > (PIOA) > (*(volatile unsigned int*)0xFFFFF470) = (0x1<<6); //Select A > Register > (*(volatile unsigned int*)0xFFFFF400) = (0x1<<6); //Output Enable > (PIOA) > > (*(volatile unsigned int*)0xFFFC0000) = 0x1AC; > //-> Disable and Reset Rx Tx > (*(volatile unsigned int*)0xFFFC0028) = 0X0; > // (US0) Transmitter Time-guard Register -> Disable > (*(volatile unsigned int*)0xFFFC0004) = 0x25808C0; > // (US0) Mode Register -> Baud to MCK, 8Bit, No Parity, 1 StopBit > (*(volatile unsigned int*)0xFFFC000C) = 0xFFFFF; > // (US0) Interrupt Disable Register-> Interrupt Disable > (*(volatile unsigned int*)0xFFFC0020) = 0x1A; > // (US0) Baud Rate Generator Register -> Baude=115200 > (*(volatile unsigned int*)0xFFFC0024) = 0x0; > // (US0) Receiver Time-out Register -> Disable > (*(volatile unsigned int*)0xFFFC0000) = 0x50; > // -> Enable Rx Tx > > > } > > Now i want to send something and measure it with a KO. > ( To test if something coming out of USART 0 and the init works..) > How can I do that? I think i must to write into The THR-Register. > I tastet like this: > > (*(volatile unsigned int*)0xFFFC001C) = 0xC &0x1FF; > // (US0) Transmitter Holding Register > while ((*(volatile unsigned int*)0xFFFC0014) & 0x2 != 0x2); > // (US0) Channel Status Register > > So i wait until the THR is Ready. And it goes on! But nothing comming > out! > Is something else needet to send? > What do i Wrong??? > > Best Regarts > Desperatet Programmer
Thank you for your Request!! This is realy a Failure! Thank you! But it still doesen't work!! :-( I tasted on so many different constulations.. I don't now what i can do! Have you or somebody an example-code for using the Usart Port (0 or 1)???????? Best Regarts sooooooo desperatet Programmer......!!!!!!!!!!!!!!!!!
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.