'stellarisware'에 해당되는 글 3건

  1. 2012.07.23 stellarisware - UARTStdioInit() 4
  2. 2012.03.13 lm flash example
  3. 2012.02.05 TI stellarisware / driverlib 기본설정 (uart예제) 4
embeded/Cortex-M3 Ti2012. 7. 23. 10:44
stellraisware의 UARTStudioInit()는 간단하게 UART를 초기화 해주는 함수이다.
UARTStudioInit()의 초기화 값은 0에서 2까지 가능하며 이 내용이 합당한 정의는 존재하지 않는듯.
그리고 baud rate 라던가 인터럽트 등은 초기화 해준다고 해도
포트 자체를 사용할지에 대한 초기화는 사용자가 해주어야 한다.
그리고 115200-N-8-1로 무조건 정의되니 주의!!

만약 주변장치 초기화를 하지 않으면, 당연히(!) 아무런 것도 출력되지 않는다.

SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);

UARTStdioInit(1);
UARTprintf("Hello World\n"); 

//*****************************************************************************
//
//! Initializes the UART console.
//!
//! \param ulPortNum is the number of UART port to use for the serial console
//! (0-2)
//!
//! This function will initialize the specified serial port to be used as a
//! serial console.  The serial parameters will be set to 115200, 8-N-1.
//! An application wishing to use a different baud rate may call
//! UARTStdioInitExpClk() instead of this function.
//!
//! This function or UARTStdioInitExpClk() must be called prior to using any
//! of the other UART console functions: UARTprintf() or UARTgets().  In order
//! for this function to work correctly, SysCtlClockSet() must be called prior
//! to calling this function.
//!
//! It is assumed that the caller has previously configured the relevant UART
//! pins for operation as a UART rather than as GPIOs.
//!
//! \return None.
//
//*****************************************************************************
void
UARTStdioInit(unsigned long ulPortNum)
{
    //
    // Pass this call on to the version of the function allowing the baud rate
    // to be specified.
    //
    UARTStdioInitExpClk(ulPortNum, 115200);
} 

[링크 : http://e2e.ti.com/support/microcontrollers/stellaris_arm_cortex-m3_microcontroller/f/471/p/45229/160748.aspx]
Posted by 구차니
embeded/ARM2012. 3. 13. 07:47
TI LM 시리즈(?)에서 플래시 EEPROM은 별도로 존재하지 않고
프로그램 영역의 write protect를 해제하고 프로그램이 없는 영역을 임의로
삭제/읽음으로서 EEPROM을 흉내낼수 있다.

읽는 방법은 0x0000 0000 에서 0x0001 FFFF 까지 (lm3s1607 기준 128KB FLASH)
포인터 변수를 이용하거나 직접 번지로 읽으면 된다.
*(0x00000000) 하면 bin 파일의 첫 글자인 0xB0가 보인다.

쓰는건 아직 안해봐서.. 패스?! ㅋㅋ

[링크 : http://irmus.tistory.com/entry/%EB%82%B4%EC%9E%A5-flash-%EB%A9%94%EB%AA%A8%EB%A6%AC]
[링크 : http://mycortex.springnote.com/pages/2110058 ] 
[링크 : http://www.withrobot.com/entry/myCortex-LM8962]
 
---
2012.3.27 추가
char Flash_read(unsigned int *addr, char *data, int len)
{	// addr - sizeof(char) addressing (1 byte width)
		memcpy(	data, addr, len);
}

char Flash_write(unsigned int *addr, char *data, int len)
{	//	addr - sizeof(long) addressing(4 byte width)
		FlashErase((unsigned long)addr);
		FlashProgram((unsigned long*)data, (unsigned long)addr, len);
}

char Flash_unProtect(unsigned int *addr)
{
	return FlashProtectSet((unsigned long)addr, FlashReadWrite);
}

char Flash_Protect(unsigned int *addr)
{
	return FlashProtectSet((unsigned long)addr, FlashReadOnly);
}

char Flash_Erase(unsigned int *addr)
{
	return FlashErase((unsigned long)addr); // & 0x0000FC00
}


'embeded > ARM' 카테고리의 다른 글

H-JTAG 에러이유?  (0) 2012.03.23
KEIL MDK(ARM)에 H-JTAG 사용하기  (0) 2012.03.23
TI LM3S 시리즈 특징 - hibernate module / non-volatile memory  (0) 2012.03.06
arm-linux-gcc 와 arm-elf-gcc의 차이점  (2) 2012.01.16
winARM  (0) 2012.01.12
Posted by 구차니
embeded/Cortex-M3 Ti2012. 2. 5. 22:08
driverlib 관련 분석 내용 / uart 예제사용
전반적으로 초기화 설정을 보면 무언가.. 중복되도록 설정하는 느낌?
특히 UART의 경우에는 몇단계를 통해서 설정을 하는 것을 보면...

함수설명
extern void SysCtlClockSet(unsigned long ulConfig); // 클럭설정을 하도록 함.
 

extern void SysCtlPeripheralEnable(unsigned long ulPeripheral); // 포트를 사용하도록 설정함
extern void GPIOPinConfigure(unsigned long ulPinConfig); // GPIO로 쓸지 하드웨어 내장 기능을 쓸지 설정함

extern void GPIOPinTypeGPIOInput(unsigned long ulPort, unsigned char ucPins); // 해당 포트의 해당핀을 입력용으로 설정
extern void GPIOPinTypeGPIOOutput(unsigned long ulPort, unsigned char ucPins); // 해당 포트의 해당핀을 출력용으로 설정
extern void GPIOPadConfigSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulStrength, unsigned long ulPadType);
                                                                                  // 해당 포트의 해당핀에 대한 GPIO 드라이브 전류와 pull-up / open-drain 설정
 

예제설명
int main(void)
{
    char cThisChar;

    // 시스템 클럭설정
    SysCtlClockSet(SYSCTL_SYSDIV_1|SYSCTL_USE_OSC|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
    // UART0 기능을 사용하도록 함
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    // UART 핀이 포함된 GPIOA 포트를 사용하도록 함
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    // GPIO A의 0번 핀을 U0 RX로 사용하도록 함
    GPIOPinConfigure(GPIO_PA0_U0RX);
    // GPIO A의 1번 핀을 U0 TX로 사용하도록 함
    GPIOPinConfigure(GPIO_PA1_U0TX);
    // GPIO A의 0번 1번 핀을 UART에 할당함
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    // UART의 클럭소스와 Baudrate등을 설정함
    UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
                       (UART_CONFIG_WLEN_8|UART_CONFIG_STOP_ONE|UART_CONFIG_PAR_NONE));
    do
    {
        // UART0로 부터 1문자를 받아옴(blocking 방식)
        cThisChar = UARTCharGet(UART0_BASE);
        // 받아온 문자을 UART0로 출력함
        UARTCharPut(UART0_BASE, cThisChar);
    } while((cThisChar != '\n') && (cThisChar != '\r'));

    return(0);
}

'embeded > Cortex-M3 Ti' 카테고리의 다른 글

uart 인터럽트 / 폴링 충돌  (0) 2012.06.18
Ti lm3s1968 arm cortex m3 i2c  (0) 2012.02.20
Cortex-M3 인터럽트 관련 문서  (0) 2012.01.31
Cortex-M3 예제소스  (0) 2012.01.27
Cortex-M3 LM3S1968 Evaluation board  (0) 2012.01.27
Posted by 구차니