this receive seems to work well.

It has checksum errors at 123 byte payloads, but this was tested with
the old rftest-tx --- so the transmit side could be the problem.
This commit is contained in:
Mariano Alvira 2010-03-06 19:14:55 -05:00
parent f5391e88dc
commit e8550f26ba
3 changed files with 14 additions and 11 deletions

View file

@ -12,7 +12,7 @@ struct packet {
uint8_t length; uint8_t length;
volatile struct packet * left; volatile struct packet * left;
volatile struct packet * right; volatile struct packet * right;
uint8_t data[MAX_PACKET_SIZE]; uint8_t data[MAX_PACKET_SIZE+1]; /* + 1 since maca returns the length as the first byte */
}; };
typedef struct packet packet_t; typedef struct packet packet_t;

View file

@ -14,16 +14,16 @@
#define NUM_PACKETS 8 #define NUM_PACKETS 8
#endif #endif
#ifndef RECV_SOFTIMEOUT
#define RECV_SOFTIMEOUT 4096 /* about 3.5 128 byte packets */
#endif
/* for 250kHz clock */ /* for 250kHz clock */
#define MACA_CLOCK_DIV 95
/* (32 chips/sym) * (sym/4bits) * (8bits/byte) = (64 chips/byte) */ /* (32 chips/sym) * (sym/4bits) * (8bits/byte) = (64 chips/byte) */
/* (8 chips/clk) * (byte/64 chips) = byte/8clks */ /* (8 chips/clk) * (byte/64 chips) = byte/8clks */
#define CLK_PER_BYTE 8 #define CLK_PER_BYTE 8
#define MACA_CLOCK_DIV 95 #ifndef RECV_SOFTIMEOUT
#define RECV_SOFTIMEOUT 4*128*CLK_PER_BYTE /* 4 128 byte packets */
#endif
#define reg(x) (*(volatile uint32_t *)(x)) #define reg(x) (*(volatile uint32_t *)(x))

View file

@ -70,15 +70,18 @@ void session_req(short_addr_t addr) {
} }
void print_packet(packet_t *p) { void print_packet(packet_t *p) {
volatile uint8_t i,j; volatile uint8_t i,j,k;
#define PER_ROW 16
if(p) { if(p) {
printf("len 0x%02x:",p->length); printf("len 0x%02x\n\r",p->length);
for(j=0; j < ((p->length)%16)-1; j++) { for(j=0, k=0; j < ((p->length)%PER_ROW)-1; j++) {
for(i=0; i<p->length; i++) { for(i=0; i < PER_ROW; i++, k++) {
printf("%02x ",p->data[j*16+i]); if(k>=p->length) { break; }
printf("%02x ",p->data[j*PER_ROW+i]);
} }
printf("\n\r"); printf("\n\r");
} }
printf("\n\r");
} }
return; return;
} }