Atctl Api
Atctl Api
com/en/01/01/04/13/#faq
#Application Information
#Pin Definition
1 VCC VCC
2 GND GND
3 PA8
6 PB12
7 PB13
8 PB14
9 PB15
10 PA11
11 PA12
12 PA13
13 PA14
15 PB3
17 - -
18 - -
19 - -
20 PA3
24 PB8
25 PB9
26 PC13
RHF76-052 STM32L0 RHF76-052AM Comments
27 NRST
28 PA0
29 GND GND
31 GND GND
33 GND GND
#UART Configuration
#AT Mode
#Bootloader Mode
#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 TX Floating
#LED
#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
/*!
* atctl driver callback function pointer type
*/
typedef void (*atctl_cb_t)(uint8_t);
1
2
3
4
#UART TX
#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
#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