868M / 915M Narrow band S2LP transceiver RF moduleIssuing time:2022-09-21 22:29 868M /915M Narrow band S2LP transceiver RF module
N560AS module based ST S2LP transceiver, designed for 433M, 868M, 915Mhz narrowband. Up to 16dBm output power and down to -126dBm sensitivity.560AS module leads all pins out of S2LP for secondary development. S2LP DescriptionThe S2-LP is a high performance ultra-low power RF transceiver, intended for RF wireless applications in the sub-1 GHz band. It is designed to operate in both the license-free ISM and SRD frequency bands at 433, 512, 868 and 920 MHz, but can also be programmed to operate at other additional frequencies in the 413-479 MHz, 452-527 MHz, 826-958 MHz, 904-1055 MHz bands. The S2-LP supports different modulation schemes: 2(G)FSK, 4(G)FSK, OOK and ASK. The air data rate is programmable from 0.1 to 500 kbps. N560AS shows an RF link budget higher than 140 dB for long communication ranges and meets the regulatory requirements applicable in territories worldwide, including Europe, Japan, China and the USA. S2LP features
ISM Frequency supported by 560AS transceiver module433M band: 433 MHz to 435 MHz (China, EU) 470M band: 470 MHz to 510 MHz (China) 868M band: 868 MHz to 870 MHz (China, EU, USA) 888 MHz to 889 MHz (Australia) 915M band: 902 MHz to 928 MHz (USA) N560AS Parameters
N560AS Pinout Description
N560AS Layout Information N560AS soft codeTX code SDK_BasicGeneric_A.c 24 /* Includes ------------------------------------------------------------------*/ 25 #include "SDK_EVAL_Config.h" 26 #include "S2LP_Config.h" 27 #include "SDK_Configuration_Common.h" 28 #include "st_main.h" 29 30 #define USE_VCOM 31 62 SRadioInitxRadioInit = { 63 BASE_FREQUENCY, 64 MODULATION_SELECT, 65 DATARATE, 66 FREQ_DEVIATION, 67 BANDWIDTH 68 }; 69 70 74 PktBasicInitxBasicInit={ 75 PREAMBLE_LENGTH, 76 SYNC_LENGTH, 77 SYNC_WORD, 78 VARIABLE_LENGTH, 79 EXTENDED_LENGTH_FIELD, 80 CRC_MODE, 81 EN_ADDRESS, 82 EN_FEC, 83 EN_WHITENING 84 }; 85 86 90 SGpioInitxGpioIRQ={ 91 S2LP_GPIO_3, 92 S2LP_GPIO_MODE_DIGITAL_OUTPUT_LP, 93 S2LP_GPIO_DIG_OUT_IRQ 94 }; 95 96 100 volatile FlagStatus xTxDoneFlag = RESET; 101 102 106 S2LPIrqsxIrqStatus; 107 108 112 uint8_t vectcTxBuff[20]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; 113 117 #define IRQ_PREEMPTION_PRIORITY 0x03 118 135 static uint32_t M2S_GPIO_PIN_IRQ; 136 137 #if (defined(BLUENRG2_DEVICE) || defined(BLUENRG1_DEVICE)) 138 void HAL_GPIO_EXTI_Callback(uint32_t GPIO_Pin) 139 #else 140 void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) 141 #endif 142 { 143 if(GPIO_Pin==M2S_GPIO_PIN_IRQ) 144 { 145 /* Get the IRQ status */ 146 S2LPGpioIrqGetStatus(&xIrqStatus); 147 148 /* Check the SPIRIT TX_DATA_SENT IRQ flag */ 149 if(xIrqStatus.IRQ_TX_DATA_SENT) 150 { 151 /* set the tx_done_flag to manage the event in the main() */ 152 xTxDoneFlag = SET; 153 154 /* toggle LED2 */ 155 SdkEvalLedToggle(LED2); 156 } 157 } 158 } 159 160 166 int main (void) 167 { 168 ST_Init(); 169 170 xRadioInit.lFrequencyBase = xRadioInit.lFrequencyBase; 171 172 /* uC IRQ config */ 173 S2LP_Middleware_GpioInit(M2S_GPIO_3,M2S_MODE_EXTI_IN); 174 M2S_GPIO_PIN_IRQ = S2LP_Middleware_GpioGetPin(M2S_GPIO_3); 175 176 /* S2LP IRQ config */ 177 S2LPGpioInit(&xGpioIRQ); 178 179 /* uC IRQ enable */ 180 S2LP_Middleware_GpioInterruptCmd(M2S_GPIO_3,IRQ_PREEMPTION_PRIORITY,0,ENABLE); 181 182 /* S2LP Radio config */ 183 S2LPRadioInit(&xRadioInit); 184 185 /* S2LP Radio set power */ 186 S2LPRadioSetMaxPALevel(S_DISABLE); 187 188 if(!S2LPManagementGetRangeExtender()) 189 { 190 /* If we haven't an external PA, use the library function */ 191 S2LPRadioSetPALeveldBm(7,POWER_DBM); 192 } 193 else 194 { 195 /* in case we are using a board with external PA, the S2LPRadioSetPALeveldBm will be not functioning because 196 the output power is affected by the amplification of this external component. 197 Set the raw register. */ 198 uint8_t paLevelValue = 0x25; /* For example, this value will give about 19dBm on a STEVAL FKI-915V1 */ 199 S2LPSpiWriteRegisters(PA_POWER8_ADDR, 1, &paLevelValue); 200 } 201 S2LPRadioSetPALevelMaxIndex(7); 202 203 /* S2LP Packet config */ 204 S2LPPktBasicInit(&xBasicInit); 205 206 /* S2LP IRQs enable */ 207 S2LPGpioIrqDeInit(NULL); 208 S2LPGpioIrqConfig(TX_DATA_SENT , S_ENABLE); 209 210 /* payload length config */ 211 S2LPPktBasicSetPayloadLength(20); 212 213 /* IRQ registers blanking */ 214 S2LPGpioIrqClearStatus(); 215 216 /* infinite loop */ 217 while (1){ 218 #ifdef USE_VCOM 219 printf("A data to transmit: ["); 220 221 for(uint8_t i=0 ; i<20 ; i++) 222 printf("%d ", vectcTxBuff[i]); 223 printf("]\n\r"); 224 #endif 225 226 /* fit the TX FIFO */ 227 S2LPCmdStrobeFlushTxFifo(); 228 S2LPSpiWriteFifo(20, vectcTxBuff); 229 230 /* send the TX command */ 231 S2LPCmdStrobeTx(); 232 233 /* wait for TX done */ 234 while(!xTxDoneFlag); 235 xTxDoneFlag = RESET; 236 237 /* pause between two transmissions */ 238 SdkDelayMs(500); 239 } 240 } 241 242 #ifdef USE_FULL_ASSERT 243 250 void assert_failed(uint8_t* file, uint32_t line) 251 { 252 /* User can add his own implementation to report the file name and line number */ 253 printf("Wrong parameters value: file %s on line %d\r\n", file, line); 254 255 /* Infinite loop */ 256 while (1) 257 { 258 } 259 } 260 #endif 261 262 280 /******************* (C) COPYRIGHT 2019 STMicroelectronics *****END OF FILE****/ RX code SDK_BasicGeneric_B.c 24 /* Includes ------------------------------------------------------------------*/ 25 #include "SDK_EVAL_Config.h" 26 #include "S2LP_Config.h" 27 #include "SDK_Configuration_Common.h" 28 #include "st_main.h" 29 30 #define USE_VCOM 31 32 63 SRadioInitxRadioInit = { 64 BASE_FREQUENCY, 65 MODULATION_SELECT, 66 DATARATE, 67 FREQ_DEVIATION, 68 BANDWIDTH 69 }; 70 71 75 PktBasicInitxBasicInit={ 76 PREAMBLE_LENGTH, 77 SYNC_LENGTH, 78 SYNC_WORD, 79 VARIABLE_LENGTH, 80 EXTENDED_LENGTH_FIELD, 81 CRC_MODE, 82 EN_ADDRESS, 83 EN_FEC, 84 EN_WHITENING 85 }; 86 87 91 SGpioInitxGpioIRQ={ 92 S2LP_GPIO_3, 93 S2LP_GPIO_MODE_DIGITAL_OUTPUT_LP, 94 S2LP_GPIO_DIG_OUT_IRQ 95 }; 96 97 101 S2LPIrqsxIrqStatus; 102 103 107 uint8_t vectcRxBuff[128], cRxData; 108 112 #define IRQ_PREEMPTION_PRIORITY 0x03 113 130 static uint32_t M2S_GPIO_PIN_IRQ; 131 132 #if (defined(BLUENRG2_DEVICE) || defined(BLUENRG1_DEVICE)) 133 void HAL_GPIO_EXTI_Callback(uint32_t GPIO_Pin) 134 #else 135 void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) 136 #endif 137 { 138 if(GPIO_Pin==M2S_GPIO_PIN_IRQ) 139 { 140 /* Get the IRQ status */ 141 S2LPGpioIrqGetStatus(&xIrqStatus); 142 143 /* Check the S2LP RX_DATA_DISC IRQ flag */ 144 if(xIrqStatus.IRQ_RX_DATA_DISC) 145 { 146 /* toggle LED2 */ 147 SdkEvalLedToggle(LED2); 148 149 #ifdef USE_VCOM 150 printf("DATA DISCARDED\n\r"); 151 #endif 152 153 /* RX command - to ensure the device will be ready for the next reception */ 154 S2LPCmdStrobeRx(); 155 } 156 157 /* Check the S2LP RX_DATA_READY IRQ flag */ 158 if(xIrqStatus.IRQ_RX_DATA_READY) 159 { 160 /* Get the RX FIFO size */ 161 cRxData = S2LPFifoReadNumberBytesRxFifo(); 162 163 /* Read the RX FIFO */ 164 S2LPSpiReadFifo(cRxData, vectcRxBuff); 165 166 /* Flush the RX FIFO */ 167 S2LPCmdStrobeFlushRxFifo(); 168 169 /* A simple way to check if the received data sequence is correct (in this case LED5 will toggle) */ 170 { 171 SBool xCorrect=S_TRUE; 172 173 for(uint8_t i=0 ; i<cRxData ; i++) 174 if(vectcRxBuff[i] != i+1) 175 xCorrect=S_FALSE; 176 177 if(xCorrect) { 178 /* toggle LED2 */ 179 SdkEvalLedToggle(LED2); 180 #ifdef USE_VCOM 181 printf("DATA CORRECT, RSSI: %d dBm\r\n",S2LPRadioGetRssidBm()); 182 #endif 183 } 184 } 185 /* RX command - to ensure the device will be ready for the next reception */ 186 S2LPCmdStrobeRx(); 187 188 #ifdef USE_VCOM 189 /* print the received data */ 190 printf("B data received: ["); 191 for(uint8_t i=0 ; i<cRxData ; i++) 192 printf("%d ", vectcRxBuff[i]); 193 printf("]\r\n"); 194 #endif 195 } 196 } 197 } 198 199 205 int main (void) 206 { 207 ST_Init(); 208 209 /* if the board has eeprom, we can compensate the offset calling S2LPManagementGetOffset 210 (if eeprom is not present this fcn will return 0) */ 211 xRadioInit.lFrequencyBase = xRadioInit.lFrequencyBase; 212 213 /* uC IRQ config */ 214 S2LP_Middleware_GpioInit(M2S_GPIO_3,M2S_MODE_EXTI_IN); 215 M2S_GPIO_PIN_IRQ=S2LP_Middleware_GpioGetPin(M2S_GPIO_3); 216 217 /* S2LP IRQ config */ 218 S2LPGpioInit(&xGpioIRQ); 219 220 /* uC IRQ enable */ 221 S2LP_Middleware_GpioInterruptCmd(M2S_GPIO_3,IRQ_PREEMPTION_PRIORITY,0,ENABLE); 222 223 /* S2LP Radio config */ 224 S2LPRadioInit(&xRadioInit); 225 226 /* S2LP Packet config */ 227 S2LPPktBasicInit(&xBasicInit); 228 229 /* S2LP IRQs enable */ 230 S2LPGpioIrqDeInit(&xIrqStatus); 231 S2LPGpioIrqConfig(RX_DATA_DISC,S_ENABLE); 232 S2LPGpioIrqConfig(RX_DATA_READY,S_ENABLE); 233 234 /* payload length config */ 235 S2LPPktBasicSetPayloadLength(20); 236 237 /* RX timeout config */ 238 S2LPTimerSetRxTimerUs(700000); 239 240 /* IRQ registers blanking */ 241 S2LPGpioIrqClearStatus(); 242 243 /* RX command */ 244 S2LPCmdStrobeRx(); 245 246 /* infinite loop */ 247 while (1){/* - */} 248 249 } 250 251 252 #ifdef USE_FULL_ASSERT 253 260 void assert_failed(uint8_t* file, uint32_t line) 261 { 262 /* User can add his own implementation to report the file name and line number */ 263 printf("Wrong parameters value: file %s on line %d\r\n", file, line); 264 265 /* Infinite loop */ 266 while (1) 267 { 268 } 269 } 270 #endif 271 272 290 /******************* (C) COPYRIGHT 2019 STMicroelectronics *****END OF FILE****/ |