RDF tones and radio calibration work now.
Signed-off-by: Keith Packard <keithp@keithp.com>
ao_radio_duplex(&addr, &in, 1);
ao_radio_deselect();
#if CC1120_DEBUG
- printf("%02x\n", in);
+ printf("%02x\n", in); flush();
#endif
return in;
}
ao_radio_abort = 0;
for (i = 0; i < sizeof (rdf_setup) / sizeof (rdf_setup[0]); i += 2)
ao_radio_reg_write(rdf_setup[i], rdf_setup[i+1]);
- ao_radio_reg_write(CC1120_PKT_LEN, len);
+
+#if 0
int_pin ("Before CFG");
ao_radio_reg_write(CC1120_IOCFG2, CC1120_IOCFG_GPIO_CFG_RX0TX1_CFG);
int_pin ("After CFG");
+#endif
+
+ ao_radio_fifo_write_fixed(ao_radio_rdf_value, len);
+
+ ao_radio_reg_write(CC1120_PKT_LEN, len);
+
+ printf ("packet length: %d\n", ao_radio_reg_read(CC1120_PKT_LEN));
+
ao_radio_strobe(CC1120_STX);
+
+ for (i = 0; i < 20; i++) {
+ printf ("%d ", i); flush();
+ printf ("Status %02x ", ao_radio_status()); flush();
+ printf ("num_tx_bytes %d ", ao_radio_reg_read(CC1120_NUM_TXBYTES)); flush();
+ printf ("marc status %x\n", ao_radio_marc_status()); flush();
+ ao_delay(AO_MS_TO_TICKS(50));
+ }
+
+#if 0
ao_exti_enable(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN);
int_pin ("After strobe");
ao_delay(AO_MS_TO_TICKS(100));
- ao_radio_fifo_write_fixed(ao_radio_rdf_value, len);
int_pin ("After delay");
cli();
for (i = 0; i < 20; i++) {
#endif
}
sei();
+#endif
printf ("num_tx_bytes %d marc status %x\n",
ao_radio_reg_read(CC1120_NUM_TXBYTES),
ao_radio_marc_status());
+#if 0
if (!ao_radio_tx_done())
ao_radio_idle();
+#endif
ao_radio_set_packet();
ao_radio_put();
}
ao_radio_reg_write(CC1120_IOCFG2, CC1120_IOCFG_GPIO_CFG_MARC_MCU_WAKEUP);
/* Enable the EXTI interrupt for the appropriate pin */
- ao_enable_port(AO_CC1120_INT_PORT);
- ao_exti_setup(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, AO_EXTI_MODE_FALLING, ao_radio_isr);
+// ao_enable_port(AO_CC1120_INT_PORT);
+// ao_exti_setup(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, AO_EXTI_MODE_FALLING, ao_radio_isr);
ao_radio_set_packet();
ao_radio_configured = 1;
#define CC1120_PKT_CFG1_APPEND_STATUS 0
#define CC1120_PKT_CFG0 0x28
+#define CC1120_PKT_CFG0_RESERVED7 7
#define CC1120_PKT_CFG0_LENGTH_CONFIG 5
#define CC1120_PKT_CFG0_LENGTH_CONFIG_FIXED 0
#define CC1120_PKT_CFG0_LENGTH_CONFIG_VARIABLE 1
CC1120_PKT_CFG2, 0x04, /* Packet Configuration, Reg 2 */\r
CC1120_PKT_CFG1, 0x45, /* Packet Configuration, Reg 1 */\r
#endif\r
- CC1120_PKT_CFG0, 0x20, /* Packet Configuration, Reg 0 */\r
+ CC1120_PKT_CFG0, 0x00, /* Packet Configuration, Reg 0 */\r
CC1120_RFEND_CFG1, 0x0f, /* RFEND Configuration, Reg 1 */\r
CC1120_RFEND_CFG0, 0x00, /* RFEND Configuration, Reg 0 */\r
CC1120_PA_CFG2, 0x3f, /* Power Amplifier Configuration, Reg 2 */\r
CC1120_RCCAL_OFFSET, 0x00, /* RC Oscillator Calibration Clock Offset */\r
CC1120_FREQOFF1, 0x00, /* Frequency Offset (MSB) */\r
CC1120_FREQOFF0, 0x00, /* Frequency Offset (LSB) */\r
- CC1120_FREQ2, 0x6c, /* Frequency Configuration [23:16] */\r
- CC1120_FREQ1, 0xa3, /* Frequency Configuration [15:8] */\r
- CC1120_FREQ0, 0x33, /* Frequency Configuration [7:0] */\r
CC1120_IF_ADC2, 0x02, /* Analog to Digital Converter Configuration, Reg 2 */\r
CC1120_IF_ADC1, 0xa6, /* Analog to Digital Converter Configuration, Reg 1 */\r
CC1120_IF_ADC0, 0x04, /* Analog to Digital Converter Configuration, Reg 0 */\r
# Common AltOS sources
#
-# ao_cc1120.c \
# ao_packet.c \
# ao_packet_slave.c \
ao_freq.c \
ao_dma_stm.c \
ao_spi_stm.c \
+ ao_cc1120.c \
ao_ms5607.c \
ao_adc_stm.c \
ao_beep_stm.c \
#include <ao_log.h>
#include <ao_exti.h>
-void
-beep(void)
-{
- ao_beep(AO_BEEP_MID);
- printf ("Hit a character to stop..."); flush();
- getchar();
- putchar('\n');
- ao_beep(0);
-}
-
-const struct ao_cmds ao_mm_cmds[] = {
- { beep, "b\0Beep" },
- { 0, NULL },
-};
-
int
main(void)
{
ao_storage_init();
ao_usb_init();
ao_exti_init();
-// ao_radio_init();
+ ao_radio_init();
ao_i2c_init();
ao_hmc5883_init();
ao_mpu6000_init();
ao_report_init();
ao_config_init();
- ao_cmd_register(&ao_mm_cmds[0]);
ao_start_scheduler();
return 0;
}
#define USE_INTERNAL_FLASH 0
#define HAS_USB 1
#define HAS_BEEP 1
+#define HAS_RADIO 1
#define HAS_SPI_1 1
#define SPI_1_PA5_PA6_PA7 1
#define HAS_SPI_2 1
#define SPI_2_PB13_PB14_PB15 1
#define SPI_2_PD1_PD3_PD4 0
+#define SPI_2_GPIO stm_gpiob
+#define SPI_2_SCK 13
+#define SPI_2_MISO 14
+#define SPI_2_MOSI 15
#define HAS_I2C_1 1
#define I2C_1_PB8_PB9 1
#define HAS_I2C_2 1
#define I2C_2_PB10_PB11 1
-#define PACKET_HAS_SLAVE 1
+#define PACKET_HAS_SLAVE 0
#define LOW_LEVEL_DEBUG 1
#define HAS_HIGHG_ACCEL 1
+#define NUM_CMDS 16
+
#endif /* _AO_PINS_H_ */