흐름제어 설정방법이 자세히 안 나와 있어서 직접 테스트를 해 봤습니다.


테스트를 진행한 프로젝트는 rfEasyLinkNp_cc1310 입니다.

설정방법은 간단합니다.


1. 만약 CTS,RTS 핀을 바꾸고 싶다면 CC1310_LAUNCHXL.h 파일에서 핀설정을 수정해 주시면 됩니다.
1
2
3
4
5
/* UART Board */
#define Board_UART_RX               IOID_2          /* RXD  */
#define Board_UART_TX               IOID_3          /* TXD  */
#define Board_UART_CTS              IOID_19         /* CTS  */
#define Board_UART_RTS              IOID_18         /* RTS */
cs

2. 그런 다음, CC1310_LAUNCHXL.c 의 BoardGpioInitTable[] 설정을
다음과 같이 수정하고..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const PIN_Config BoardGpioInitTable[] = {
 
    Board_RLED   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,         /* LED initially off             */
    Board_GLED   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,         /* LED initially off             */
    Board_BTN1   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,            /* Button is active low          */
    Board_BTN2   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,            /* Button is active low          */
    Board_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN,  /* External flash chip select    */
    Board_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN,                                              /* UART RX via debugger back channel */
    Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,                        /* UART TX via debugger back channel */
    Board_UART_CTS | PIN_INPUT_EN | PIN_PULLUP,
    Board_UART_RTS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
    //Board_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master out - slave in */
    //Board_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master in - slave out */
    //Board_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN,                                             /* SPI clock */
 
    PIN_TERMINATE
};
cs


3. CC1310_LAUNCHXL.c 의 uartCC26XXHWAttrs[CC1310_LAUNCHXL_UARTCOUNT] 의 내용 중,
.ctsPin 과 .rtsPin 설정을 수정합니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* UART hardware parameter structure, also used to assign UART pins */
const UARTCC26XX_HWAttrsV1 uartCC26XXHWAttrs[CC1310_LAUNCHXL_UARTCOUNT] = {
    {
        .baseAddr       = UART0_BASE,
        .powerMngrId    = PowerCC26XX_PERIPH_UART0,
        .intNum         = INT_UART0_COMB,
        .intPriority    = ~0,
        .swiPriority    = 0,
        .txPin          = Board_UART_TX,
        .rxPin          = Board_UART_RX,
        .ctsPin         = Board_UART_CTS,    // PIN_UNASSIGNED -> Board_UART_CTS
        .rtsPin         = Board_UART_RTS    // PIN_UNASSIGNED -> Board_UART_RTS    
    }
};
cs

4. 빌드하고 다운로드하면 흐름제어 동작이 됩니다.


CC1310 을 사서 PCB에 꾸며서 , AT Command Application 을 넣고 테스트해 봤는데

아주 빠르고 좋았습니다. 

20ms 마다 18 바이트를 50번 보냈는데, 잘 전송되었고, 
10ms 마다 전송했는데, 멈추네요.(CC1310 문제인지, UART로 연결해 놓은 MCU 문제인지 아직 파악은 못했지만, 
일단 20ms 로 전송이 잘 되서, 그냥 원인은 알아보지 않고 프로젝트를 진행 할 예정입니다)

로라 모뎀을 일반용으로 쓸 때는, 2초에 1번씩 전송됐는데, CC1310은 거기에 비하면 엄청 빠른거죠.^^

예전에, 로라 모뎀을 일반용도로 쓴 적이 있었습니다. 그 때, 응답 속도가 너무 느려서 답답했었는데, 그 이유를 알 것 같습니다.
AT+I 01 명령으로 CC1310 도 Long Range Mode 로 설정하면, 거리가 더 많이 나오는데 응답속도가 현저히 느려졌습니다. 
아마도 로라 모뎀이 long range mode로 동작하도록 셋팅됐었나 봅니다






[ 보드 제작시에는 다음과 같은 내용을 참고해 주세요 ]

1. DIO_0 을 사용하면 동작이 안되는데, 왜 그런지 모르겠네요. 일단은 DIO_0 을 제외하고 사용하면 문제는 없습니다. 


2. 32.768KHz 외부 클럭은 사용하지 않아도 되더군요. 24MHz 크리스탈만 잘 달아 주면 됩니다. 


