Page 1 of 1

Configuration UART on Intel Galileo

Posted: Sat Dec 17, 2016 7:04 am
by bonus153624
Hey everyone,
I came with a question,
i tried to configure UART port on Intel Galileo, to be able to write and read through PUTTY, here is my code:

Code: Select all

//Turn on UART
	RegAddr DMA_CFG;
	DMA_CFG.raw = 0;

	DMA_CFG.bus = 0;
	DMA_CFG.dev = 20;
	DMA_CFG.func = 1;
	DMA_CFG.reg_off = 0x14;
	DMA_CFG.en_mapping = 1;
	UINT32 * DMA_addr = getAddressFromPCI(DMA_CFG.raw | 0x80000000);	

	DMA_addr[0] = 0x01;

	//Get BAR0
	RegAddr BAR0;
	BAR0.raw = 0;
	
	BAR0.bus = 0;
	BAR0.dev = 20;
	BAR0.func = 1;
	BAR0.reg_off = 0x10;	
	BAR0.en_mapping = 1;

	UINT32 BAR0_addr = getAddressFromPCI(BAR0.raw | 0x80000000);	

	//Turn on DDL register
	UINT32 * LCR = BAR0_addr + 0xC;
	LCR[0] = 0x80;
	//Set DDL regisrer
	UINT32 * RBR_THR_DLL = BAR0_addr;
	RBR_THR_DLL[0] = 0x18;
	
	//Set IIR
	UINT32 * IIR_FCR = BAR0_addr + 0x8;
	IIR_FCR[0] = 0x01;
	//Turn on IIR register
	LCR[0] = 0x0;
	
	//Clear IER register
	UINT32 * IER_DLH = BAR0_addr + 0x4;
	IER_DLH[0] = 0x0;	
	
	UINT32 * LSR = BAR0_addr + 0x14;

	while(TRUE) {
		UINT32 lsr_data = LSR[0] & 0x20;
		if (lsr_data == 0x20)
			break;
		
	}

	RBR_THR_DLL[0] = 's';
but it does not work. I put a character in THR register but it did not comes up. I tried to follow specifications of Intel Quark SoC X1000 but i am not sure that i understood all of that informations.

Thanks in advance for Your answers

Re: Configuration UART on Intel Galileo

Posted: Sat Dec 17, 2016 10:58 am
by adsko
If you try to enable pooling mode, you don't need DMA_CFG.
Config:

Code: Select all

	//Get IER_DLH
	UINT32 * IER_DLH = BAR0_addr + 0x4;

	//Turn on DDL register
	UINT32 * LCR = BAR0_addr + 0xC;
	LCR[0] = 0x80;

	//Set DDL regisrer
	RBR_THR_DLL = BAR0_addr;
	RBR_THR_DLL[0] = 0x18;

	//Turn off DLAB
	LCR[0] = 0x03;
	UINT32 * IIR_FCR = BAR0_addr + 0x8;
	IIR_FCR[0] = 0x7;
	IER_DLH[0] = IER_DLH[0] & ~0x8F;	
	LSR = BAR0_addr + 0x14;