RP2040 라즈베리파이 피코
디버그 프로브로 rp2040과 컴퓨터를 시리얼 통신 연결하기
천재개발자
2025. 1. 13. 18:14
반응형
1. CMakeLists.txt 파일에 STDIO를 USB CDC로 연결하도록 설정
cmake_minimum_required(VERSION 3.14)
include(pico_sdk_import.cmake)
project(STDDemo)
set(CMAKE_C_STANDRAD 11)
set(CMAKE_CXX_STANDARD 17)
pico_sdk_init()
add_executable(STDDemo
main.c
)
target_link_libraries(STDDemo pico_stdlib)
pico_enable_stdio_usb(STDDemo 1) # Enable the STDIO on USB CDC
pico_enable_stdio_uart(STDDemo 0)
pico_add_extra_outputs(STDDemo)
2. 테스트 코드 빌드 후 rp2040에 업로드하기
#include <stdio.h>
#include "pico/stdlib.h"
int main(){
stdio_init_all();
while(true){
int16_t ch = getchar_timeout_us(0);
if(ch != EOF){
putchar_raw(ch);
if(ch == '\n' || ch == '\r'){
printf("\nHello\n");
}
}
}
return 0;
}
3. 디버그 프로브 디바이스 검색
$ ls /dev/tty.usb*
/dev/tty.usbmodem101... /dev/tty.usbmodem11102...
4. RP2040 기본 baudrate는 115200bps
GNU screen으로 tty장치에 연결
$ screen /dev/tty.usbmodel101 115200
GNU screen 매뉴얼 참고
https://www.gnu.org/software/screen/manual/
- GNU Project - Free Software Foundation
Free Software Foundation last updated September 05, 2024 This manual (screen) is available in the following formats: You can buy printed copies of some manuals (among other items) from the Free Software Foundation; this helps support FSF activities. (This
www.gnu.org
반응형