Author Topic: LWMESH-OQPSK 1000kbps  (Read 32488 times)

0 Members and 1 Guest are viewing this topic.

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #75 on: June 10, 2017, 02:08:06 am »
Those registers are not applicable to a real hardware, so you can do whatever you want with them. They only work in a simulator.

For real hardware, you have to rewrite this code to use real registers from a real microcontroller.
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #76 on: June 11, 2017, 06:48:35 am »
Hi Alex,

Now I am able to send Sync command for every 60ms from Gateway. But End devices not responding.

This is because AT86RF Interrupt  ISR is not get call. Our board using PB14 for interrupt.  File trxaccess.c which is taken from PEER2PEER project having following definition for AT86 interrupt:

Code: [Select]
typedef void (*irq_handler_t)(void);
static irq_handler_t irq_hdl_trx = NULL;
Code: [Select]
   void trx_spi_init(void)
{
/* Initialize SPI in master mode to access the transceiver */
#if SAMD || SAMR21 || SAML21 || SAMR30
spi_slave_inst_get_config_defaults(&slave_dev_config);
slave_dev_config.ss_pin = AT86RFX_SPI_CS;
spi_attach_slave(&slave, &slave_dev_config);
spi_get_config_defaults(&config);
config.mux_setting = AT86RFX_SPI_SERCOM_MUX_SETTING;
config.mode_specific.master.baudrate = AT86RFX_SPI_BAUDRATE;
config.pinmux_pad0 = AT86RFX_SPI_SERCOM_PINMUX_PAD0;
config.pinmux_pad1 = AT86RFX_SPI_SERCOM_PINMUX_PAD1;
config.pinmux_pad2 = AT86RFX_SPI_SERCOM_PINMUX_PAD2;
config.pinmux_pad3 = AT86RFX_SPI_SERCOM_PINMUX_PAD3;
spi_init(&master, AT86RFX_SPI, &config);
spi_enable(&master);

struct extint_chan_conf eint_chan_conf;
extint_chan_get_config_defaults(&eint_chan_conf);
eint_chan_conf.gpio_pin = AT86RFX_IRQ_PIN;
eint_chan_conf.gpio_pin_mux = AT86RFX_IRQ_PINMUX;
eint_chan_conf.gpio_pin_pull      = EXTINT_PULL_DOWN;  //EXTINT_PULL_DOWN
#if (SAML21 || SAMR30)
eint_chan_conf.enable_async_edge_detection = false;
#else
eint_chan_conf.wake_if_sleeping    = true;
#endif
eint_chan_conf.filter_input_signal = false;
eint_chan_conf.detection_criteria  = EXTINT_DETECT_RISING;
extint_chan_set_config(AT86RFX_IRQ_CHAN, &eint_chan_conf);  //AT86RFX_IRQ_CHAN=14(PB14 connected to IRQ)
extint_register_callback(AT86RFX_ISR, AT86RFX_IRQ_CHAN, EXTINT_CALLBACK_TYPE_DETECT);
        extint_chan_enable_callback(AT86RFX_IRQ_CHAN,EXTINT_CALLBACK_TYPE_DETECT);
}
In the PHY_Init(), I am calling trx_irq_init(FUNC_PTR trx_irq_cb) like below to set callback function as irq_handler_trx()

Code: [Select]
void PHY_Init(void)
{
          uint8_t reg;
trx_spi_init();
trx_irq_init((FUNC_PTR)irq_handler_trx);
PhyReset();
phyRxState = false;
phyBand = 0;
phyModulation = phyReadRegister(TRX_CTRL_2_REG) & 0x3f;
phyState = PHY_STATE_IDLE;

do {  phyWriteRegister(TRX_STATE_REG, TRX_CMD_TRX_OFF);
} while (TRX_STATUS_TRX_OFF !=(phyReadRegister(TRX_STATUS_REG) & TRX_STATUS_MASK));

phyWriteRegister(IRQ_MASK_REG, (1<<TRX_END));  //---------> Enabling inetrrupt for Transmission and Reception

reg = phyReadRegister(RF_CTRL_0_REG) & ~0x03;
phyWriteRegister(RF_CTRL_0_REG, reg | 0X02); /* GC_TX_OFFS =3 for BPSK */

phyWriteRegister(PHY_TX_PWR_REG, 0x00); /* 3dBm */

    phyWriteRegister(TRX_CTRL_1_REG,(1 << TX_AUTO_CRC_ON) | (3 << SPI_CMD_MODE) | (1 << IRQ_MASK_MODE));

    phyWriteRegister(TRX_CTRL_2_REG, (1 << RX_SAFE_MODE));
}
Code: [Select]
void irq_handler_trx(void)
{
if (PHY_STATE_SLEEP == phyState)
{
return;
}

if (phyReadRegister(IRQ_STATUS_REG) & (1 << TRX_END))
{
if (PHY_STATE_IDLE == phyState)
{
PHY_DataInd_t ind;
uint8_t size;
int8_t rssi;
rssi = (int8_t)phyReadRegister(PHY_ED_LEVEL_REG);
trx_frame_read(&size, 1);
trx_frame_read(phyRxBuffer, size + 2);
ind.data = phyRxBuffer + 1;
ind.size = size - PHY_CRC_SIZE;
ind.lqi  = phyRxBuffer[size + 1];
ind.rssi = rssi + phyRssiBaseVal();
PHY_DataInd(&ind);
phyWaitState(TRX_STATUS_RX_AACK_ON);
}
else if (PHY_STATE_TX_WAIT_END == phyState)
{
uint8_t status = (phyReadRegister(TRX_STATE_REG) >>TRAC_STATUS) & 7;
  if (TRAC_STATUS_SUCCESS == status)
{
status = PHY_STATUS_SUCCESS;
}
else if (TRAC_STATUS_CHANNEL_ACCESS_FAILURE == status)
{
status = PHY_STATUS_CHANNEL_ACCESS_FAILURE;
}
else if (TRAC_STATUS_NO_ACK == status)
{
status = PHY_STATUS_NO_ACK;
}
else
{
status = PHY_STATUS_ERROR;
}
phySetRxState();
phyState = PHY_STATE_IDLE;
PHY_DataConf(status);
}
}
}
Please suggest a solution



Thanks,
Muthu
« Last Edit: June 11, 2017, 01:04:29 pm by muthukural001 »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #77 on: June 11, 2017, 09:28:57 pm »
I have no clue about ASF and its interrupt configuration and handling. And I don't want to waste a second of my time trying to figure that out. That you will have to figure out on your own.
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #78 on: June 12, 2017, 03:23:31 pm »
Hi  ataradov,

My Phy_Init() is ok ?. Though I set IRQ_MASK_REG to give interrupt for Transmission completion and Frame reception, I am not getting any interrupt. I have no idea on what is missing in Interrupt setup. Do you see anything wrong code?. Please suggest a solution.




Thanks,
muthu
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #79 on: June 12, 2017, 03:37:40 pm »
My Phy_Init() is ok ?. Though I set IRQ_MASK_REG to give interrupt for Transmission completion and Frame reception, I am not getting any interrupt.
Your code look ok.

Does the interrupt pin actually change its state? You need to separate interrupt controller issue from the radio issue.
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #80 on: June 14, 2017, 03:50:26 pm »
Hi ataradov,

Sorry. Transmission completion interrupt is coming but not frame reception.Shared code automatically add field which are mandatory  for filtering process at Receiver side.

Pls help me ?


Thanks,
Muthu
« Last Edit: June 14, 2017, 04:13:41 pm by muthukural001 »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #81 on: June 14, 2017, 05:01:45 pm »
Pls help me ?
Use basic mode, there is no need to mess with IEEE headers in this case.

If you still want to do that, then read section "8.2 Frame Filter" of the datasheet, read section 7.5.6.2 of the IEEE 802.15.4-2006 standard. Or just look at how LwMesh is doing it.

Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #82 on: June 14, 2017, 05:56:03 pm »
Hi,

Basic mode will support OQPSK-250kbps?



Thanks,
Muthu
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #83 on: June 14, 2017, 05:57:33 pm »
Basic mode has noting to do with modulation. Just spend a couple hours and read the datasheet fully. Your life will be much easier.
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #84 on: June 15, 2017, 07:54:50 am »
Hi ataradov,

I don't see any topic which is related to Basic mode.
Q1:
Can you point me?

Q2:
In the basic mode, no need to add header?

Q2:
 Basic mode will take care acknowledgement  ?


Thanks,
Muthu
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #85 on: June 15, 2017, 03:11:36 pm »
Ok, this is really turning into huge waste of my time. You should consider hiring a professional developer if you want this to go anywhere.

I don't see any topic which is related to Basic mode.
Q1: Can you point me?
Are you serious? READ THE DATASHEET. At least read the table contents. There is a chapter 7.1 called "Basic Operating Mode". How can you miss it?

Q2:In the basic mode, no need to add header?
All answered in the datasheet.

Q2: Basic mode will take care acknowledgement  ?
No, but you don't want low-level ACKs for time-synchronized network anyway. ACKs are taken care of on a network level.

Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #86 on: June 15, 2017, 03:48:14 pm »
Hi,
I am really sorry.Hereafter, I will try to solve the problems as much as I can. So, for my application, I can stick to Basic operating mode right?



