Silicon Labs RS9116W SAPI Programming Reference guide

Type
Reference guide
silabs.com | Building a more connected world. 1 | Page
RS9116W SAPI Programming Reference Manual
Version 2.0
10/21/2020
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 2 | Page
Table of Contents
1 Overview of Wireless SAPI and Features ........................................................................................................... 12
2 RS9116W Features ............................................................................................................................................... 14
3 Wireless SAPI Related Resources ...................................................................................................................... 16
4 SAPI Architecture ................................................................................................................................................. 17
5 SAPI Host Interfaces ............................................................................................................................................ 19
5.1 SPI Interface ................................................................................................................................................. 19
5.2 UART Interface ............................................................................................................................................. 33
6 Binary Command Mode ....................................................................................................................................... 35
7 SAPI Library Directory Structure ........................................................................................................................ 44
8 Common APIs ....................................................................................................................................................... 45
8.1 rsi_driver_init ................................................................................................................................................ 45
8.2 rsi_set_intr_type ........................................................................................................................................... 45
8.3 rsi_device_init ............................................................................................................................................... 46
8.4 rsi_bl_upgrade_firmware .............................................................................................................................. 46
8.5 rsi_cmd_uart_flow_ctrl .................................................................................................................................. 47
8.6 rsi_wireless_init ............................................................................................................................................ 48
8.7 rsi_wireless_deinit ........................................................................................................................................ 49
8.8 rsi_wireless_driver_task................................................................................................................................ 50
8.9 rsi_wireless_antenna .................................................................................................................................... 50
8.10 rsi_set_rtc_timer ........................................................................................................................................... 51
8.11 rsi_get_rtc_timer ........................................................................................................................................... 52
8.12 rsi_get_ram_log ............................................................................................................................................ 53
8.13 rsi_get_ram_dump ........................................................................................................................................ 53
8.14 rsi_get_fw_version ........................................................................................................................................ 54
8.15 rsi_common_debug_log ............................................................................................................................... 55
8.16 rsi_driver_deinit ............................................................................................................................................ 56
8.17 rsi_device_deinit ........................................................................................................................................... 56
8.18 rsi_gpio_pininit .............................................................................................................................................. 57
8.19 rsi_gpio_writepin ........................................................................................................................................... 57
8.20 rsi_gpio_readpin ........................................................................................................................................... 58
9 WLAN APIs ............................................................................................................................................................ 59
9.1 WLAN Core API ............................................................................................................................................ 59
9.1.1 rsi_wlan_scan ............................................................................................................................................... 59
9.1.2 rsi_wlan_scan_async .................................................................................................................................... 62
9.1.3 rsi_wlan_scan_with_bitmap_options ............................................................................................................. 66
9.1.4 rsi_wlan_scan_async_with_bitmap_options .................................................................................................. 66
9.1.5 rsi_wlan_connect .......................................................................................................................................... 67
9.1.6 rsi_wlan_connect_async ............................................................................................................................... 69
9.1.7 rsi_wlan_bgscan_profile ............................................................................................................................... 71
9.1.8 rsi_wlan_execute_post_connect_cmds ......................................................................................................... 72
9.1.9 rsi_wlan_disconnect ..................................................................................................................................... 73
9.1.10 rsi_wlan_enable_auto_config ........................................................................................................................ 73
9.1.11 rsi_wlan_pmk_generate ................................................................................................................................ 74
9.1.12 rsi_wlan_set_certificate_index ...................................................................................................................... 75
9.1.13 rsi_wlan_set_certificate................................................................................................................................. 76
9.1.14 rsi_wlan_get_status ...................................................................................................................................... 77
9.1.15 rsi_wlan_update_gain_table ......................................................................................................................... 77
9.1.16 rsi_wlan_ap_start ......................................................................................................................................... 82
9.1.17 rsi_wlan_wps_push_button_event ................................................................................................................ 83
9.1.18 rsi_wlan_wps_generate_pin .......................................................................................................................... 84
9.1.19 rsi_wlan_wps_enter_pin ............................................................................................................................... 84
9.1.20 rsi_get_random_bytes .................................................................................................................................. 85
9.1.21 rsi_wlan_disconnect_stations........................................................................................................................ 85
9.1.22 rsi_wlan_get ................................................................................................................................................. 86
9.1.23 rsi_wlan_set ................................................................................................................................................. 92
9.1.24 rsi_wlan_ ping_async ................................................................................................................................... 93
9.1.25 rsi_register_auto_config_rsp_handler ........................................................................................................... 94
9.1.26 rsi_wlan_add_profile ..................................................................................................................................... 95
9.1.27 rsi_wlan_get_state ........................................................................................................................................ 95
9.1.28 rsi_wlan_get_profile ...................................................................................................................................... 96
9.1.29 rsi_fill_config_profile ..................................................................................................................................... 97
9.1.30 rsi_wlan_delete_profile ................................................................................................................................. 97
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 3 | Page
9.1.31 rsi_wlan_ power_save_profile ....................................................................................................................... 98
9.1.32 rsi_wlan_power_save_with_listen_interval ...................................................................................................100
9.1.33 rsi_wlan_set_sleep_timer ............................................................................................................................101
9.1.34 rsi_wlan_filter_broadcast .............................................................................................................................102
9.1.35 rsi_wlan_register_callbacks .........................................................................................................................103
9.1.36 rsi_nwk_register_callbacks ..........................................................................................................................106
9.1.37 rsi_wlan_buffer_config .................................................................................................................................108
9.1.38 rsi_wlan_receive_stats_start ........................................................................................................................109
9.1.39 rsi_wlan_receive_stats_stop ........................................................................................................................109
9.1.40 rsi_wlan_send_data .....................................................................................................................................110
9.1.41 rsi_transmit_test_start .................................................................................................................................111
9.1.42 rsi_transmit_test_stop ..................................................................................................................................113
9.1.43 rsi_req_wireless_fwup .................................................................................................................................114
9.1.44 rsi_load_bootup_params .............................................................................................................................115
9.1.45 rsi_efuse_write ............................................................................................................................................115
9.1.46 rsi_efuse_read .............................................................................................................................................115
9.1.47 rsi_flash_mem_wr .......................................................................................................................................116
9.1.48 rsi_reset_mac ..............................................................................................................................................116
9.1.49 translate_channel ........................................................................................................................................117
9.1.50 rsi_radio_caps .............................................................................................................................................117
9.1.51 rsi_certificate_valid ......................................................................................................................................118
9.2 Configuration parameters ........................................................................................................................... 118
9.2.1 Configure opermode parameters..................................................................................................................118
9.2.2 Configure scan parameters ..........................................................................................................................120
9.2.3 Configure AP Mode parameters ...................................................................................................................120
9.2.4 Configure Set Region parameters ................................................................................................................121
9.2.5 Configure Set Region AP parameters ..........................................................................................................121
9.2.6 Configure Rejoin parameters .......................................................................................................................121
9.2.7 Configure BG scan parameters ....................................................................................................................121
9.2.8 Configure Roaming parameters ...................................................................................................................122
9.2.9 Configure HT capabilities .............................................................................................................................122
9.2.10 Configure Enterprise mode parameters ........................................................................................................123
9.2.11 Configure Join parameters ...........................................................................................................................123
9.2.12 Configure SSL parameters...........................................................................................................................123
9.2.13 Curve IDs Supported ...................................................................................................................................124
9.2.14 Configure Power Save parameters ..............................................................................................................124
9.2.15 Configure 10 TCP Sockets when Device is in AP mode ...............................................................................125
10 NWK APIs ............................................................................................................................................................ 126
10.1 DHCP User class (Option-77) API .............................................................................................................. 126
10.1.1 rsi_dhcp_user_class ....................................................................................................................................126
10.2 EMB_MQTT_client API ............................................................................................................................... 127
10.2.1 rsi_emb_mqtt_client_init ..............................................................................................................................127
10.2.2 rsi_emb_mqtt_connect.................................................................................................................................128
10.2.3 rsi_emb_mqtt_subscribe ..............................................................................................................................129
10.2.4 rsi_emb_mqtt_publish ..................................................................................................................................130
10.2.5 rsi_emb_mqtt_unsubscribe ..........................................................................................................................130
10.2.6 rsi_emb_mqtt_disconnect ............................................................................................................................131
10.2.7 rsi_emb_mqtt_destroy .................................................................................................................................132
10.3 Multicast...................................................................................................................................................... 132
10.3.1 rsi_multicast ................................................................................................................................................132
10.3.2 rsi_send_raw_data ......................................................................................................................................133
10.3.3 rsi_multicast_join .........................................................................................................................................133
10.3.4 rsi_multicast_leave ......................................................................................................................................134
10.4 MDNS 135
10.4.1 rsi_mdns_txt_rec_create ..............................................................................................................................135
10.4.2 rsi_mdns_txt_rec_setvalue ..........................................................................................................................135
10.4.3 rsi_mdns_txt_rec_search .............................................................................................................................136
10.4.4 rsi_mdns_txt_rec_removevalue ...................................................................................................................136
10.4.5 rsi_mdns_get_txt_rec_buffer ........................................................................................................................137
10.5 BSD Socket API .......................................................................................................................................... 137
10.5.1 rsi_config_ipaddress ....................................................................................................................................137
10.5.2 rsi_socket ....................................................................................................................................................139
10.5.3 rsi_bind .......................................................................................................................................................139
10.5.4 rsi_connect ..................................................................................................................................................140
10.5.5 rsi_listen ......................................................................................................................................................141
10.5.6 rsi_accept ....................................................................................................................................................141
10.5.7 rsi_accept_async .........................................................................................................................................142
10.5.8 rsi_select .....................................................................................................................................................142
10.5.9 rsi_recvfrom ................................................................................................................................................143
10.5.10 rsi_recv .......................................................................................................................................................144
10.5.11 rsi_sendto....................................................................................................................................................144
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 4 | Page
10.5.12 rsi_sendto_async .........................................................................................................................................145
10.5.13 rsi_send ......................................................................................................................................................146
10.5.14 rsi_send_async ...........................................................................................................................................146
10.5.15 rsi_shutdown ...............................................................................................................................................147
10.5.16 rsi_getsockopt .............................................................................................................................................148
10.5.17 rsi_setsockopt .............................................................................................................................................149
10.5.18 rsi_socket_async .........................................................................................................................................150
10.5.19 rsi_fd_isset ..................................................................................................................................................150
10.5.20 rsi_set_fd.....................................................................................................................................................151
10.5.21 rsi_fd_clr .....................................................................................................................................................151
10.5.22 rsi_select_set_status ...................................................................................................................................151
10.5.23 rsi_select_get_status ...................................................................................................................................152
10.6 DNS 152
10.6.1 rsi_dns_req .................................................................................................................................................152
10.6.2 rsi_dns_update ............................................................................................................................................154
10.7 FWUP 154
10.7.1 rsi_fwup .......................................................................................................................................................154
10.7.2 rsi_fwup_start ..............................................................................................................................................155
10.7.3 rsi_fwup_load ..............................................................................................................................................156
10.8 FTP Client API ............................................................................................................................................ 156
10.8.1 rsi_ftp_connect ............................................................................................................................................156
10.8.2 rsi_ftp_disconnect ........................................................................................................................................157
10.8.3 rsi_ftp_file_write...........................................................................................................................................158
10.8.4 rsi_ftp_file_write_content .............................................................................................................................159
10.8.5 rsi_ftp_file_read_async ................................................................................................................................159
10.8.6 rsi_ftp_file_delete ........................................................................................................................................160
10.8.7 rsi_ftp_file_rename ......................................................................................................................................161
10.8.8 rsi_ftp_directory_create ...............................................................................................................................162
10.8.9 rsi_ftp_directory_delete................................................................................................................................162
10.8.10 rsi_ftp_directory_set ....................................................................................................................................163
10.8.11 rsi_ftp_directory_list_async ..........................................................................................................................163
10.8.12 rsi_ftp_mode_set .........................................................................................................................................164
10.9 HTTP Client API ......................................................................................................................................... 165
10.9.1 rsi_http_client_get_async ............................................................................................................................165
10.9.2 rsi_http_client_post_async ...........................................................................................................................167
10.9.3 rsi_http_client_async ...................................................................................................................................169
10.9.4 rsi_http_client_post_data .............................................................................................................................172
10.9.5 rsi_http_client_put_create ............................................................................................................................173
10.9.6 rsi_http_client_put_start ...............................................................................................................................174
10.9.7 rsi_http_client_put_pkt .................................................................................................................................176
10.9.8 rsi_http_client_put_delete ............................................................................................................................176
10.9.9 rsi_http_client_abort ....................................................................................................................................177
10.9.10 rsi_http_credentials......................................................................................................................................178
10.10 Network Application Protocol ...................................................................................................................... 178
10.10.1 SMTP client API ..........................................................................................................................................178
10.10.2 SNTP Client API ..........................................................................................................................................182
10.10.3 MQTT Client API .........................................................................................................................................185
10.10.4 HTTP Server API .........................................................................................................................................190
10.10.5 MDNSD API ................................................................................................................................................193
10.10.6 Socket configuration API ..............................................................................................................................195
10.10.7 rsi_wlan_req_radio ......................................................................................................................................196
10.10.8 rsi_wlan_add_mfi_ie ....................................................................................................................................197
10.10.9 Web socket API ...........................................................................................................................................197
10.10.10 OTAF client API ...........................................................................................................................................200
11 BT/BLE Common APIs ....................................................................................................................................... 202
11.1 rsi_bt_set_local_name ................................................................................................................................ 202
11.2 rsi_bt_get_local_name ................................................................................................................................ 202
11.3 rsi_bt_get_rssi ............................................................................................................................................ 203
11.4 rsi_bt_get_local_device_address ................................................................................................................ 204
11.5 rsi_bt_init .................................................................................................................................................... 204
11.6 rsi_bt_deinit ................................................................................................................................................ 205
11.7 rsi_bt_set_antenna ..................................................................................................................................... 205
11.8 rsi_bt_set_feature_bitmap .......................................................................................................................... 206
11.9 rsi_bt_set_antenna_tx_power_level ........................................................................................................... 206
11.10 rsi_bt_power_save_profile .......................................................................................................................... 207
12 Bluetooth Classic APIs ...................................................................................................................................... 209
12.1 Test Mode (RF Regulatory Mode) API ........................................................................................................ 209
12.1.1 rsi_bt_enable_device_under_testmode ........................................................................................................209
12.1.2 rsi_bt_per_rx ...............................................................................................................................................209
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 5 | Page
12.1.3 rsi_bt_per_tx................................................................................................................................................211
12.1.4 rsi_bt_per_stats ...........................................................................................................................................214
12.2 GAP API ..................................................................................................................................................... 215
12.2.1 rsi_bt_set_local_class_of_device .................................................................................................................215
12.2.2 rsi_bt_get_local_class_of_device .................................................................................................................216
12.2.3 rsi_bt_start_discoverable .............................................................................................................................216
12.2.4 rsi_bt_start_limited_discoverable .................................................................................................................216
12.2.5 rsi_bt_stop_discoverable .............................................................................................................................217
12.2.6 rsi_bt_get_discoverable_status ....................................................................................................................217
12.2.7 rsi_bt_set_connectable ................................................................................................................................218
12.2.8 rsi_bt_set_non_connectable ........................................................................................................................218
12.2.9 rsi_bt_get_connectable_status .....................................................................................................................219
12.2.10 rsi_bt_set_afh_host_channel_classification ..................................................................................................219
12.2.11 rsi_bt_get_afh_host_channel_classification..................................................................................................220
12.2.12 rsi_bt_remote_name_request_async ...........................................................................................................220
12.2.13 rsi_bt_remote_name_request_cancel ..........................................................................................................221
12.2.14 rsi_bt_inquiry ...............................................................................................................................................222
12.2.15 rsi_bt_cancel_inquiry ...................................................................................................................................222
12.2.16 rsi_bt_set_eir_data ......................................................................................................................................223
12.2.17 rsi_bt_connect .............................................................................................................................................223
12.2.18 rsi_bt_cancel_connect .................................................................................................................................224
12.2.19 rsi_bt_disconnect .........................................................................................................................................224
12.2.20 rsi_bt_set_ssp_mode ...................................................................................................................................225
12.2.21 rsi_bt_accept_ssp_confirm ..........................................................................................................................226
12.2.22 rsi_bt_reject_ssp_confirm ............................................................................................................................226
12.2.23 rsi_bt_passkey ............................................................................................................................................226
12.2.24 rsi_bt_pincode_request_reply ......................................................................................................................227
12.2.25 rsi_bt_linkkey_request_reply ........................................................................................................................228
12.2.26 rsi_bt_get_local_device_role ........................................................................................................................228
12.2.27 rsi_bt_set_local_device_role ........................................................................................................................229
12.2.28 rsi_bt_sniff_mode ........................................................................................................................................229
12.2.29 rsi_bt_sniff_exit_mode .................................................................................................................................230
12.2.30 rsi_bt_sniff_subrating_mode ........................................................................................................................230
12.2.31 rsi_bt_add_device_id ...................................................................................................................................231
12.2.32 rsi_bt_enable_authentication .......................................................................................................................231
12.2.33 rsi_bt_disable_authentication .......................................................................................................................232
12.2.34 rsi_bt_get_authentication .............................................................................................................................232
12.2.35 rsi_bt_ptt_req ..............................................................................................................................................233
12.2.36 rsi_bt_write_current_iac_lap ........................................................................................................................233
12.2.37 rsi_bt_get_services_async ...........................................................................................................................234
12.2.38 rsi_bt_search_service_async .......................................................................................................................234
12.3 SPP API ...................................................................................................................................................... 235
12.3.1 rsi_bt_spp_init .............................................................................................................................................235
12.3.2 rsi_bt_spp_connect......................................................................................................................................235
12.3.3 rsi_bt_spp_disconnect .................................................................................................................................236
12.3.4 rsi_bt_spp_transfer ......................................................................................................................................236
12.4 SDP API...................................................................................................................................................... 237
12.4.1 rsi_bt_set_sdp_attr_id .................................................................................................................................237
12.4.2 rsi_bt_add_sdp_attribute .............................................................................................................................238
12.4.3 rsi_bt_add_sdp_hid_language_attribute .......................................................................................................239
12.4.4 rsi_bt_add_sdp_hid_descriptor_list ..............................................................................................................240
12.4.5 rsi_bt_add_sdp_service_attribute.................................................................................................................241
12.4.6 rsi_bt_add_sdp_service_classid ..................................................................................................................242
12.4.7 rsi_bt_add_sdp_service_handle ...................................................................................................................243
12.4.8 rsi_bt_add_sdp_protocol_list .......................................................................................................................244
12.4.9 rsi_bt_add_sdp_language_base_attributeid_list ...........................................................................................245
12.4.10 rsi_bt_add_sdp_profile_descriptor_list .........................................................................................................246
12.4.11 rsi_bt_add_sdp_service_record_handle .......................................................................................................247
12.5 HID API ....................................................................................................................................................... 248
12.5.1 rsi_bt_hid_service_initialize .........................................................................................................................248
12.5.2 rsi_bt_hid_init ..............................................................................................................................................249
12.5.3 rsi_bt_hid_connect ......................................................................................................................................249
12.5.4 rsi_bt_hid_disconnect ..................................................................................................................................250
12.5.5 rsi_bt_hid_register_callbacks .......................................................................................................................250
12.5.6 rsi_bt_hid_send_interrupt_data ....................................................................................................................251
12.5.7 rsi_bt_hid_profile_data.................................................................................................................................252
12.5.8 rsi_bt_hid_send_handshake ........................................................................................................................252
12.5.9 rsi_bt_hid_send_control ...............................................................................................................................253
12.5.10 rsi_bt_hid_get_report ...................................................................................................................................253
12.5.11 rsi_bt_hid_set_report ...................................................................................................................................254
12.5.12 rsi_bt_hid_get_protocol................................................................................................................................254
12.5.13 rsi_bt_hid_set_protocol ................................................................................................................................255
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 6 | Page
12.5.14 rsi_bt_hid_set_protocol ................................................................................................................................255
12.6 GAP Register Callbacks ............................................................................................................................. 256
12.6.1 rsi_bt_gap_register_callbacks ......................................................................................................................256
12.6.2 rsi_bt_on_role_change_t .............................................................................................................................257
12.6.3 rsi_bt_on_connect_t ....................................................................................................................................257
12.6.4 rsi_bt_on_unbond_t .....................................................................................................................................258
12.6.5 rsi_bt_on_disconnect_t ................................................................................................................................259
12.6.6 rsi_bt_on_scan_resp_t.................................................................................................................................259
12.6.7 rsi_bt_on_remote_name_resp_t ..................................................................................................................260
12.6.8 rsi_bt_on_passkey_display_t .......................................................................................................................261
12.6.9 rsi_bt_on_remote_name_request_cancel_t ..................................................................................................261
12.6.10 rsi_bt_on_confirm_request_t ........................................................................................................................262
12.6.11 rsi_bt_on_pincode_request_t .......................................................................................................................262
12.6.12 rsi_bt_on_passkey_request_t ......................................................................................................................263
12.6.13 rsi_bt_on_inquiry_complete_t ......................................................................................................................264
12.6.14 rsi_bt_on_auth_complete_t ..........................................................................................................................264
12.6.15 rsi_bt_on_linkkey_request_t ........................................................................................................................265
12.6.16 rsi_bt_on_ssp_complete_t ...........................................................................................................................265
12.6.17 rsi_bt_on_linkkey_save_t .............................................................................................................................266
12.6.18 rsi_bt_on_get_services_t .............................................................................................................................266
12.6.19 rsi_bt_on_search_service_t .........................................................................................................................267
12.6.20 rsi_bt_on_mode_change_t...........................................................................................................................267
12.6.21 rsi_bt_on_sniff_subrating_t ..........................................................................................................................268
12.7 SPP event callbacks ................................................................................................................................... 269
12.7.1 rsi_bt_spp_register_callbacks ......................................................................................................................269
12.7.2 rsi_bt_on_spp_connect_t .............................................................................................................................269
12.7.3 rsi_bt_on_spp_disconnect_t ........................................................................................................................270
12.7.4 rsi_bt_on_spp_rx_data_t .............................................................................................................................271
12.7.5 rsi_bt_change_pkt_type ...............................................................................................................................271
12.8 HCI packet change callbacks...................................................................................................................... 272
12.8.1 rsi_bt_pkt_change_events_register_callbacks .............................................................................................272
12.8.2 rsi_bt_pkt_change_stats_t ...........................................................................................................................272
12.9 Configuration Parameters ........................................................................................................................... 273
13 Bluetooth Low Energy APIs .............................................................................................................................. 275
13.1 Test Mode (RF Regulatory Mode) API ........................................................................................................ 275
13.1.1 rsi_ble_rx_test_mode ..................................................................................................................................275
13.1.2 rsi_ble_tx_test_mode ...................................................................................................................................275
13.1.3 rsi_ble_end_test_mode................................................................................................................................276
13.1.4 rsi_ble_per_transmit ....................................................................................................................................277
13.1.5 rsi_ble_per_receive .....................................................................................................................................279
13.2 GAP API ..................................................................................................................................................... 282
13.2.1 rsi_ble_set_random_address .......................................................................................................................282
13.2.2 rsi_ble_set_random_address_with_value .....................................................................................................282
13.2.3 rsi_ble_update_directed_address ................................................................................................................283
13.2.4 rsi_ble_start_advertising ..............................................................................................................................283
13.2.5 rsi_ble_start_advertising_with_values ..........................................................................................................284
13.2.6 rsi_ble_encrypt ............................................................................................................................................285
13.2.7 rsi_ble_stop_advertising ..............................................................................................................................286
13.2.8 rsi_ble_start_scanning .................................................................................................................................287
13.2.9 rsi_ble_start_scanning_with_values .............................................................................................................287
13.2.10 rsi_ble_stop_scanning .................................................................................................................................288
13.2.11 rsi_ble_connect ...........................................................................................................................................289
13.2.12 rsi_ble_connect_with_params ......................................................................................................................289
13.2.13 rsi_ble_connect_cancel ...............................................................................................................................291
13.2.14 rsi_ble_disconnect .......................................................................................................................................291
13.2.15 rsi_ble_get_device_state .............................................................................................................................292
13.2.16 rsi_ble_set_smp_pairing_cap_data ..............................................................................................................292
13.2.17 rsi_ble_set_local_irk_value ..........................................................................................................................293
13.2.18 rsi_ble_set_advertise_data ..........................................................................................................................294
13.2.19 rsi_ble_smp_pair_request ............................................................................................................................295
13.2.20 rsi_ble_smp_pair_response .........................................................................................................................296
13.2.21 rsi_ble_smp_passkey ..................................................................................................................................297
13.2.22 rsi_ble_get_le_ping_timeout ........................................................................................................................297
13.2.23 rsi_ble_set_le_ping_timeout ........................................................................................................................298
13.2.24 rsi_ble_set_scan_response_data .................................................................................................................298
13.2.25 rsi_ble_clear_whitelist ..................................................................................................................................299
13.2.26 rsi_ble_addto_whitelist.................................................................................................................................299
13.2.27 rsi_ble_deletefrom_whitelist .........................................................................................................................300
13.2.28 rsi_ble_vendor_rf_type ................................................................................................................................300
13.2.29 rsi_ble_white_list_using_adv_data ...............................................................................................................301
13.2.30 rsi_ble_start_encryption ...............................................................................................................................302
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 7 | Page
13.3 Basic Structure defines ............................................................................................................................... 302
13.3.1 uuid_t structure ............................................................................................................................................302
13.3.2 inc_service_data_t .......................................................................................................................................303
13.3.3 inc_service_t ...............................................................................................................................................303
13.3.4 char_serv_data_t .........................................................................................................................................303
13.3.5 char_serv_t .................................................................................................................................................304
13.3.6 att_desc_t....................................................................................................................................................304
13.3.7 rsi_ble_resp_profiles_list_t...........................................................................................................................305
13.3.8 rsi_ble_resp_char_services_t.......................................................................................................................305
13.3.9 rsi_ble_resp_inc_services_t .........................................................................................................................305
13.3.10 rsi_ble_resp_att_value_t ..............................................................................................................................306
13.3.11 rsi_ble_resp_att_descs_t .............................................................................................................................306
13.3.12 rsi_ble_req_add_att_t ..................................................................................................................................306
13.3.13 rsi_ble_resp_local_att_value_t .....................................................................................................................307
13.3.14 rsi_bt_event_le_ltk_request_s......................................................................................................................307
13.3.15 rsi_ble_set_le_ltkreqreply ............................................................................................................................308
13.4 Credit based flow APIs ............................................................................................................................... 308
13.4.1 rsi_ble_cbfc_connreq ...................................................................................................................................308
13.4.2 rsi_ble_cbfc_connresp .................................................................................................................................309
13.4.3 rsi_ble_cbfc_data_tx ....................................................................................................................................309
13.4.4 rsi_ble_cbfc_disconnect ...............................................................................................................................309
13.5 GATT Client APIs ....................................................................................................................................... 310
13.5.1 rsi_ble_get_profiles......................................................................................................................................310
13.5.2 rsi_ble_get_profile .......................................................................................................................................311
13.5.3 rsi_ble_get_char_services ...........................................................................................................................311
13.5.4 rsi_ble_get_inc_services ..............................................................................................................................312
13.5.5 rsi_ble_get_char_value_by_uuid ..................................................................................................................313
13.5.6 rsi_ble_get_att_descriptors ..........................................................................................................................313
13.5.7 rsi_ble_get_att_value ...................................................................................................................................314
13.5.8 rsi_ble_get_multiple_att_values ...................................................................................................................315
13.5.9 rsi_ble_get_long_att_value ..........................................................................................................................315
13.5.10 rsi_ble_set_att_value ...................................................................................................................................316
13.5.11 rsi_ble_set_att_cmd.....................................................................................................................................317
13.5.12 rsi_ble_set_long_att_value ..........................................................................................................................317
13.5.13 rsi_ble_prepare_write ..................................................................................................................................318
13.5.14 rsi_ble_execute_write ..................................................................................................................................319
13.5.15 rsi_ble_notify_value .....................................................................................................................................319
13.5.16 rsi_ble_indicate_value .................................................................................................................................320
13.5.17 rsi_ble_remove_gatt_service .......................................................................................................................320
13.5.18 rsi_ble_remove_gatt_attibute .......................................................................................................................321
13.5.19 rsi_ble_att_error_response ..........................................................................................................................321
13.5.20 rsi_ble_mtu_exchange_event ......................................................................................................................322
13.5.21 rsi_ble_gatt_write_response ........................................................................................................................322
13.5.22 rsi_ble_gatt_prepare_write_response ..........................................................................................................323
13.6 GATT Client APIs Asynchronous ................................................................................................................ 324
13.6.1 rsi_ble_get_profiles_async...........................................................................................................................324
13.6.2 rsi_ble_get_profile_async ............................................................................................................................324
13.6.3 rsi_ble_get_char_services_async ................................................................................................................325
13.6.4 rsi_ble_get_inc_services_async ...................................................................................................................325
13.6.5 rsi_ble_get_char_value_by_uuid_async .......................................................................................................326
13.6.6 rsi_ble_get_att_descriptors_async ...............................................................................................................327
13.6.7 rsi_ble_get_att_value_async ........................................................................................................................327
13.6.8 rsi_ble_get_multiple_att_values_async ........................................................................................................328
13.6.9 rsi_ble_get_long_att_value_async ...............................................................................................................328
13.6.10 rsi_ble_set_att_value_async ........................................................................................................................329
13.6.11 rsi_ble_prepare_write_async .......................................................................................................................330
13.6.12 rsi_ble_execute_write_async .......................................................................................................................330
13.7 GATT Server APIs ...................................................................................................................................... 331
13.7.1 rsi_ble_add_service .....................................................................................................................................331
13.7.2 rsi_ble_add_attribute ...................................................................................................................................333
13.7.3 rsi_ble_set_local_att_value ..........................................................................................................................333
13.7.4 rsi_ble_get_local_att_value ..........................................................................................................................334
13.7.5 rsi_ble_set_wo_resp_notify_buf_info ...........................................................................................................334
13.7.6 rsi_ble_gatt_read_response .........................................................................................................................335
13.7.7 rsi_ble_setphy .............................................................................................................................................335
13.7.8 rsi_ble_conn_params_update ......................................................................................................................336
13.7.9 rsi_ble_conn_param_resp............................................................................................................................337
13.7.10 rsi_ble_set_data_len ....................................................................................................................................337
13.7.11 rsi_ble_read_max_data_len .........................................................................................................................338
13.7.12 rsi_ble_readphy ...........................................................................................................................................339
13.7.13 rsi_ble_resolvlist ..........................................................................................................................................340
13.7.14 rsi_ble_get_resolving_list_size .....................................................................................................................340
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 8 | Page
13.7.15 BT_LE_ADPacketExtract .............................................................................................................................341
13.7.16 rsi_ble_set_addr_resolution_enable .............................................................................................................341
13.7.17 rsi_ble_set_privacy_mode ...........................................................................................................................342
13.7.18 rsi_ble_ltk_req_reply ....................................................................................................................................342
13.8 Callback functions ....................................................................................................................................... 343
13.8.1 rsi_ble_gap_register_callbacks ....................................................................................................................343
13.8.2 rsi_ble_event_adv_report_t ..........................................................................................................................344
13.8.3 rsi_ble_event_conn_status_t .......................................................................................................................344
13.8.4 rsi_ble_event_disconnect_t ..........................................................................................................................345
13.8.5 rsi_ble_on_le_ping_payload_timeout_t ........................................................................................................345
13.8.6 rsi_ble_on_phy_update_complete_t .............................................................................................................346
13.8.7 rsi_ble_on_data_length_update_t ................................................................................................................346
13.8.8 rsi_ble_on_enhance_connect_t ...................................................................................................................347
13.8.9 rsi_ble_on_directed_adv_report_event_t......................................................................................................347
13.8.10 rsi_ble_on_conn_update_complete_t ...........................................................................................................348
13.8.11 rsi_ble_gap_extended_register_callbacks ....................................................................................................348
13.8.12 ble_on_remote_features_event ....................................................................................................................349
13.8.13 rsi_ble_gatt_register_callbacks ....................................................................................................................349
13.8.14 rsi_ble_on_profiles_list_resp_t .....................................................................................................................351
13.8.15 rsi_ble_on_profile_resp_t .............................................................................................................................351
13.8.16 rsi_ble_on_char_services_resp_t .................................................................................................................352
13.8.17 rsi_ble_on_inc_services_resp_t ...................................................................................................................352
13.8.18 rsi_ble_on_att_desc_resp_t .........................................................................................................................353
13.8.19 rsi_ble_on_read_resp_t ...............................................................................................................................353
13.8.20 ble_on_write_resp .......................................................................................................................................354
13.8.21 GATT Write event ........................................................................................................................................354
13.8.22 GATT Prepare Write event...........................................................................................................................355
13.8.23 GATT Execute Write event ..........................................................................................................................355
13.8.24 GATT Read request event ...........................................................................................................................355
13.8.25 MTU event ...................................................................................................................................................356
13.9 l2cap cbsc register callbacks ...................................................................................................................... 360
13.9.1 rsi_ble_l2cap_cbsc_register_callbacks ........................................................................................................361
13.9.2 rsi_ble_on_cbfc_conn_req_event_t ..............................................................................................................361
13.9.3 rsi_ble_on_cbfc_conn_complete_event_t .....................................................................................................361
13.9.4 rsi_ble_on_cbfc_rx_data_event_t.................................................................................................................362
13.9.5 rsi_ble_on_cbfc_disconn_event_t ................................................................................................................362
13.9.6 rsi_ble_smp_register_callbacks ...................................................................................................................362
13.9.7 rsi_ble_on_smp_request_t ...........................................................................................................................363
13.9.8 rsi_ble_on_smp_response_t ........................................................................................................................363
13.9.9 rsi_ble_on_smp_passkey_t ..........................................................................................................................364
13.9.10 rsi_ble_on_smp_failed_t ..............................................................................................................................364
13.9.11 rsi_ble_on_encrypt_started_t .......................................................................................................................364
13.9.12 rsi_ble_on_smp_passkey_display_t .............................................................................................................365
13.9.13 rsi_ble_on_sc_passkey_t .............................................................................................................................365
13.9.14 rsi_ble_on_le_ltk_req_event_t .....................................................................................................................365
13.9.15 rsi_ble_on_le_security_keys_t .....................................................................................................................366
13.9.16 rsi_ble_on_phy_update_complete_t .............................................................................................................366
13.9.17 rsi_ble_on_data_length_update_t ................................................................................................................367
13.9.18 rsi_ble_on_directed_adv_report_event_t......................................................................................................367
13.9.19 rsi_ble_on_enhance_connect_t: ..................................................................................................................368
13.9.20 rsi_ble_event_cbfc_conn_req_t ...................................................................................................................369
13.9.21 rsi_ble_event_cbfc_conn_complete_t ..........................................................................................................369
13.9.22 rsi_ble_event_cbfc_rx_data_t ......................................................................................................................370
13.9.23 rsi_ble_event_cbfc_disconn_t ......................................................................................................................370
13.9.24 rsi_bt_event_le_ltk_request .........................................................................................................................371
13.10 Configuration parameters ........................................................................................................................... 371
13.10.1 Configure advertise parameters ...................................................................................................................371
13.10.2 Configure scan parameters ..........................................................................................................................372
13.10.3 Configure connection parameters ................................................................................................................372
13.10.4 Configuration for White list based on Advertising payload data .....................................................................372
14 Crypto APIs ......................................................................................................................................................... 374
14.1 rsi_aes 374
14.2 rsi_exponentiation ....................................................................................................................................... 374
14.3 rsi_ecdh_point_multiplication ...................................................................................................................... 375
14.4 rsi_ecdh_point_addition .............................................................................................................................. 376
14.5 rsi_ecdh_point_subtraction ......................................................................................................................... 376
14.6 rsi_ecdh_point_double ................................................................................................................................ 377
14.7 rsi_ecdh_point_affine .................................................................................................................................. 378
14.8 rsi_hmac_sha ............................................................................................................................................. 378
14.9 rsi_sha 379
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 9 | Page
15 Driver APIs .......................................................................................................................................................... 381
15.1 Device Init ................................................................................................................................................... 381
15.1.1 rsi_bl_module_power_cycle .........................................................................................................................381
15.2 Driver 381
15.2.1 rsi_interrupt_handler ....................................................................................................................................381
15.2.2 rsi_mask_ta_interrupt ..................................................................................................................................381
15.2.3 rsi_unmask_ta_interrupt ..............................................................................................................................382
15.3 Events 382
15.3.1 rsi_set_event ...............................................................................................................................................382
15.3.2 rsi_clear_event ............................................................................................................................................383
15.3.3 rsi_mask_event ...........................................................................................................................................383
15.3.4 rsi_unmask_event .......................................................................................................................................383
15.3.5 rsi_unmask_event_from_isr .........................................................................................................................384
15.3.6 rsi_find_event ..............................................................................................................................................384
15.3.7 rsi_register_event ........................................................................................................................................384
15.3.8 rsi_set_event_from_isr.................................................................................................................................385
15.3.9 rsi_events_init .............................................................................................................................................385
15.4 Nwk 386
15.4.1 rsi_wlan_get_nwk_status .............................................................................................................................386
15.5 Set Region AP ............................................................................................................................................ 386
15.5.1 extract_setregionap_country_info ................................................................................................................386
15.6 Timer 387
15.6.1 rsi_timer_expiry_interrupt_handler ...............................................................................................................387
15.6.2 rsi_timer_read_counter ................................................................................................................................387
15.6.3 rsi_init_timer ................................................................................................................................................387
15.6.4 rsi_timer_expired .........................................................................................................................................388
15.6.5 rsi_timer_left ................................................................................................................................................388
15.7 Utils 389
15.7.1 rsi_uint16_to_2bytes ....................................................................................................................................389
15.7.2 rsi_uint32_to_4bytes ....................................................................................................................................389
15.7.3 rsi_bytes2R_to_uint16 .................................................................................................................................390
15.7.4 rsi_bytes4R_to_uint32 .................................................................................................................................390
15.7.5 rsi_ascii_hex2num .......................................................................................................................................390
15.7.6 rsi_char_hex2dec ........................................................................................................................................391
15.7.7 rsi_ascii_dev_address_to_6bytes_rev ..........................................................................................................391
15.7.8 rsi_6byte_dev_address_to_ascii ..................................................................................................................392
15.7.9 lmac_crc8_c ................................................................................................................................................392
15.7.10 multicast_mac_hash ....................................................................................................................................392
15.7.11 convert_lower_case_to_upper_case ............................................................................................................393
15.7.12 string2array .................................................................................................................................................393
15.7.13 rsi_itoa ........................................................................................................................................................394
15.7.14 rsi_atoi ........................................................................................................................................................394
15.7.15 asciihex_2_num...........................................................................................................................................394
15.7.16 rsi_charhex_2_dec ......................................................................................................................................395
15.7.17 rsi_ascii_mac_address_to_6bytes ...............................................................................................................395
15.7.18 rsi_ascii_dot_address_to_4bytes .................................................................................................................396
15.7.19 ip_to_reverse_hex .......................................................................................................................................396
15.8 Wlan 397
15.8.1 rsi_wlan_cb_init ...........................................................................................................................................397
15.8.2 rsi_driver_wlan_send_cmd ..........................................................................................................................398
15.8.3 rsi_extract_filename.....................................................................................................................................400
15.8.4 rsi_driver_process_wlan_recv_cmd .............................................................................................................400
15.8.5 rsi_wlan_check_waiting_socket_cmd ...........................................................................................................401
15.8.6 rsi_wlan_check_waiting_wlan_cmd ..............................................................................................................402
15.8.7 rsi_wlan_check_wlan_state .........................................................................................................................402
15.8.8 rsi_wlan_set_status .....................................................................................................................................403
15.8.9 rsi_post_waiting_semaphore .......................................................................................................................403
15.8.10 rsi_wlan_process_raw_data .........................................................................................................................404
15.8.11 rsi_wlan_packet_transfer_done ...................................................................................................................404
15.8.12 rsi_check_wlan_buffer_full ...........................................................................................................................405
15.8.13 rsi_check_common_buffer_full .....................................................................................................................406
15.8.14 rsi_wait_on_wlan_semaphore ......................................................................................................................406
15.8.15 rsi_update_wlan_cmd_state_to_free_state ..................................................................................................407
15.8.16 sort_index_based_on_rssi ...........................................................................................................................407
15.8.17 process_scan_results ..................................................................................................................................408
15.9 SPI 409
15.9.1 rsi_nlink_pkt_rd ...........................................................................................................................................409
15.9.2 rsi_frame_read ............................................................................................................................................409
15.9.3 rsi_frame_write ............................................................................................................................................410
15.9.4 rsi_pre_dsc_rd .............................................................................................................................................410
15.9.5 rsi_pkt_rd ....................................................................................................................................................411
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 10 | Page
15.9.6 rsi_spi_frame_dsc_wr ..................................................................................................................................411
15.9.7 rsi_spi_frame_data_wr.................................................................................................................................412
15.9.8 rsi_send_c1c2 .............................................................................................................................................412
15.9.9 rsi_send_c3c4 .............................................................................................................................................413
15.9.10 rsi_spi_wait_start_token ..............................................................................................................................413
15.9.11 rsi_set_intr_mask ........................................................................................................................................414
15.9.12 rsi_set_intr_type ..........................................................................................................................................414
15.9.13 rsi_clear_interrupt ........................................................................................................................................415
15.9.14 rsi_device_interrupt_status ..........................................................................................................................415
15.9.15 rsi_spi_pkt_len ............................................................................................................................................416
15.9.16 rsi_spi_high_speed_enable .........................................................................................................................416
15.9.17 rsi_spi_iface_init ..........................................................................................................................................417
15.9.18 rsi_ulp_wakeup_init .....................................................................................................................................417
15.9.19 rsi_mem_wr .................................................................................................................................................417
15.9.20 rsi_mem_rd .................................................................................................................................................418
15.9.21 rsi_reg_rd ....................................................................................................................................................419
15.9.22 rsi_reg_rd2 ..................................................................................................................................................419
15.9.23 rsi_reg_wr ...................................................................................................................................................420
15.10 BT BLE 420
15.10.1 rsi_bt_common_register_callbacks ..............................................................................................................420
15.10.2 rsi_bt_get_proto_type ..................................................................................................................................421
15.10.3 rsi_bt_get_timeout .......................................................................................................................................421
15.10.4 rsi_bt_common_tx_done ..............................................................................................................................421
15.10.5 rsi_get_bt_state ...........................................................................................................................................422
15.10.6 rsi_bt_set_status .........................................................................................................................................422
15.10.7 rsi_bt_get_status .........................................................................................................................................423
15.10.8 rsi_ble_update_le_dev_buf ..........................................................................................................................423
15.10.9 rsi_add_remote_ble_dev_info ......................................................................................................................423
15.10.10 rsi_remove_remote_ble_dev_info ................................................................................................................424
15.10.11 rsi_driver_process_bt_resp ..........................................................................................................................424
15.10.12 rsi_driver_process_bt_resp_handler ............................................................................................................425
15.10.13 rsi_bt_cb_init ...............................................................................................................................................425
15.10.14 rsi_bt_common_init......................................................................................................................................426
15.10.15 rsi_bt_gatt_extended_register_callbacks ......................................................................................................426
15.10.16 rsi_bt_avdtp_events_register_callbacks .......................................................................................................427
15.10.17 rsi_bt_on_chip_memory_status_callbacks_register ......................................................................................427
15.10.18 rsi_bt_hfp_register_callbacks .......................................................................................................................428
15.10.19 rsi_ble_callbacks_handler ............................................................................................................................429
15.10.20 rsi_ble_on_chip_memory_status_callbacks_register ....................................................................................430
15.10.21 rsi_bt_prepare_common_pkt .......................................................................................................................430
15.10.22 rsi_bt_prepare_classic_pkt ..........................................................................................................................431
15.10.23 rsi_bt_prepare_le_pkt ..................................................................................................................................431
15.10.24 rsi_bt_driver_send_cmd ...............................................................................................................................432
16 SAPI Error Codes ............................................................................................................................................... 433
16.1 SAPI Generic Error Codes .......................................................................................................................... 433
16.2 Bluetooth Generic Error Codes ................................................................................................................... 434
16.3 Bluetooth Classic Error Codes .................................................................................................................... 437
16.3.1 BT Core Error Codes ...................................................................................................................................437
16.4 Bluetooth Low Energy Error Codes ............................................................................................................ 439
16.4.1 BLE Generic Error Codes ............................................................................................................................439
16.4.2 BLE Mode Error Codes ................................................................................................................................440
16.5 WLAN Error codes ...................................................................................................................................... 441
16.6 Socket Error Codes .................................................................................................................................... 449
17 Changes/Enhancements in APIs, Configurations and Mechanisms.............................................................. 450
17.1 Changes and Enhancements from release 1.X.X to 2.X.X ......................................................................... 450
17.1.1 Wi-Fi ...........................................................................................................................................................450
17.1.2 BT/BLE ........................................................................................................................................................451
18 Revision History ................................................................................................................................................. 455
19 Appendix A: WLAN API Call Sequence Examples .......................................................................................... 459
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 11 | Page
About this Document
This document provides complete details on the RS9116 WiSeConnect SAPI (Simple API) library, including:
• briefs about the RS9116 WiSeConnect SAPI Architecture.
• details of the APIs and configurations available in the SAPI library.
• details of the new changes in the SAPI library in conjunction with previous releases.
Note:
This information should be considered by users/developers when upgrading to latest release.
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 12 | Page
1 Overview of Wireless SAPI and Features
The RS9116W SAPI library is a comprehensive collection of Wireless, Network Applications, BSD Socket APIs, and
RS9116 driver code along with different HALs for mapping it to platform interface on which this library will be ported.
The SAPI is intended to run on host machine, it can be an MCU with/without RTOS or any Linux machine. Users are
recommended to use the given APIs without any modification in order to facilitate upgrading to the future releases.
Users are also recommended to upgrade SAPI along with the firmware.
The RS9116 WiSeConnect module includes Wi-Fi, TCP/IP Networking stack with SSL 3.0/TLS 1.2, HTTP/HTTPS,
Websockets, DHCP, MQTT client, and BT 5 stacks embedded. This module requires a separate application
processor, which acts as a host.
The host can communicate with the RS9116 module using one of the interfaces listed below.
• SPI
• UART
• USB
• SDIO
Note:
USB and SDIO interfaces are currently not supported.
SAPI enables easy migration onto any platform with its uniform APIs. This library simplifies application development
on host. Users can develop application firmware without having to learn the underlying peripheral register interface
and other details.
Note:
RS9116W release consists of 2 main components
• Firmware
• SAPI Library
Both components will have same revision number.
Latest releases might have bug-fixes, enhancements, and new features in SAPIs and Firmware together. Most
of the new features will have associated APIs, which are available in the latest SAPIs only. Hence, it is
recommended to upgrade SAPI and Firmware together.
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 13 | Page
Figure 1: RS9116W Block Diagram with SAPIs
SAPI Features
• Platform-independent, interrupt-driven drivers written in C.
• Drivers provide a simpler, functional interface and eliminate the need to manage the low-level host interface
protocol.
• Common APIs for four host interfaces (SPI, USB, UART, SDIO, USB-CDC), which enables easy migration to
different host interfaces.
• Supports bare-metal and FreeRTOS out-of-box. Other RTOS can be supported through OS Abstraction changes.
• Supports Keil µvision, WiSeStudio and IAR IDEs – can be ported to other IDEs.
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 14 | Page
2 RS9116W Features
Wi-Fi
• Supports Wi-Fi Station, Access Point features and Concurrent mode (STA + AP) features.
Wi-Fi Station
• Securities: Open mode, WPA2, Mixed mode, EAP, TLS1.2, TLS1.0, TTLS, PEAP, WPS 2.0 push button.
• Supports auto rate, dual band, re-join, 802.11j, 802.11d, Selective Scan, RSSI support.
• Supports BSD socket interface.
• APIS for crypto hardware ECDH, DH, SHA, AES.
Access Point
• Supports WPA2 mode and hidden SSID mode.
Firmware Upgrade Options
• via bootloader, Host/MCU and Wireless (OTA).
Network Stack
• IPV4,ICMP,ARP,UDP,TCP,IGMP,DHCP Client, DHCP Server, HTTP Client, HTTPs Client, HTTP Server, ping
from host, TCP/IP bypass, FTP Client, SSL3.0/TLS1.2(Client and server),SNTP,SNMP,MQTT Client, Websockets
Client.
• Dynamic feature Enable/Disable, through opermode.
BT Features
• Master, Slave, BT Dual mode and Role switch support.
• BDR1, BDR2, BDR3 etc.
• ACL Data, Encryption, Slot offset, Adaptive frequency hopping, AFH channel classification, Enhanced data rate
ACL, simple pairing, Host Controller Interface (HCI).
• Role switch (Master/Slave), sniff mode, RSSI
• SSP support?
• Profiles: GAP, SDP, L2CAP, SPP, RFCOMM, HID (only in AT commands).
BLE Features
• Master, Slave, BT Dual mode support.
• BT smart (Peripheral), BT Smart ready (Master), Multiple slave support.
• Advertising, Connection interval.
• Host controller interface
• 32-bit UUID support in LE, LE secure connections, Data length extensions.
• LE 2Mbps, LE long range, LE channel classification.
• Profiles: GATT, GAP, BPM (Blood pressure monitor), PXP (proximity), HOGP HID over GATT
• BLP Blood pressure profile & service, HTS/HTP health thermometer profile & service, HRP/HRS Heart rate
profile& service, CGMP/CGMS continuous glucose monitoring profile & service
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 15 | Page
Operating Modes
• WLAN STATION
• WLAN AP
• WLAN+ BLE
• WLAN + BT
• WLAN + BT + BLE
Power Save
• GPIO based power save, Message based power save
• Host based wakeup, WoWLAN, packet pending interrupt for UART.
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 16 | Page
3 Wireless SAPI Related Resources
The following table provides links for obtaining RS9116W SAPI Porting Guide and SAPI Application Examples
documents.
Name
Silicon Lab's Document Portal links
RS9116W SAPI Porting Guide
https://docs.silabs.com/rs9116
AN1282: RS9116W Guide for SAPI Application Examples
https://docs.silabs.com/rs9116
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 17 | Page
4 SAPI Architecture
Architecture
SAPI APIs are designed in layers, where each Layer is independent and use service of underlying layers.
Figure 2: WiSeConnect API Architecture Diagram
Application Layer
Application layer contains application specific functionality. Application Layer call WiSeConnect Driver APIs to
configure and operate the module.
BSD Socket API
This layer contains BSD Socket API compliant wrapper and supports some of the basic BSD Socket API calls. This
APIs can be called from application to initialize and configure the embedded TCP/IP stack and perform data transfers.
WLAN API
This layer contains set of APIs called from application to initialize and configure Wi-Fi Module. User is recommended
to use the given APIs without any modification in order to facilitate upgrading to future releases.
NETWORK API
This layer contains APIs related to network applications like HTTP/HTTPS, SSL 3.0/TLS 1.2, DHCP, MQTT, DNS,
SNMP and WebSockets.
BT/BLE API
This layer contains set of APIs called from application to initialize and configure BT/BLE. User is recommended to use
the given APIs without any modification in order to facilitate upgrading to future releases.
WiSeConnect Driver
WiSeConnect Driver software framework contains core functions for state machine maintenance, command
preparation and command response parsing.
Interface Layer
The module supports 4 different host interfaces (SPI, USB, UART, SDIO, USB-CDC). These APIs are collection of
functions specific to a particular interface. The interface functions between the Driver API Layer and the Interface
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 18 | Page
Specific API Layer are independent of the Host interface used. This allows the user to migrate to different interfaces
without any change in the application layer.
HAL
Hardware Abstraction Layer APIs are platform specific APIs. The user needs to implement or modify these APIs to
their platforms.
Reference Applications
WiSeConnect packages contain reference applications that operate the module in different modes. The user can use
these applications as a reference or customize these applications as per their requirements.
SAPI Sample Flow
Below flow diagram shows sample API flow for Wi-Fi using SAPI library.
Figure 3: Wi-Fi SAPI Flow
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 19 | Page
5 SAPI Host Interfaces
RS9116 WiSeConnect Module supports SPI, USB, UART and SDIO for interfacing to host. This section describes
each interface in detail including the supported features, protocols and commands.
Note:
USB and SDIO interfaces are currently not supported.
5.1 SPI Interface
This section describes RS9116-WiSeConnect SPI interface, including commands and processes to operate the
module via SPI.
Features
The features are as follows:
• Supports 8-bit and 32-bit data mode.
• Supports flow control.
Hardware Interface
The SPI interface on the RS9116-WiSeConnect works in slave mode. It is a 4-wire interface. In addition to the SPI
interface, the module provides an additional interrupt pin to signal events to the host.
The interrupt is raised by the module in SPI mode for the following condition.
• When the module has data in its output buffer, it indicates host by raising the active high signal on the interrupt
pin.
The interrupt from the module is active high and the host has to configure the interrupt in level trigger mode.
The RS9116W also supports edge-triggered interrupts, provided the host is configured to handle these appropriately
(This is generic and does not entail any specific implementations). The host must check for pending interrupts before
clearing/acknowledging an interrupt to avoid missing interrupts and data.
Note:
By default, the interrupt from the module is active high but, it can be configured as active low as well (this can
be configured from bootloader menu).
SPI Signals
SPI Interface is a full duplex serial Host interface, which supports 8-bit and 32-bit data mode. The SPI interface of the
module consists of the following signals:
• SPI_MOSI (Input) - Serial data input for the module.
• SPI_MISO (Output) - Serial data output for the module.
• SPI_CS (Input) - Active low slave select signal. This should be low when SPI transactions are to be carried out.
• SPI_CLK (Input) - SPI clock. The maximum value allowed is 80 MHz.
• INTR (Output) - Active high (Default), Active low, level interrupt output from the module.
The module acts as an SPI slave only, while the Host is the SPI master. Following parameters should be in the host
SPI interface.
• CPOL (clock polarity) = 0,
• CPHA (clock phase) = 0.
Interrupt
The module's INTERRUPT output signal should be connected to the interrupt input of the Host MCU. The
INTERRUPT signal is an active high and level triggered signal. It is raised by the module in the following cases:
RS9116W SAPI Programming Reference Manual
Version 2.0
silabs.com | Building a more connected world. 20 | Page
1. When the module needs to indicate to the Host that it has received data from the remote terminal and the data
needs to be read by the Host.
2. When the module needs to indicate to the Host that a response to a command sent by the Host is ready to be
read from the module.
3. To indicate to the Host that it should read a CARD READY message from the module. This operation is described
in the subsequent sections.
4. An interrupt will be raised for asynchronous RX packets also.
SPI Interface Initialization
This section explains the initialization of the SPI slave interface in the module. Following is the series of steps for SPI
initialization:
1. A host sends 0x00124A5C to the module.
2. On successful initialization, the module sends 0x58 (SPI success) to the host or else, the module sends 0x54 (SPI
busy) or 0x52 (SPI failure).
Operations through SPI
RS9116-WiSeConnect can be configured and operated from the Host by sending commands through the SPI
interface.
The SPI interface is programmed to perform a certain transfer using commands C1, C2, C3 and C4 and an optional
32-bit address. For all the Commands and Addresses, the Host is configured to transmit data with the 8-bit mode. At
the end of all the Commands and Addresses, the Host is reconfigured to transmit data with 8-bit or 32-bit mode
depending on the commands issued. The Module responds to all the commands with a certain response pattern.
The four commands i.e. C1, C2, C3, and C4 indicate to the SPI interface for all the aspects of the transfer.
The command descriptions are as follows:
Figure 4: SPI Command Description
To all these commands, the SPI interface responds with a set of unique responses.
Module Response
RS9116 WiSeConnect gives responses to the host SPI command requests through the SPI interface. These are as
follows:
• A success/failure response at the end of receiving the command. This response is driven with 8-bit mode during
the Command and Address phase and is then switched to 8-bit or 32-bit mode during the Data phase as per the
command issued.
o Success: 0x58 or 0x00000058
o Failure: 0x52 or 0x00000052
• An 8-bit or 32-bit start token is transmitted once the four commands (C1, C2, C3, C4) indicating a read request
are received and the Module is ready to transmit data. The start token is immediately followed by the read data.
o Start Token: 0x55 or 0x00000055
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50
  • Page 51 51
  • Page 52 52
  • Page 53 53
  • Page 54 54
  • Page 55 55
  • Page 56 56
  • Page 57 57
  • Page 58 58
  • Page 59 59
  • Page 60 60
  • Page 61 61
  • Page 62 62
  • Page 63 63
  • Page 64 64
  • Page 65 65
  • Page 66 66
  • Page 67 67
  • Page 68 68
  • Page 69 69
  • Page 70 70
  • Page 71 71
  • Page 72 72
  • Page 73 73
  • Page 74 74
  • Page 75 75
  • Page 76 76
  • Page 77 77
  • Page 78 78
  • Page 79 79
  • Page 80 80
  • Page 81 81
  • Page 82 82
  • Page 83 83
  • Page 84 84
  • Page 85 85
  • Page 86 86
  • Page 87 87
  • Page 88 88
  • Page 89 89
  • Page 90 90
  • Page 91 91
  • Page 92 92
  • Page 93 93
  • Page 94 94
  • Page 95 95
  • Page 96 96
  • Page 97 97
  • Page 98 98
  • Page 99 99
  • Page 100 100
  • Page 101 101
  • Page 102 102
  • Page 103 103
  • Page 104 104
  • Page 105 105
  • Page 106 106
  • Page 107 107
  • Page 108 108
  • Page 109 109
  • Page 110 110
  • Page 111 111
  • Page 112 112
  • Page 113 113
  • Page 114 114
  • Page 115 115
  • Page 116 116
  • Page 117 117
  • Page 118 118
  • Page 119 119
  • Page 120 120
  • Page 121 121
  • Page 122 122
  • Page 123 123
  • Page 124 124
  • Page 125 125
  • Page 126 126
  • Page 127 127
  • Page 128 128
  • Page 129 129
  • Page 130 130
  • Page 131 131
  • Page 132 132
  • Page 133 133
  • Page 134 134
  • Page 135 135
  • Page 136 136
  • Page 137 137
  • Page 138 138
  • Page 139 139
  • Page 140 140
  • Page 141 141
  • Page 142 142
  • Page 143 143
  • Page 144 144
  • Page 145 145
  • Page 146 146
  • Page 147 147
  • Page 148 148
  • Page 149 149
  • Page 150 150
  • Page 151 151
  • Page 152 152
  • Page 153 153
  • Page 154 154
  • Page 155 155
  • Page 156 156
  • Page 157 157
  • Page 158 158
  • Page 159 159
  • Page 160 160
  • Page 161 161
  • Page 162 162
  • Page 163 163
  • Page 164 164
  • Page 165 165
  • Page 166 166
  • Page 167 167
  • Page 168 168
  • Page 169 169
  • Page 170 170
  • Page 171 171
  • Page 172 172
  • Page 173 173
  • Page 174 174
  • Page 175 175
  • Page 176 176
  • Page 177 177
  • Page 178 178
  • Page 179 179
  • Page 180 180
  • Page 181 181
  • Page 182 182
  • Page 183 183
  • Page 184 184
  • Page 185 185
  • Page 186 186
  • Page 187 187
  • Page 188 188
  • Page 189 189
  • Page 190 190
  • Page 191 191
  • Page 192 192
  • Page 193 193
  • Page 194 194
  • Page 195 195
  • Page 196 196
  • Page 197 197
  • Page 198 198
  • Page 199 199
  • Page 200 200
  • Page 201 201
  • Page 202 202
  • Page 203 203
  • Page 204 204
  • Page 205 205
  • Page 206 206
  • Page 207 207
  • Page 208 208
  • Page 209 209
  • Page 210 210
  • Page 211 211
  • Page 212 212
  • Page 213 213
  • Page 214 214
  • Page 215 215
  • Page 216 216
  • Page 217 217
  • Page 218 218
  • Page 219 219
  • Page 220 220
  • Page 221 221
  • Page 222 222
  • Page 223 223
  • Page 224 224
  • Page 225 225
  • Page 226 226
  • Page 227 227
  • Page 228 228
  • Page 229 229
  • Page 230 230
  • Page 231 231
  • Page 232 232
  • Page 233 233
  • Page 234 234
  • Page 235 235
  • Page 236 236
  • Page 237 237
  • Page 238 238
  • Page 239 239
  • Page 240 240
  • Page 241 241
  • Page 242 242
  • Page 243 243
  • Page 244 244
  • Page 245 245
  • Page 246 246
  • Page 247 247
  • Page 248 248
  • Page 249 249
  • Page 250 250
  • Page 251 251
  • Page 252 252
  • Page 253 253
  • Page 254 254
  • Page 255 255
  • Page 256 256
  • Page 257 257
  • Page 258 258
  • Page 259 259
  • Page 260 260
  • Page 261 261
  • Page 262 262
  • Page 263 263
  • Page 264 264
  • Page 265 265
  • Page 266 266
  • Page 267 267
  • Page 268 268
  • Page 269 269
  • Page 270 270
  • Page 271 271
  • Page 272 272
  • Page 273 273
  • Page 274 274
  • Page 275 275
  • Page 276 276
  • Page 277 277
  • Page 278 278
  • Page 279 279
  • Page 280 280
  • Page 281 281
  • Page 282 282
  • Page 283 283
  • Page 284 284
  • Page 285 285
  • Page 286 286
  • Page 287 287
  • Page 288 288
  • Page 289 289
  • Page 290 290
  • Page 291 291
  • Page 292 292
  • Page 293 293
  • Page 294 294
  • Page 295 295
  • Page 296 296
  • Page 297 297
  • Page 298 298
  • Page 299 299
  • Page 300 300
  • Page 301 301
  • Page 302 302
  • Page 303 303
  • Page 304 304
  • Page 305 305
  • Page 306 306
  • Page 307 307
  • Page 308 308
  • Page 309 309
  • Page 310 310
  • Page 311 311
  • Page 312 312
  • Page 313 313
  • Page 314 314
  • Page 315 315
  • Page 316 316
  • Page 317 317
  • Page 318 318
  • Page 319 319
  • Page 320 320
  • Page 321 321
  • Page 322 322
  • Page 323 323
  • Page 324 324
  • Page 325 325
  • Page 326 326
  • Page 327 327
  • Page 328 328
  • Page 329 329
  • Page 330 330
  • Page 331 331
  • Page 332 332
  • Page 333 333
  • Page 334 334
  • Page 335 335
  • Page 336 336
  • Page 337 337
  • Page 338 338
  • Page 339 339
  • Page 340 340
  • Page 341 341
  • Page 342 342
  • Page 343 343
  • Page 344 344
  • Page 345 345
  • Page 346 346
  • Page 347 347
  • Page 348 348
  • Page 349 349
  • Page 350 350
  • Page 351 351
  • Page 352 352
  • Page 353 353
  • Page 354 354
  • Page 355 355
  • Page 356 356
  • Page 357 357
  • Page 358 358
  • Page 359 359
  • Page 360 360
  • Page 361 361
  • Page 362 362
  • Page 363 363
  • Page 364 364
  • Page 365 365
  • Page 366 366
  • Page 367 367
  • Page 368 368
  • Page 369 369
  • Page 370 370
  • Page 371 371
  • Page 372 372
  • Page 373 373
  • Page 374 374
  • Page 375 375
  • Page 376 376
  • Page 377 377
  • Page 378 378
  • Page 379 379
  • Page 380 380
  • Page 381 381
  • Page 382 382
  • Page 383 383
  • Page 384 384
  • Page 385 385
  • Page 386 386
  • Page 387 387
  • Page 388 388
  • Page 389 389
  • Page 390 390
  • Page 391 391
  • Page 392 392
  • Page 393 393
  • Page 394 394
  • Page 395 395
  • Page 396 396
  • Page 397 397
  • Page 398 398
  • Page 399 399
  • Page 400 400
  • Page 401 401
  • Page 402 402
  • Page 403 403
  • Page 404 404
  • Page 405 405
  • Page 406 406
  • Page 407 407
  • Page 408 408
  • Page 409 409
  • Page 410 410
  • Page 411 411
  • Page 412 412
  • Page 413 413
  • Page 414 414
  • Page 415 415
  • Page 416 416
  • Page 417 417
  • Page 418 418
  • Page 419 419
  • Page 420 420
  • Page 421 421
  • Page 422 422
  • Page 423 423
  • Page 424 424
  • Page 425 425
  • Page 426 426
  • Page 427 427
  • Page 428 428
  • Page 429 429
  • Page 430 430
  • Page 431 431
  • Page 432 432
  • Page 433 433
  • Page 434 434
  • Page 435 435
  • Page 436 436
  • Page 437 437
  • Page 438 438
  • Page 439 439
  • Page 440 440
  • Page 441 441
  • Page 442 442
  • Page 443 443
  • Page 444 444
  • Page 445 445
  • Page 446 446
  • Page 447 447
  • Page 448 448
  • Page 449 449
  • Page 450 450
  • Page 451 451
  • Page 452 452
  • Page 453 453
  • Page 454 454
  • Page 455 455
  • Page 456 456
  • Page 457 457
  • Page 458 458
  • Page 459 459
  • Page 460 460
  • Page 461 461
  • Page 462 462

Silicon Labs RS9116W SAPI Programming Reference guide

Type
Reference guide

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI