0% found this document useful (0 votes)
72 views

Atctl Api

This document provides information about connecting and interfacing with an RHF76-052AM LoRaWAN modem, including pin definitions, UART configuration, reset methods, sleep mode, LED indicators, callbacks, and other interface functions. It describes the modem's UART ports for AT commands, bootloading, and status LEDs. It also outlines the required HAL functions for integrating the modem with a host MCU.

Uploaded by

Ocean Atlantic
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Atctl Api

This document provides information about connecting and interfacing with an RHF76-052AM LoRaWAN modem, including pin definitions, UART configuration, reset methods, sleep mode, LED indicators, callbacks, and other interface functions. It describes the modem's UART ports for AT commands, bootloading, and status LEDs. It also outlines the required HAL functions for integrating the modem with a host MCU.

Uploaded by

Ocean Atlantic
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

https://wiki.risinghf.

com/en/01/01/04/13/#faq

RHF76-052AM is a UART interface LoRaWAN AT Modem with auto ultra-low power


feature. This document applies RHF76-052AM firmware equal to or higher than v2.0.8.

#Application Information

#Pin Definition

RHF76-052 STM32L0 RHF76-052AM Comments

1 VCC VCC

2 GND GND

3 PA8

4 PA9 UART_BLTX Bootloader UART TX (115200,8,n,1)

5 PA10 UART_BLRX Bootloader UART RX (115200,8,n,1)


RHF76-052 STM32L0 RHF76-052AM Comments

6 PB12

7 PB13

8 PB14

9 PB15

10 PA11

11 PA12

12 PA13

13 PA14

14 PA15 BLEN Low to enable bootloader during power up

15 PB3

16 PB4 LED2 LoRaWAN RX/TX Status

17 - -

18 - -

19 - -

20 PA3

21 PB5 LED1 Reserved LED

22 PB6 UART_TX AT command interface UART TX (9600,8,n,1)

23 PB7 UART_RX AT command interface UART RX (9600,8,n,1)

24 PB8

25 PB9

26 PC13
RHF76-052 STM32L0 RHF76-052AM Comments

27 NRST

28 PA0

29 GND GND

30 RFIO_HF RFIO_HF High frequency band RF port

31 GND GND

32 RFIO_LF RFIO_LF Low frequency band RF port

33 GND GND

#UART Configuration

#AT Mode

Interface:Pin22-PB6 (TX) / Pin23-PB7 (RX)


Baud Rate: 9600
Data Bits: 8
Stop Bits: 1 Parity: None

#Bootloader Mode

Interface: Pin4-PA9 (TX) / Pin5-PA10 (RX)


Baud Rate: 115200
Data Bits: 8
Stop Bits: 1 Parity: None
For more information about how to upgrade firmware refer to UM01518(opens new
window)

#Reset

If the application requires the disconnection of VCC from the RHF76-052AM module or
send AT+RESET command, user should wait for 2s from of the end of the POR cycle
before commencing communications over the UART port. RHF76-052AM use this 2s to
initial itself.
Example: (AT+RESET)
printf("AT+RESET");
delay_ms(2000);
1
2
Example: (Power On)
// Wait until RHF76-052AM is ready
delay_ms(2000);
1
2

#NRST

Two millisecond (2ms) negative pulses on NRST pin will trigger a reset of RHF76-052
module, it performs the same as “AT+RESET”.
This pin is optional to connect with host MCU, if it is connected the pin of host MCU is
expected to set to floating after reset is triggered.

#Sleep Mode

While RHF76-052AM is in sleep mode, RHF76-052AM TX/RX pins status will be changed
to save power. Details:
RHF76-052AM Status

UART TX Floating

UART RX Input weak pull up


Host controller is expected to set HOST TX pin floating. As RHF76-052AM TX pin is set
to floating, so HOST RX status is not mandatory, customer could decide it on demand.
Host MCU Status

UART TX Floating

UART RX Depends on HOST MCU


For more information about how to use auto low power mode refer toPS01509
V3.1+ (opens new window).

#LED

Event LED Status

Send packet LED2 on ~100ms


Event LED Status

ACK or packet received LED2 on ~300ms