Thanks,
Muthu
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #87 on: June 15, 2017, 04:29:39 pm »
Not only you can, you should.
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #88 on: June 16, 2017, 03:56:40 pm »
Hi ataradov,

In the basic mode, I can send SYNC command for the specified interval from Gateway. But, in the end node, control goes to dummy_handler() exception when start slot timer upon receiving SYNC command. I am not facing this issue when I start SYNC timer in Gateway. With commenting Slot timer code, I can get SYNC command  continuously from gateway without problem. Please suggest a solution.



Thanks,
Muthu
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #89 on: June 16, 2017, 04:14:11 pm »
Most likely something in your code causes Hard Fault. You need to debug and find what it is.
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #90 on: June 20, 2017, 11:15:47 am »
Hi ataradov,

I couldn't found what is causing hard fault.Still I am trying. But, End node receives SYNC command for every SYNC interval from Gateway if I keep Transceiver state at RX state and commenting Phy_DataInd(). If I enable, Phy_DataInd(), it goes to DummyHandler(). Do U see any mistake with the following code?
Code: [Select]
void PHY_DataInd(PHY_DataInd_t *ind)
{
NwkHeader_t *header = (NwkHeader_t *)ind->data;
        if (ind->size < sizeof(NwkHeader_t))
{
return; // Malformed frame
}
    if (nwkDeviceId != header->dst && NWK_BROADCAST_ID != header->dst)
{
return; // This frame is not for us
}
if (NWK_COMMAND_SYNC == header->command)
{
nwkStartTimer(nwkDeviceId * NWK_SLOT_TIME, nwkSlotTimerHandler); 
}
if (NWK_COMMAND_DATA == header->command)
{
NWK_DataInd_t nwkInd;

nwkSyncAck |= (1 << header->src);
nwkInd.src  = header->src;
nwkInd.dst  = header->dst;
nwkInd.data = ind->data + sizeof(NwkHeader_t);
nwkInd.size = ind->size - sizeof(NwkHeader_t);
nwkInd.lqi  = ind->lqi;
nwkInd.rssi = ind->rssi;

NWK_DataInd(&nwkInd);
}
}


Thanks,
muthu
« Last Edit: June 20, 2017, 11:21:18 am by muthukural001 »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #91 on: June 20, 2017, 04:47:07 pm »
Well, what exact line here fails? Get a debugger and singe-step trough the code.

My guess is that there is an issue with packing of the NwkHeader_t.
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #92 on: June 21, 2017, 05:22:10 am »
Hi ataradov,

Thanks.Here it get fails

Code: [Select]
if (nwkDeviceId != header->dst && NWK_BROADCAST_ID != header->dst)
{
return; // This frame is not for us
}

Thanks,
Muthu
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #93 on: June 21, 2017, 05:23:56 am »
So is your NwkHeader_t packed?
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #94 on: June 21, 2017, 05:42:07 am »
Hi ataradov,

I have attached debug images.





 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #95 on: June 21, 2017, 05:44:19 am »
Show me how your structure is defined! It must have PACK next to it, and that PACK must actually be defined. Do you have nay of this?
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #96 on: June 21, 2017, 05:47:55 am »
Hi,

Here is My structure.

Code: [Select]
typedef struct
{
uint16_t src; //uint8_t      src;
uint16_t dst; //uint8_t      dst;
uint8_t  command;//uint8_t      command;
} NwkHeader_t;

typedef struct
{
NwkHeader_t header;
uint32_t    ack;
} NwkSyncCmd_t;

typedef struct
{
NwkHeader_t header;
uint8_t     data[NWK_MAX_PAYLOAD_SIZE];
} NwkDataCmd_t;

I don't define anything other than this.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: LWMESH-OQPSK 1000kbps
« Reply #97 on: June 21, 2017, 05:49:39 am »
Well, the parts you have removed from my code are critical. Put them back, and try to understand why they are needed there.
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #98 on: June 21, 2017, 06:14:36 am »
Hi Alex,

Thank you very much. Now it is fine. Missed PACK definition at all.



Thanks,
Muthu
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: LWMESH-OQPSK 1000kbps
« Reply #99 on: June 21, 2017, 11:46:40 am »
Hi Ataradov,

I have tested with two boards in the basic mode.Node-1 will send at 20 ms and Node-2 at 40ms from the time of  Sync command received. It seems to be working. Can you have look at the attached Wireshark log ?. 

WireShark:
In this, Row with 9 bytes is Beacon Or Sync command and  followed by two rows with 41 bytes are data from Node 1 and Node 2. First two bytes of all is Source address followed Destination address respectively.

Questions:
1. Is there any Wireshark protocol for Basic mode?. Because wireshark fields like Info,Protocol,Source and Destination gives different name while capture.


Give your  comments.


Thanks,
Muthu

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf