Browse Source

cleaning up before release branch

curiousmuch 2 years ago
parent
commit
32ad9bd904

+ 64 - 1
components/radio/include/cc1200_protocol.h

@@ -18,7 +18,8 @@
 // 0x11		Carrier Sense
 //********************************//
 
-
+// Arrow - AX25 BELL202 AFSK Settings
+// -----------------------------------
 // Address Config = No address check
 // Bit Rate = 1.2
 // Carrier Frequency = 144.389954
@@ -87,4 +88,66 @@ static const cc1200_reg_settings_t AX25_SETTINGS[]=
   {CC120X_SERIAL_STATUS,     0x08},
 };
 
+// Arrow - FSK Narrowband Settings
+// Address Config = No address check
+// Bit Rate = 1.2
+// Carrier Frequency = 144.389954
+// Deviation = 3.986359
+// Device Address = 0
+// Manchester Enable = false
+// Modulation Format = 2-FSK
+// Packet Bit Length = 0
+// Packet Length = 255
+// Packet Length Mode = Variable
+// RX Filter BW = 10.964912
+// Symbol rate = 1.2
+// Whitening = true
+
+static const cc1200_reg_settings_t NARROWBAND_SETTINGS[]=
+{
+  {CC120X_IOCFG2,            0x06},
+  {CC120X_DEVIATION_M,       0xD1},
+  {CC120X_MODCFG_DEV_E,      0x00},
+  {CC120X_DCFILT_CFG,        0x5D},
+  {CC120X_PREAMBLE_CFG0,     0x8A},
+  {CC120X_IQIC,              0xCB},
+  {CC120X_CHAN_BW,           0xA6},
+  {CC120X_MDMCFG1,           0x40},
+  {CC120X_MDMCFG0,           0x05},
+  {CC120X_SYMBOL_RATE2,      0x3F},
+  {CC120X_SYMBOL_RATE1,      0x75},
+  {CC120X_SYMBOL_RATE0,      0x10},
+  {CC120X_AGC_REF,           0x20},
+  {CC120X_AGC_CS_THR,        0xEC},
+  {CC120X_AGC_CFG1,          0x51},
+  {CC120X_AGC_CFG0,          0x87},
+  {CC120X_FIFO_CFG,          0x00},
+  {CC120X_FS_CFG,            0x1B},
+  {CC120X_PKT_CFG2,          0x00},
+  {CC120X_PKT_CFG1,          0x43},
+  {CC120X_PKT_CFG0,          0x20},
+  {CC120X_PKT_LEN,           0xFF},
+  {CC120X_IF_MIX_CFG,        0x1C},
+  {CC120X_FREQOFF_CFG,       0x22},
+  {CC120X_MDMCFG2,           0x0C},
+  {CC120X_FREQ2,             0x56},
+  {CC120X_FREQ1,             0xA2},
+  {CC120X_FREQ0,             0x4C},
+  {CC120X_IF_ADC1,           0xEE},
+  {CC120X_IF_ADC0,           0x10},
+  {CC120X_FS_DIG1,           0x07},
+  {CC120X_FS_DIG0,           0xAF},
+  {CC120X_FS_CAL1,           0x40},
+  {CC120X_FS_CAL0,           0x0E},
+  {CC120X_FS_DIVTWO,         0x03},
+  {CC120X_FS_DSM0,           0x33},
+  {CC120X_FS_DVC0,           0x17},
+  {CC120X_FS_PFD,            0x00},
+  {CC120X_FS_PRE,            0x6E},
+  {CC120X_FS_REG_DIV_CML,    0x1C},
+  {CC120X_FS_SPARE,          0xAC},
+  {CC120X_FS_VCO0,           0xB5},
+  {CC120X_XOSC5,             0x0E},
+  {CC120X_XOSC1,             0x03},
+};
 

+ 1 - 1
components/radio/include/radio.h

@@ -16,7 +16,7 @@
 typedef enum {
 	NOT_CONFIGURED = 0,
 	AX25,
-	ARROW_MESH,
+	ARROW_NARROWBAND,
 	ESP_MESH,
 } radio_config_t;
 

+ 0 - 8
components/radio/radio.c

@@ -483,7 +483,6 @@ void radio_reinit(radio_config_t type, void *settings)
 			radio_idle();
 
 			// resume radio tasks
-
 			break;
 		default:
 			ESP_LOGE(RADIO_TAG, "invalid configuration");
@@ -540,13 +539,6 @@ void radio_init(radio_config_t type, void *settings)
 			// configure CC1200
 			cc1200_radio_init(AX25_SETTINGS, sizeof(AX25_SETTINGS)/sizeof(cc1200_reg_settings_t));
 
-			/*
-			 * Experimential Band - 145.50 - 145.80
-			 * Note: Signal BW = 15 / 25kHz
-			 */
-
-			cc1200_radio_frequency(145560000);	// 145.560MHz
-
 			// put chip to idle
 			radio_idle();
 

+ 34 - 35
main/main.c

