Wireless Networks Lab – UART 2007/10/24
yctseng: 2 Environment BoardAPI vLedControl(0, true); HardwareAPI vAHI_xxx( ); FontalBSP FontalButton -- btn_init(); FontalLED -- led_init(); Stack – MAC Application Queue API Service Access Point – AppApi.h Access functions and structures used by the application to interact with the Jennic stack u32AppApiInit (); E_AHI_DEVICE_SYSCTRL, E_AHI_DEVICE_UART0, …, and etc.
yctseng: 3 Sample The PC’s UART connects to the on-chip UART of the FT6250 Kit. This sample code can let us figure out how to communicate between them with UART. HardwareAPI u8UartPort: E_AHI_UART_0 or E_AHI_UART_1 u8BaudRate: vAHI_UartEnable(E_AHI_UART_0); vAHI_UartReset(E_AHI_UART_0, TRUE, TRUE); vAHI_UartReset(E_AHI_UART_0, FALSE, FALSE); vAHI_UartSetClockDivisor(E_AHI_UART_0, u8BaudRate); vAHI_UartSetControl(E_AHI_UART_0, FALSE, FALSE, E_AHI_UART_WORD_LEN_8, TRUE, FALSE);
yctseng: 4 Overview Connecting the sensor board to a PC using the programming cable. UART settings are in Appendix. Terminal Serial Port FT 6250 UART Typing in HyperTerminal: ex: aaaaabbbcc which UARTASCII code
yctseng: 5 Flowchart
yctseng: 6 Pseudo code 1. u32AHI_Init(); 2. u32AppApiInit(NULL, NULL, NULL, NULL, NULL, NULL); 3. Set up UART; 4. Init LED; 5. Register UART Callback; 6. Utility function: vUartPrint(); vByteToString();
yctseng: 7 Requirement Review After comprehending the usage of UART, you are asked to When typing in the terminal, you should control each of the LEDs on/off through UART. When pressing each button of FT device, you should get different feedback in your terminal through UART.
yctseng: 8 Bonus Implement a small game. UART_1 FT 6251 UART_1 Terminal Serial Port UART_0 FT6250
yctseng: 9 Appendix When using HyperTerminal, you should choose the serial port you used and configure the serial connection as follows: bps, 8 data bits, no parity, 1 stop bit, and no handshaking. Ensure that your HyperTerminal is started after powering up the FT device.