10 years, 4 months ago.

Mbed and RTOS Receive Frame

Hello Again!

XBeeApiRxFrame* frameP; pc.printf("Received frames: %d\r\n",rxBuffer.getFrameCount() ); /* Work through all of the frames in the buffer */ while( NULL != ( frameP = ( XBeeApiRxFrame* )rxBuffer.getTailPtr())) { /* Dump out some information from the frame */ dumpFrame( frameP ); interpret_frame( frameP ); /* Remove the frame from the buffer */ rxBuffer.pop(); }

If i try to use one of your example for receiving like the one using the CircularBuffer or the callback one, neither works!(using rtos)

Although i called a function on your code called xbeeDevice.dumpRxBuffer(&pc,true); and the buffer is effectively receiving my packets. but for some reason when i call pc.printf("Received frames: %d\r\n",rxBuffer.getFrameCount() ); it returns 0

Question relating to:

API for communicating with XBee devices. wireless, xbee

1 Answer

10 years, 4 months ago.

Hi!

Thanks for letting me know - sorry you're running into some problems.

I was going to try and write some RTOS-based tests in the near future in order to check that side of the behaviour and get in the short-term, I see the same thing here so I'll take a look and get back to you.

Thanks,

John

Accepted Answer

I've found what I think was the problem in the example - a missing call to atIf.setSourceAddress() meaning that the XBee's address wasn't set up correctly. I've added this to the two receive examples and they both seem to work fine now (I'd not spotted this as I'd been using an XBee that already had an address set up, so this was carried over when running the test code).

I've also added a new test program that performs receive with RTOS enabled.

Import programXBeeApiReceiveCallbackExampleRTOS

Example of using the XBeeApi library to receive a message via a callback method. This example shows how to use the library when using mbed-rtos. See the comment at the top of main.cpp

As before, you have to set change the setting in XBeeApiCfg.hpp to let it know that you're using the rtos.

Let me know how you get on.

Thanks,

John

posted by John Bailey 08 Jul 2014

Once again thank you for your help. You inspire me on helping others if i ever can.

posted by Grupo 1 Ser 09 Jul 2014

You're welcome - good luck in your development & I hope the library's useful to you. If you have any other questions or issues, do drop me a line.

Thanks,

John

posted by John Bailey 09 Jul 2014