3. saw 필터를 사용하면 아주 조그마해 집니다. ^^

개발키트에는 USB to UART 디버거 칩에 연결되어서 다른 MCU에 연결해서 테스트를 할 수가 없어서 

UART 포트를 옮겨봤습니다.








CC1310 은 핀 수와 Flash 메모리 용량에 따라서 여러가지 모델이 있다.


가능하면 작은 패키지와 가격이 싼 모델로 구현을 해 보려고 했는데,
결론을 미리 말씀 드리면 32K는 안되고 64K 모델부터 되네요.

가격이 $2.5 @ 1K (CC1310F32,32K) 에서 $2.9 @ 1K(CC1310F64, 64K)로 올라가서 
가격이 $0.4 올라가버렸네요. ㅜㅜ


먼저 CC1310 의 메모리가 개발키트에는 128KB로 되어 있으므로 32K,64K 로 바꿔 보겠습니다.



[결론]

AT Command 프로그램을 적용하려면, 32K 모델은 사용할 수가 없고 적당한 모델은 64K 모델인 것 같습니다.



실제로 현재 테스트 결과, CC1310F64 / 32핀 모델에 프로그램을 했고 동작이 잘 됩니다.


처음에 CC1310 32핀 IC를 쓰려고 하는데, JTAG로 설계하니 핀이 좀 많이 소비된다 싶어서

메뉴얼을 찾아보니 cJTAG라는 방식이 있었습니다.

자세한 설명은 메뉴얼을 보시고, 어떤 핀을 연결하는지와 실제로 동작하는지를 알아봤습니다.




TI의 Sub 1GHz Microprocessor인 CC1310를 소개합니다.


RF 테스트를 하려면 보드가 2개 있어야 해서 개발키트(CC1310 Launchpad)를 2개 구입했습니다.

키트는 디버거(XDS110) 와 CC1310(RF MCU)가 포함되어 있습니다.




TI 사이트에 가서 CCS 를 다운 받아서 설치하면 여러가지 예제 소스를 제공 받을 수 있다.


RF EasyLink Network Processor 라는 프로젝트는 RF 관련 기능을 대부분 테스트할 수 있는 양방향 AT Command 방식의 프로그램이다.


각각의 CC1310 런치패드 보드에, 이 프로젝트를 컴파일하여 디버그 버튼을 누르면 프로그램이 CC1310 MCU에 들어가서 동작을 한다.





CC1310 런치패드 보드는 USB 케이블을 연결하면, 2개의 UART 포트가 생기는데,

터미날 프로그램에서 시리얼 포트를 설정할 때, Application/User UART 에 연결한다.


UART 상세 설정은 다음과 같다.

1. Baud Rate : 115200 bps

2. Stop bit : 1

3. Data bit : 8-bit

4. Flow control : None




PC쪽 터미날의 시리얼 포트 설정은 다음과 같습니다.




터미널 설정은 다음과 같이 조정합니다. 수정한 부분은 줄바꿈 수신 설정만 CR+LF 로 변경했습니다.



rfEasyLinkNp_CC1310 프로젝트가 실행되면, 처음에 터미날로 다음과 같은 내용을 출력함. (리셋하고 동작 시작한다는 뜻)


이 AT Command 프로젝트는 기본으로 echo 동작을 합니다. (AT 명령으로 echo 없앨 수 있음)



다음은 터미널에 연결하여 장치 테스트 과정입니다.




다음은 파라메터 테스트 입니다.




다음은 이 프로그램에서 사용한 AT Command 명령어 리스트 입니다.

T Parameters

Parameters offer set and get functionality.

The format of a parameter read command to get the TxPower paramter is:

“ATP00?

The response to a read will be of the format shown below, depending on the paramter it will be hex or decimal:

“-10

The format of an AT command to set the Frequency Parameter to 868MHz is:

“ATPFR=868000000

The response of a write will be of the format:

OK<CR>


The registers exposed for the EasyLink API are:

| Param | R/W | Description                      | Parameter(s)               |
|=======|=====|==================================|============================|
|  ST   |  R  | Read The last EasyLink status    | EasyLink status in 4B:     |
|       |     | returned                         | hex<br> Success = 0000     |
|       |     |                                  | Config_Error = 0001        |
|       |     |                                  | Param_Error = 0002         |
|       |     |                                  | Mem_Error = 0003           |
|       |     |                                  | Cmd_Error = 0004           |
|       |     |                                  | Tx_Error = 0005            |
|       |     |                                  | Rx_Error = 0006            |
|       |     |                                  | Rx_Timeout = 0007          |
|       |     |                                  | Rx_Buffer_Error = 0008     |
|       |     |                                  | Busy_Error = 0009          |
|       |     |                                  | Aborted = 000a             |
|-------|-----|----------------------------------|----------------------------|
|  AE   | R/W | UART Echo Enable                 | 0 or 1 to enable/disable   |
|       |     |                                  | echo                       |
|-------|-----|----------------------------------|----------------------------|
|  FR   | R/W | Read/Write frequency in kHz      | Frequency in 1B hex        |
|-------|-----|----------------------------------|----------------------------|
|  PW   | R/W | Read/Write tx power in dBm       | Power in decimal between   |
|       |     |                                  | -10 to 14dBm. Note ccfg    |
|       |     |                                  | changes are required for   |
|       |     |                                  | 14dBm outpur power         |
|-------|-----|----------------------------------|----------------------------|
|  BM   | R/W | Read/Write data mode for Tx/Rx   | Mode in 1B hex 0:ASCII     |
|       |     | data                             | 1:Binary                   |
|-------|-----|----------------------------------|----------------------------|
|  IE   |  R  | Read IEEE address                | None                       |
|-------|-----|----------------------------------|----------------------------|
|  AS   |  R  | Read address size in Bytes       | None                       |
|-------|-----|----------------------------------|----------------------------|
|  TS   | R/W | Read/Write Tx address            | 1-8B Tx address in hex     |
|-------|-----|----------------------------------|----------------------------|
|  RT   |  R  | Read current radio time          | None                       |
|-------|-----|----------------------------------|----------------------------|
|  TY   | R/W | Read/Write Time Type             | Time in 1B hex 0:Absolute  |
|       |     |                                  | Time 1:Relative Time       |
|-------|-----|----------------------------------|----------------------------|
|  TT   | R/W | Absolute or relative (based on   | Absolute/relative time in  |
|       |     | Time Type) radio time to Tx a    | units of 4MHz ticks in     |
|       |     | packet                           | decimal OR 0 for immediate |
|-------|-----|----------------------------------|----------------------------|
|  TR   | R/W | Absolute or relative (based      | Absolute/relative time in  |
|       |     | on Time Type) radio time to Rx a | units of 4MHz ticks in     |
|       |     | packet                           | decimal OR 0 for immediate |
|-------|-----|----------------------------------|----------------------------|
|  RO   | R/W | Relative time for Rx timeout     | Relative time in units of  |
|       |     |                                  | 4MHz ticks in decimal OR 0 |
|       |     |                                  | for never                  |
|-------|-----|----------------------------------|----------------------------|
|  LA   |  R  | Destination address of last Rx'ed| None                       |
|       |     | message                          |                            |
|-------|-----|----------------------------------|----------------------------|
|  LT   |  R  | Read absolute radio time of last | None                       |
|       |     | Rx'ed message                    |                            |
|-------|-----|----------------------------------|----------------------------|
|  LR   |  R  | Read RSSI of last Rx'ed message  | None                       |
|-------|-----|----------------------------------|----------------------------|
|  F0   | R/W | Read/Write address filter 0      |  1-8B address in hex       |
|-------|-----|----------------------------------|----------------------------|
|  F1   | R/W | Read/Write address filter 1      |  1-8B address in hex       |
|-------|-----|----------------------------------|----------------------------|
|  F2   | R/W | Read/Write address filter 2      |  1-8B address in hex       |
|-------|-----|----------------------------------|----------------------------|
|  TM   | R/W | Read/Write test mode             | Test mode in 1B hex        |
|       |     |                                  | 0:None/Cancel              |
|       |     |                                  | 1:Tone/Carrier Wave        |
|       |     |                                  | 2:Modulated Signal         |
|       |     |                                  | 3:PER Tx                   |
|       |     |                                  | 4:PER Rx                   |
|-------|-----|----------------------------------|----------------------------|
|  PI   | R/W | Read/Write PER Tx Bursts Interval| 1B time between PER bursts |
|       |     |                                  | in units of ms in Decimal  |
|-------|-----|----------------------------------|----------------------------|
|  PB   | R/W | Read/Write PER Tx Burst Size     | 1B Tx Burst Size in Hex    |
|-------|-----|----------------------------------|----------------------------|
|  PP   | R/W | Read/Write Number of PER Tx/Rx   | 1B Tx/Rx Packets in Hex    |
|       |     | Packets                          |                            |
|-------|-----|----------------------------------|----------------------------|
|  PL   | R/W | Read/Write PER Tx/Rx Packet      | 1B Tx/Rx Packet Length in  |
|       |     | Length                           | Hex                        |
|-------|-----|----------------------------------|----------------------------|
|GM00-03| R/W | Read/Write GPIO Mode             | 0:1 GPIO Value input/output|
|-------|-----|----------------------------------|----------------------------|
|GV00-03| R/W | Read/Write GPIO Value            | 0:1 GPIO Value             |
|-------|-----|----------------------------------|----------------------------|

