Contributions from Michael Baar:

# msb430\dev\cc1020.c
Data type problem in the calibration function, therefore looping 10 seconds on boot. Fixed.

# msb430\contiki-msb430-main.c
Directly accessed power management while other modules used the Contiki layer resulting in the node sleeping most of the time. Fixed.
Added uIP support.

# msb430\buildscripts\makefile.win
Changed to erase only main-memory but keep infomemory so the node configuration is not erashed during flashing.
This commit is contained in:
nvt-se 2007-07-31 07:54:44 +00:00
parent 70ddc0f27e
commit 709adf51ad
3 changed files with 53 additions and 26 deletions

View file

@ -1,5 +1,5 @@
%.u: %.ihex %.u: %.ihex
msp430-jtag -eI $^ msp430-jtag --lpt=TIUSB -mI $^
#CW=cw23 #CW=cw23

View file

@ -53,8 +53,22 @@
#include "net/mac/nullmac.h" #include "net/mac/nullmac.h"
#include "net/mac/xmac.h" #include "net/mac/xmac.h"
#include "dev/slip.h"
SENSORS(NULL); SENSORS(NULL);
#if WITH_UIP
static struct uip_fw_netif slipif =
{UIP_FW_NETIF(192,168,1,2, 255,255,255,255, slip_send)};
#else
int
putchar(int c)
{
rs232_send(c);
return c;
}
#endif /* WITH_UIP */
static void static void
set_rime_addr(void) set_rime_addr(void)
{ {
@ -117,30 +131,46 @@ main(void)
uart_lock(UART_MODE_RS232); uart_lock(UART_MODE_RS232);
uart_unlock(UART_MODE_RS232); uart_unlock(UART_MODE_RS232);
//slip_arch_init(BAUD2UBR(115200)); #if WITH_UIP
slip_arch_init(BAUD2UBR(115200));
cc1020_init(cc1020_config_19200); #endif
// network configuration
node_id_restore();
nullmac_init(&cc1020_driver);
rime_init(&nullmac_driver);
set_rime_addr();
/* System services */ /* System services */
process_start(&etimer_process, NULL); process_start(&etimer_process, NULL);
//process_start(&sensors_process, NULL); //process_start(&sensors_process, NULL);
leds_off(LEDS_ALL); //cc1020_init(cc1020_config_19200);
printf("Autostarting processes\n"); // network configuration
node_id_restore();
#if WITH_UIP
uip_init();
uip_sethostaddr(&slipif.ipaddr);
uip_setnetmask(&slipif.netmask);
uip_fw_default(&slipif); /* Point2point, no default router. */
tcpip_set_forwarding(0);
#endif /* WITH_UIP */
nullmac_init(&cc1020_driver);
rime_init(&nullmac_driver);
set_rime_addr();
#if WITH_UIP
process_start(&tcpip_process, NULL);
process_start(&uip_fw_process, NULL); /* Start IP output */
process_start(&slip_process, NULL);
#endif /* WITH_UIP */
leds_off(LEDS_ALL);
lpm_on();
autostart_start((struct process **) autostart_processes); autostart_start((struct process **) autostart_processes);
for (;;) { for (;;) {
while (process_run()); while (process_run() > 0);
if (process_nevents() == 0) if (process_nevents() == 0) {
LPM1; LPM_SLEEP();
}
} }
return 0; return 0;

View file

@ -552,7 +552,6 @@ cc1020_reset(void)
static int static int
cc1020_calibrate(void) cc1020_calibrate(void)
{ {
unsigned char tmp;
unsigned int timeout_cnt; unsigned int timeout_cnt;
// Turn off PA to avoid spurs during calibration in TX mode // Turn off PA to avoid spurs during calibration in TX mode
@ -561,22 +560,20 @@ cc1020_calibrate(void)
// Start calibration // Start calibration
cc1020_write_reg(CC1020_CALIBRATE, 0xB5); cc1020_write_reg(CC1020_CALIBRATE, 0xB5);
clock_delay(1200); clock_delay(1200);
while ((tmp = cc1020_read_reg(CC1020_STATUS) & CAL_COMPLETE) == 0); while ((cc1020_read_reg(CC1020_STATUS) & CAL_COMPLETE) == 0);
clock_delay(800); clock_delay(800);
// Monitor lock // Monitor lock
timeout_cnt = LOCK_TIMEOUT; for (timeout_cnt = LOCK_TIMEOUT; timeout_cnt > 0; timeout_cnt--) {
if (cc1020_read_reg(CC1020_STATUS) & LOCK_CONTINUOUS)
do { break;
tmp = cc1020_read_reg(CC1020_STATUS); }
} while (tmp & LOCK_CONTINUOUS && --timeout_cnt > 0);
// Restore PA_POWER // Restore PA_POWER
cc1020_write_reg(CC1020_PA_POWER, cc1020_pa_power); cc1020_write_reg(CC1020_PA_POWER, cc1020_pa_power);
// Return state of LOCK_CONTINUOUS bit // Return state of LOCK_CONTINUOUS bit
return (cc1020_read_reg(CC1020_STATUS) & LOCK_CONTINUOUS) == return (cc1020_read_reg(CC1020_STATUS) & LOCK_CONTINUOUS) == LOCK_CONTINUOUS;
LOCK_CONTINUOUS;
} }
static int static int