Join request LED2 on ~800ms

Joined LED2 on ~600ms

#Input Timeout

RHF76-052AM AT engine expects to receive „\n‟ to identify end of a frame for each of
the command, if the TIMEOUT value time passed after last received character, an input
timeout event will occur.
 +INFO: Input timeout
 +AT: OK
Input timeout feature enable AT engine to flush input commands in a predefined time
to make sure it will not concatenate two commands wrongly.
For terminal tool (PuTTY, Teraterm) users, there is way to disable this feature. It is
RisingHF official recommend to try SSCOM to tool.
Disable input timeout:
 AT+UART=TIMEOUT,0
NOTE: UART TIMEOUT status is not saved v2.0.8.

#ATCTL API

RisingHF ATCTL API package is available for customers who integrate RHF76-52AM in
their design. To use ATCTL software package user need implement all function in hal-
atctl-template.c. And there is detailed description in hal-atctl.h to explain usage of each
function and macro.

#DBG

/*!
* main.c debug log information
*/
#define DBG(x...)
printf(x)
1
2
3
4
5
#MUTEX

/*!
* Enable protection of critical code, usually be disable global interrupt
*/
#define HAL_ATCTL_ENTER_MUTEX()
__disable_irq()
/*!
* End protection of critical code, recove the interrupt
*/
#define HAL_ATCTL_EXIT_MUTEX()
__enable_irq()
1
2
3
4
5
6
7
8
9
10

#Callback Function Prototype

/*!
* atctl driver callback function pointer type
*/
typedef void (*atctl_cb_t)(uint8_t);
1
2
3
4

#UART TX

hal_atctl_printf and hal_atctl_putchar will be called by ATCTL to send data to RHF76-


052AM.
/*!
* atctl driver call this function to send data to UART
* printf output must be redirected to UART, refer compiler manual about how
* to redirect printf
*/
#define hal_atctl_printf(x...)
printf(x)
/*!
* UART low level TX one byte function
*/
void hal_atctl_putchar(uint8_t c);
1
2
3
4
5
6
7
8
9
10
11

#UART RX

User need implement hal_atctl_init function and supply interface for atctl driver to
register atctl rx_byte function.
/*!
* atctl driver HAL layer initialize, this function will register atctl
callback
* function to the UART driver, UART driver must receive all data returned by
* RHF76-052AM module
*/
void hal_atctl_init(atctl_cb_t cb);
1
2
3
4
5
6
The way it is called by atctl driver:
void atctl_init(bool wakeup)
{
hal_atctl_init(atctl_rx_byte);
atctl_reset();
atctl_rx_tmp_wr_index = 0;
atctl_rx_tmp_rd_index = 0;
atctl_wakeup = wakeup;
}
1
2
3
4
5
6
7
8

#System Time

These low level functions are mandatory for ATCTL driver.


/*!
* return system tick, if the HOST MCU tick is not 32bits,
* user should make hal_get_timeout function to adapt it.
*/
uint32_t hal_get_tick(void);
/*!
* return difference between current time and an elapsed time
* old_time
- an elapsed time
*/
uint32_t hal_get_timeout(uint32_t etime);
/*!
* delay some time, unit is millisecond (ms)
* old_time
- an elapsed time
*/
void hal_delay_ms(uint32_t ms);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

#Optional

/*!
* HOST mcu initialize, it is optional to implement this function
*/
void hal_sys_init(void);
/*!
* HOST mcu lowpower event, need to be polled in main loop,
* it is optional to implement this function, user could local lowpower
* management APIs to replace this one
*/
void hal_sys_lowpower(void);
/*!
* This function is used to generate a periodic event, main.c will detect
* this event, to use this event to trigger OTAA JOIN or send message
periodicly
*/
bool hal_evt_flag(void);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

#FAQ

1. How to check configuration?


Each configuration except the keys (AppKey/NWKSKEY/APPSKEY) could be queried by
user through query format command. Like:
 AT+ID
 AT+CH
 AT+RXWIN1
 AT+RXWIn2 AT+DR
 AT+LW=ULDL // Check uplink and downlink counter
 AT+UART=TIEMOUT

You might also like