Problems with Wireless UART based on Beestack [KW24D512]

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with Wireless UART based on Beestack [KW24D512]

825 Views
zhaotian
Contributor I

Hi,

   I need to transmit letters between  end device and coordinator,so I generated and modified the Wireless UART Code from Beekit based on Beestack.

In the application,I use the char mode and ReliableMode .Then I change the unicast to the broast in the code,But,if the coordinator send a string such as"abcdefghijk" ,the other end devices will receive the result :"abcdeefghijjk".

I think it may be something about the ACK ,but I do how it works.maybe someone can give me suggestion ?


Thanks.


Labels (3)
0 Kudos
6 Replies

199 Views
AngelC
Senior Contributor I

Dear Zhao,

Is it necessary for your application to send it character by character? You could, for instance, build a packet with all the information you need (i.e. “abcdefghijk”) and then send it in a single packet instead of sending it in every letter.

The broadcast messages do not require any ACK at all, so I do not think this is related to the issue you are seeing. How often are you sending letters in your application? Is it after certain amount of time, an event or asynchronous typing form user?

Also, how many devices are there in the network? What type of devices are they (how many routers and end devices) ?. If you have a sniffer, please send me a log to check over the air messages. Probable the message is not being sent twice, but the receiver is sending it twice to the uart console.

Regards,

AngelC

0 Kudos

199 Views
zhaotian
Contributor I

AngelC,

       Yes,I would like to use the block mode instead.My solution is based on the WirelessUART template exported from Freescale BeeKit  Codebase,and I changed uicast to broadcast .So should I commend out the codes about ACK at the same time?

      The messages is temperature data got by DS18B20.I want to monitor several points with 8 devices in all.But I did not get any helpful template about this,can you give me some advice?Which pin can be used to connect to 18B20 on the TWR-KW24D512 board or some documents ?

Thanks,

Shelley

0 Kudos

199 Views
AngelC
Senior Contributor I

Dear Shelley,

What codebase are you using? Is it BeeStack or SMAC? If you are using the BeeStack Wireless UART application, you do not need to modify the ACK part of the code since the ACK is not used in broadcasts.

Furthermore, the DS18B20 seems to have a 1-wire interface for measurement reading. Unfortunately, there is not any 1-wire driver for KW2x devices. You might need to develop your own code and use the general purpose pins for it. I ignore the details about such protocol. I would recommend you to look for similar implementations in the web.

Regards,

AngelC

199 Views
zhaotian
Contributor I

Dear AngelC,

I am using the BeeStack codebase for the application. I am using the GPIO PTD1 for DS18B20 DQ pin,and I want to know whether it is avaliable or ocupied on the TWR-KW24D512v board.But the results I got were always  +  0.0 .I think it maybe something about the CLK in the CPIO confignation. I write it like this:

#define CL_DQ (gSENSORPortDataClearReg_c |= gSENSORPin_c)    //  PTD1=0

#define SET_DQ (gSENSORPortDataSetReg_c |= gSENSORPin_c)     //  PTD1=1

#define SET_OUT GPIOD_PDDR|=0x00000002                                     //PTD1 for output

#define SET_IN  GPIOD_PDDR&=~0x00000002                                     //PTD1 for intput

#define IN_DQ   ((mSENSOR_PORT_c & mSENSOR_MASK_c)>>gSENSOR_PIN_c)  //get data for PTD1 pin!!!


In addition,how long will the following function delay for in the stack?

void Delay_nus(uint16_t s)

{

  while (s--)

  {

    asm("NOP");

    asm("NOP");

    asm("NOP");

  }

}

Thanks a lot,

Shelley

0 Kudos

199 Views
AngelC
Senior Contributor I

Dear Shelley,

The PTD1 is pin 8 of MKW24D512 device. It is available in pin 9 of J9- 2x10 connector of TWR-KW24D512 board (See image below).

PTD1.JPG.jpg

If you are using BeeStack codebase, I would strongly recommend you to use the available GPIO configuration functions such as GPIO_EnablePortClockGating(), GPIO_SetPinPortAttr(), GPIO_SetPinDir(), etc. You may refer to LED.c file as an example of how to configure the GPIOs.

As a side note, your CL_DQ definition might not be clearing the bit as expected.  You should use gSENSORPortDataClearReg_c &=~ gSENSORPin_c instead.

Moreover, the delay would depend in compiler’s optimizations. If you would like to know an approximate  time you could test it yourself by setting a GPIO and measuring it with an oscilloscope probe.

Regards,

AngelC

199 Views
zhaotian
Contributor I


Dear AngelC,


Thank you for your answers,and I have realized the fuction I noted earlier。


Regards,

Shelley

0 Kudos