@@ -60,28 +60,29 @@ static SemaphoreHandle_t xRadioTXSemaphore;
 uint8_t ax25_rx_buf[1024];
 RingbufHandle_t ax25_tx_buf;
 
-uint32_t freq_table[16] = { 144390000, 		// APRS - North America
-						    145512500,		// Arrow Test Freqs...
-						    145537500,
-						    145562500,
-						    145587500,
-						    145612500,
-						    145637500,
-						    145662500,
-						    145687500,
-						    145712500,
-						    145737500,
-						    145762500,
-						    145787500,
-						    145812500,
-						    145837500,		// ...145.5 to 145.8 is experimential band
-						    145862500 };	// 25kHz spacing
+uint32_t ax_freq_table[16] = { 	144390000, 		// APRS - North America
+								145512500,		// Arrow - AX25 test frequencies...
+								145537500,
+								145562500,
+								145587500,
+								145612500,
+								145637500,
+								145662500,
+								145687500,
+								145712500,
+								145737500,
+								145762500,
+								145787500,
+								145812500,
+								145837500,		// ...145.5 to 145.8 is experimental band
+								145862500 };	// 25kHz spacing
+
 
 /* Radio Callback Functions */
 
 void radio_rx_ax25_cb(uint8_t *frame, uint32_t len)
 {
-	// TODO: move kiss processing to other core
+	// TODO: move kiss processing to other core??
 	kiss_transmit(KISS_DATAFRAME, frame, len);
 }
 
@@ -93,16 +94,7 @@ void radio_tx_ax25_cb(void)
 
 /* KISS callback Functions */
 
-void kiss_tx_cb(uint8_t *frame, uint32_t len)
-{
-	// TODO: move function to other core
-	// TODO: Add functionality which indicates if BLE connection is present or not
-	// send data to UART via bluetooth
-	bt_spp_tx(frame, len);
-	ESP_LOGI("tnc", "kiss packet sent");
-}
-
-void print_tnc_settings(void)
+void tnc_print_settings(void)
 {
 	ESP_LOGI("tnc", "TX Delay: %d", tnc_settings.tx_delay*10);
 	ESP_LOGI("tnc", "TX Tail: %d", tnc_settings.tx_tail*10);
@@ -111,6 +103,14 @@ void print_tnc_settings(void)
 	ESP_LOGI("tnc", "Frequency: %d", tnc_settings.freq);
 }
 
+void kiss_tx_cb(uint8_t *frame, uint32_t len)
+{
+	// TODO: move function to other core
+	// TODO: Add functionality which indicates if BLE connection is present or not
+	// send data to UART via bluetooth
+	bt_spp_tx(frame, len);
+	ESP_LOGI("tnc", "kiss packet sent");
+}
 
 void kiss_rx_cb(uint8_t *frame, uint32_t len)
 {
@@ -155,7 +155,7 @@ void kiss_rx_cb(uint8_t *frame, uint32_t len)
 			case KISS_CMD_SETHARDWARE:
 			{
 				uint8_t freq_index = frame[1] & 0x0F;
-				tnc_settings.freq = freq_table[freq_index];
+				tnc_settings.freq = ax_freq_table[freq_index];
 				break;
 			}
 			default:
@@ -169,13 +169,14 @@ void kiss_rx_cb(uint8_t *frame, uint32_t len)
 			vTaskDelay(100 / portTICK_PERIOD_MS); // wait 100ms and try again
 		}
 
-		print_tnc_settings();
+		// show user new settings
+		tnc_print_settings();
 
 		// disable TNC task
 		vTaskSuspend(tnc_settings.tnc_task);
 		ESP_LOGW("tnc", "disabled tnc");
 
-		// re-initalize radio
+		// re-initialize radio
 		ax25_param_t ax25_param;
 		ax25_param.tx_tail = tnc_settings.tx_tail;
 		ax25_param.tx_delay = tnc_settings.tx_delay;
@@ -281,7 +282,7 @@ void tnc_task(void *para)
 	}
 }
 
-void IRAM_ATTR app_main()
+void app_main()
 {
 	// Inter-Task Communication
 	ax25_tx_buf = xRingbufferCreate(1028, RINGBUF_TYPE_NOSPLIT);
@@ -311,7 +312,6 @@ void IRAM_ATTR app_main()
 
 	// Radio Initialize
 	ax25_param_t ax25_param;
-
 	ax25_param.tx_tail = tnc_settings.tx_tail;
 	ax25_param.tx_delay = tnc_settings.tx_delay;
 	ax25_param.sample_rate = 13200;
@@ -323,10 +323,9 @@ void IRAM_ATTR app_main()
 	ax25_param.rx_buf_len = sizeof(ax25_rx_buf) / sizeof(ax25_rx_buf[0]);
 	ax25_param.cpu_core = 1;
 
-	// TODO: setup switch statement for settings parameters or simplify....
-	print_tnc_settings();
+	// TODO: setup switch statement for settings parameters or for mode....
+	tnc_print_settings();
 	radio_init(AX25, &ax25_param);
-
 	radio_set_frequency(tnc_settings.freq);
 
 	// Kiss Decoder and Encoder