Using a second UART to control a serial device

Adam Lackorzynski adam at os.inf.tu-dresden.de
Sun May 10 22:42:55 CEST 2015


Hi,

On Mon May 04, 2015 at 10:05:39 +0200, Pflaum, Clemens wrote:
> >How does the 'no access' show? J12 is described as having UART7 so I'd
> >assume the UART is there. (UART4 starts on a new page, you have mapped
> >that too?)
> If I try to read any register like I usally do:
>       char sc = regs->read<unsigned char>(LCR);
>       printf("0x0C LCR: %#010x\n", sc);
> All i get is 0x00 even if i try writing to it before. I have had the
> exact same problem with UART0-3 before manually adjusting the
> Registers to their actual offsets or setting the shift parameter of
> Io_register_block_mmio to 2. So its actually like I'm looking
> at/writing to the wrong places.
> I map the memory similar to the serial-drv example only ever one UART at a
> time:
>    #define IRQ_NUM 52                 //currently set to UART7, 36 for UART3
>    #define UART_BASE 0x01C29C00       //currently set to UART7, 0x01C28C00
> for UART3
> 
> bool Maestro_server::init()
>    {
>       printf("init start\n");
>       l4_addr_t virt_base = 0;
> 
>       if (l4io_request_iomem((l4_addr_t)UART_BASE, 0x0400,
> L4IO_MEM_NONCACHED, &virt_base))
>         {
>           printf("maestro-drv: request io-memory from l4io failed.\n");
>           return false;
>         }
>       printf("maestro-drv: virtual base at:%lx\n", virt_base);

What is this line printing? So the question is whether the virtual
address really points to 0x01C29C00? You can check via jdb, show all
tasks with s, go to your program, press p which shows the page-table of
your program, navigate to the second level.
 
>       L4::Io_register_block_mmio *regs = new
> L4::Io_register_block_mmio(virt_base, 2);
>       printf("registered regs\n");
> 
>       _uart = new (malloc(sizeof(L4::Uart_bpi16550)))
> L4::Uart_bpi16550((unsigned long) 115200);
>       printf("malloc for _uart\n");
>       printf("\n");
> 
>       if(!(_uart->startup(regs))){
> 	     printf("failed to startup uart regs!\n");
>       }
>       .
>       .
> }
> 
> Together with the folling in my .devs file
> 
> local Hw = Io.Hw
> local Res = Io.Res
> Io.hw_add_devices
> {
>    UART7 = Hw.Device
>    {
>       hid = "UART7";
>       Res.irq(52);
>       Res.mmio(0x01C29C00, 0x01C29FFF);
>    }
> }

Looks ok.

> >Hmm, does it work with on Linux, i.e. it's not something
> >hardware-related?
> 
> I have tested the UARTS with the Bananian linux and they work just
> fine, so it cant be hardware-related.

Ok, good.


Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/




More information about the l4-hackers mailing list