AT Control Commands

The format of Control Commands are:

“AT+I 00

The response will be similar to:

“OK

The Commands exposed for the EasyLink AT API are:

| Command  | Description                        | Parameter(s)                |
|==========|====================================|=============================|
|   i/I    | Initialize the Radio               | 00: For 50kbps 2-GFSK       |
|          |                                    | 01: For 625bps Long Range   |
|          |                                    | Mode                        |
|          |                                    | 02: For User defined from   |
|          |                                    | SmartRF_Settings.c/h        |
|----------|------------------------------------|-----------------------------|
|  tx/TX   | Send a message to Tx Address       | x Data Bytes                |
|          | (PARAM PTA) at Tx Time (Param PTT) |                             |
|          | or Immediate if 0 or expired       |                             |
|----------|------------------------------------|-----------------------------|
|  rx/RX   | Turn on Radio to Receive Data at   | None                        |
|          | Rx Time set by Parameter `PRT` (or |                             |
|          | Immediate if 0), with timeout set  |                             |
|          | by Parameter "PRO"                 |                             |
|----------|------------------------------------|-----------------------------|
|  rs/RS   | Reset the CC13xx                   | None                        |
|----------|------------------------------------|-----------------------------|

Command Responses

Response for Register Write and Control Commands are formatted as:

| Resonse        | Description                                                |
|================|============================================================|
| OK<CR>         | Command or Register write successful                       |
|----------------|------------------------------------------------------------|
| Error 0001<CR> | Command or register read/write failed due to bad formatting|
|----------------|------------------------------------------------------------|
| Error 0002<CR> | Command or register read/write failed due to bad length    |
|----------------|------------------------------------------------------------|
| Error 0003<CR> | Command or register write failed due to a parameter Error  |
|----------------|------------------------------------------------------------|
| Error 0004<CR> | Command or register write failed due to a Memory Error     |
|----------------|------------------------------------------------------------|
| Error 0005<CR> | Command or register write failed due to Error From         |
|                | EasyLink API (EasyLink error is stored in Parameter "ST")  |
|----------------|------------------------------------------------------------|

The response to the “rx”"RX" (receive) Command is of the format:

  • For ASCII Data Mode:

    RX: Hello World<CR>
    OK<CR>
  • For Binary Data Mode:

    RX: 2fbb1aa8ec84045fb0c3e5236cb8cc5b3c<CR>
    OK<CR>

The response to the “rs”"RX" (reset) Command is of format:

  • For ASCII Data Mode:

    RESET:vxx.xx.xx<CR>

Where vxx.xx.xx is the version number of the EasyLink API

Test Modes

The EasyLink AT interface supports the following test modes:

  • Carrier Wave
  • Modulated Signal
  • PER Tx
  • PER Rx

Before running these commands you must first initialize the device using:

AT+I x<CR>

where x indicate the Phy settings used.

Carrier Wave:

This is enabled by Setting test mode to 1. To configure the Carrier Wave test mode use:

    ATPTM=1<CR>

To exit the Carrier Wave test mode:

    ATPTM=0<CR>

Modulated Signal:

This is enabled by Setting test mode to 2. To configure the Modulated Signal test mode use:

    ATPTM=2<CR>

To exit the Modulated Signal test mode:

    ATPTM=0<CR>


+ Recent posts