You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I try used STack frame and send ack to make sure that reciver got the packet. When I set all in spirit1 what is necessary I got this situation:
TX -> sends packet -> IRQ packet lost. This means that ACK packet from receiver don't recive packet.
RX -> gets packet and sends ACK -> IRQ packet read and IRQ packet sends.
my setting:
RX:
#include "mbed.h"
#include "mbed-trace/mbed_trace.h"
#include "SimpleSpirit1.h"
using namespace std;
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_DEBUG
#define TRACE_GROUP "main"
#define SPIRIT_BUF_LEN (95)
DigitalOut led(LED1);
static SimpleSpirit1 &radio = SimpleSpirit1::CreateInstance(PIN_SPSGRF_MOSI,
PIN_SPSGRF_MISO,
PIN_SPSGRF_SCLK,
PIN_SPSGRF_IRQ,
PIN_SPSGRF_CS,
PIN_SPSGRF_SDN,
PIN_SPSGRF_LED);
static char read_buf[SPIRIT_BUF_LEN];
static volatile bool rx_done_flag = false;
static void callback_func(int event)
{
if(event == SimpleSpirit1::RX_DONE)
{
rx_done_flag = 1;
}
}
int main()
{
mbed_trace_init();
tr_info("---START---");
radio.attach_irq_callback(callback_func);
PktStackInit stackInit={
PKT_PREAMBLE_LENGTH_08BYTES, // preamble length in bytes
PKT_SYNC_LENGTH_4BYTES, // sync word length in bytes
0x1A2635A8, // sync word
PKT_LENGTH_VAR, // variable or fixed payload length
7, // length field width in bits (used only for variable length)
PKT_CRC_MODE_16BITS_2, // CRC mode
PKT_CONTROL_LENGTH_0BYTES, // control field length
S_DISABLE, // FEC
S_ENABLE // whitening
};
SpiritPktStackInit(&stackInit);
SpiritPktStackAutoAck(S_ENABLE, S_DISABLE);
radio.on();
SpiritTimerSetRxTimeoutCounter(0);
SpiritTimerSetRxTimeoutPrescaler(0);
SpiritTimerLdcrMode(S_DISABLE);
while (true) {
if(rx_done_flag)
{
memset(read_buf, 0, SPIRIT_BUF_LEN - 1);
read_buf[SPIRIT_BUF_LEN-1] = '\0';
rx_done_flag = false;
int ret = radio.read(read_buf, 58);//sizeof(read_buf));
printf("Received a packet Received string = '%s' (len=%d)\r\n", read_buf, ret);
SpiritIrqs pxIrqStatus;
SpiritIrqGetStatus(&pxIrqStatus);
}
}
}
In TX I enable ACK field and in RX I enable autoack, but this don't work correctly. Interrupt sends data never occurd in TX. When I turn off RX and set retransmision feature, again never occurd IRQ max retransmision.
Someone can check my setting and tell my how correct config radio. What I need to set in register in RX and TX.
The text was updated successfully, but these errors were encountered:
pawelm87
changed the title
config STack frame to send ack in frame
config STack frame to used correct ack in frame
Jun 14, 2019
pawelm87
changed the title
config STack frame to used correct ack in frame
config STack frame to used ack
Jun 14, 2019
pawelm87
changed the title
config STack frame to used ack
config STack frame to used ack correctly
Jun 14, 2019
Hi,
I try used STack frame and send ack to make sure that reciver got the packet. When I set all in spirit1 what is necessary I got this situation:
TX -> sends packet -> IRQ packet lost. This means that ACK packet from receiver don't recive packet.
RX -> gets packet and sends ACK -> IRQ packet read and IRQ packet sends.
my setting:
RX:
TX:
In TX I enable ACK field and in RX I enable autoack, but this don't work correctly. Interrupt sends data never occurd in TX. When I turn off RX and set retransmision feature, again never occurd IRQ max retransmision.
Someone can check my setting and tell my how correct config radio. What I need to set in register in RX and TX.
The text was updated successfully, but these errors were encountered: