diff options
| author | Keith Packard <keithp@keithp.com> | 2012-06-15 22:40:30 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2012-06-15 22:40:30 -0700 | 
| commit | e09e35471e788b88909ff01037fb8e0e4eabcd7d (patch) | |
| tree | bc0403bfcc0563fc7c884bbab79ca348cb7797fe /src/drivers/ao_cc1120.c | |
| parent | c2949ea15c59215834fedac7646f50c8a09f716f (diff) | |
altos: Start making cc1120 radio work
RDF tones and radio calibration work now.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_cc1120.c')
| -rw-r--r-- | src/drivers/ao_cc1120.c | 31 | 
1 files changed, 26 insertions, 5 deletions
| diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c index 68f7e736..a1d78d9c 100644 --- a/src/drivers/ao_cc1120.c +++ b/src/drivers/ao_cc1120.c @@ -106,7 +106,7 @@ ao_radio_strobe(uint8_t addr)  	ao_radio_duplex(&addr, &in, 1);  	ao_radio_deselect();  #if CC1120_DEBUG -	printf("%02x\n", in); +	printf("%02x\n", in); flush();  #endif  	return in;  } @@ -254,15 +254,33 @@ ao_radio_rdf(uint8_t len)  	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++) { @@ -278,11 +296,14 @@ ao_radio_rdf(uint8_t len)  #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();  } @@ -488,8 +509,8 @@ ao_radio_setup(void)  	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; | 
