發表文章

目前顯示的是 4月, 2016的文章

文章總列表

SEGGER RTT (2)

圖片
SEGGER RTT (2) SEGGER RTT (2) Introduction The article introduce how to use SEGGER-RTT in WIN32. I guess you will be amazing how east it is to setup RTT. I did my experiment over my NRF51822 board with a on-board JLINK. If you don’t have a JLINK, I recommend to invest one. SEGGER also provides inexpensive JLINK-EDU at 2400NTD (roughly 80USD). I think that’s quite affortable and worth of buying one. This article is written under WIN32 because SEGGER only provides RTT viewer utility in WIN32. I will show how to use RTT in Linux/ Mac in SEGGER RTT (3), which is the final form of logging service (I’m 100% satisfied with). RTT Source Code In SEGGER driver installation folder, you could find a zipped file /c/ Program Files (x86) /SEGGER/ JLink_V50i /Samples/ SEGGER_RTT_V510i.zip Uncompressed the file, and copy following files to your MCU project RTT/SEGGER_RTT .c RTT/SEGGER_RTT .h RTT/SEGGER_RTT_Conf .h RTT/SEGGER_RTT_

SEGGER RTT (1)

SEGGER RTT (1) SEGGER RTT (1) UART is Troublesome in Target-side Printf() is probably the most handy debug tool since I learn C. In embedded world, we used UART to direct message to PC. After learning more things these years, I began to “hate” UART with following reasons: First, UART is quite slow. It requires ~0.1ms to transmit 1byte @ 9600bps. When CPU is running @ 16Mhz, it takes 1600 CPU cycles to transmit 1 character. Typical UART hardware had only few bytes of transmit buffer which is not sufficient to hold whole strings. A handy solution is polling the hardware to transmit data. The method is unacceptable when running time critical applications such as BLE. Most UART had interrupt mode which raises IRQ when transmit buffer is empty. This means additional effort to bring up such mechanism. Besides, we need a ring buffer to store string-to-send. To have “advanced” (troublesome) solution in (3), one shall deal with UART HW