Artaflex AWP24S-to-AWP2U dongle communication

Discussion of the PSoC CY8C24x94 and other PSoC like USB parts from Cypress should be discussed here. This forum is limited to the discussion of USB portion of those parts. Other forums should still be used to discuss the non USB features of these parts.

Moderator: ericb

Artaflex AWP24S-to-AWP2U dongle communication

Postby dougm007 » Thu Sep 10, 2009 8:18 am

Hi, my first forum post and new to PSoC programming.

I need to demonstrate that I can communicate between this SPI module and the USB dongle. I have working examples from dongle-to-dongle and SPI board-to-SPI board (using a CY3209 Express Evaluation Kit), but hope someone will share example code for the AWP24S and AWP24U talking together. This is a bit overwhelming. Sorry to be vague, but I'm guessing I am not properly setting Device Type ID and/or PN Codes don't match on each end of the link.

Regards,
Doug
dougm007
Cheese Cube
Cheese Cube
 
Posts: 31
Joined: Thu Sep 10, 2009 7:28 am

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby -t » Thu Sep 10, 2009 9:28 am

looks like the AWP24S is an RF module, requires a PSoC to drive SPI comms, etc -> http://search.digikey.com/scripts/DkSea ... 8&k=AWP24S

so, for the PSoC code:
you could just download "WirelessUSB LP Radio Driver v1.4" from http://www.cypress.com

looks like the AWP24U is a USB-based RF dongle, which already include a PSoC on the PCB -> http://search.digikey.com/scripts/DkSea ... ds=AWP24U+

have no idea what firmware is pre-loaded in AWP24U, but you might be able to reprogram it (connect MiniProg to ISSP pins, maybe????).

i don't have specific PSoC Designer "projects" for these PCB's, nor do I have the PCB's themselves,
but if you can somehow reprogram the dongle and connect the module to a PSoC then I can guide you in writing simple transmit/receive firmware using "WirelessUSB LP Radio Driver v1.4" API calls.
-t
Cheese Wheel
Cheese Wheel
 
Posts: 114
Joined: Wed Aug 04, 2004 8:38 pm

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby dougm007 » Wed Sep 30, 2009 6:21 am

Mr. "t",

Sorry it has taken awhile to get back. Your recommendation to use the Cypress "WirelessUSB LP Radio Driver v1.4" seems to be right on. Artaflex was kind enough to give me some older sample code to reprogram the AWP24U USB dongle, as you had suggested might be possible. A simple adapter design was provided by Artaflex that allows the dongle to be plugged into a PSoC Mini Prog for programming. This re-programming, along with changing the "Channel" number in their AWP24S program to match the dongle program did the trick. I'd like to include the test programs and dongle programming adapter drawing, but don't know if Artaflex would object to this. Let me know if anyone needs this information and I'll look into it.

My next move will be to implement my own programs from scratch using the WirelessUSB LP library you mentioned.

Thanks for your help,
Doug
dougm007
Cheese Cube
Cheese Cube
 
Posts: 31
Joined: Thu Sep 10, 2009 7:28 am

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby -t » Wed Sep 30, 2009 9:44 am

that's great news!!!

to "configure" the radio driver you'll need to properly set equates (EQU) values in file lpRadio.inc... note you probably will "0" three-wire SPI and mux'd IRQ equates and set LP_SPI to 1 for PSoC... if I remember correctly that should be all that you need to double-check in that file.

here are a few code snippets the help get you started developing your own PSoC projects ->

Code: Select all
#include "lpradio.h"

// Radio
// 125kbps, 8DR-64, SOP64, PA=7, SOP EN, SOP64,
// LEN EN, SOPTH=14, TH64=14, ACK EN, ACK TO=8x
BYTE AppBuf[] = {
                 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
                 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
                 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
                 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
                 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
                 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
                 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
                 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F                                                   
                };

RADIO_STATE  RxState;
RADIO_STATE  TxState;
RADIO_STATE  xState;
RADIO_LENGTH RxLen;
XACT_CONFIG  XactState;

...

  // Initialize SPIM block and validate POR of the radio
  SPIM_Radio_Start(SPIM_Radio_SPIM_MODE_0 | SPIM_Radio_SPIM_MSB_FIRST); 
  LP_nSS_Data_ADDR |= LP_nSS_MASK;                        // Deassert the LP_nSS pin 
  while( !(RadioGetChannel() == 0) ) RadioSetChannel(0);  // Wait 'til RST pin voltage < VIL
 
  // Initialize radio for:
  // CH=0, PN=4, ACK EN, ACK TO=8x, 125kbps, 8DR-64, SOP64,
  // PA=7, SOP EN, SOP64, LEN EN, SOPTH=14, TH64=14, TH32=5 
  RadioInit(0x81,0x2F);             // XACT_CFG_ADR, TX_CFG_ADR
  RadioSetPtr((BYTE *)&AppBuf);     //
  RadioSetLength(sizeof(AppBuf));   //
  RadioSetFrameConfig(0xEE);        // FRAME + SOPTH
  RadioSetThreshold64(0x0E);        //
  RadioSetThreshold32(5);           //
  RadioSetChannel(0);               //
  RadioSetSopPnCode(4);             // Change the PN Code for Start of Packet (SOP)
  RadioWrite(0x0C,0x80);            // XOUT=BitSerial
  RadioForceState(0);               // Set END_STATE_SLEEP & Force transition now
  RadioWrite(0x0B,0x20);            // Disable PMU 

...

  // Check if the radio's IRQ pin is active high
  //   If so, provide visual indication to the user
  if( LP_IRQ_Data_ADDR & LP_IRQ_MASK ) RED_LED_ON;
  else RED_LED_OFF;
 
  // Check if SW1 pressed?
  //   If so, the user wants to initiate the basic
  //     wireless button & lights application
  if( ButtonPressed() ) bPressed = TRUE;
  else bPressed = FALSE;

  // Try to transmit 1-byte packet w/ 3 retries.
  //   Note: "bPersonality" is established during initial Power Up
  if( (bPersonality == TX) && bPressed ) {
    AppBuf[0] = 0x5A;                        // Load TX packet data here!!!
    RadioStartTransmit(3,1);
    while(1) {
      TxState = RadioGetTransmitState();
      if( TxState & RADIO_COMPLETE ) { 
        if( !(TxState & RADIO_ERROR) ) {GREEN_LED_BLINK;}
        else {RED_LED_BLINK;}                // Handle ERROR here within "else"
        break;
      }
    }
    RadioEndTransmit();
    bPressed = FALSE;                        // Clear flag to (Re)arm bPressed
  }
 
  // Try to receive a packet.
  //   Note: "bPersonality" is established during initial Power Up
  if( (bPersonality == RX) && bPressed ) {
    RED_LED_ON;
    RadioStartReceive();
    while(1) {
      RxState = RadioGetReceiveState();
      if( RxState & RADIO_COMPLETE ) {
        if( !(RxState & RADIO_ERROR) ) bSuccessful = TRUE;
        RxLen = RadioEndReceive();   
        if( bSuccessful ) {GREEN_LED_BLINK;} // Handle RX data within "if"
        break;       
      }
     
      // Check if SW1 button pressed while a receive operation is pending?
      //   If so, cancel the current receive operation
      if( ButtonPressed() ) {
        RxLen = RadioAbort();                // Try to prematurely abort receive operation
        if( RxLen != RADIO_ABORT_SUCCESS ) bSuccessful = TRUE;
        if( bSuccessful ) {GREEN_LED_BLINK;} // Handle RX data within "if"
        break;
      }
    }
    bSuccessful = FALSE;                     // Clear flag to (Re)arm bSuccessful
    bPressed = FALSE;                        // Clear flag to (Re)arm bPressed
    RED_LED_OFF;
  }
-t
Cheese Wheel
Cheese Wheel
 
Posts: 114
Joined: Wed Aug 04, 2004 8:38 pm

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby dougm007 » Wed Sep 30, 2009 12:00 pm

Mr. "-t",

What a guy! Thanks for the code snippets and advice. This looks like it will get me off to a good start. I might not get to it in awhile, but I'll report back after I get something working.

Thanks,
Doug
dougm007
Cheese Cube
Cheese Cube
 
Posts: 31
Joined: Thu Sep 10, 2009 7:28 am

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby -t » Wed Sep 30, 2009 12:54 pm

understand, no hurry... please do report back

below are a couple of prior lessons learnt to pass-on to others:

- the SPI master hardware block must be named "SPIM_Radio"

- keep the LP_xxx naming convension for the radio signals

- if there is a GPIO going to RST signal of the radio on your board then Hi-Z that signal in your project as a first step. firmware settting the RST bit in the modeoverride register accomplishes the exact same thing as a "sometimes later" hard reset. and this is already done for you in the RadioInit API call.

- IRQ must be configured as an input, the radio driver heavily leverages this signal

- there are two versions of low-level data handling routines, one for when the entire packet payload fits within the 16-byte radio buffer called non-streaming. this is the one I recommend that you start with, keep your payload bytes 16 or less and you should be good to go. You will need to exclude the streaming library from your PSoC project.

- there are at minimum three steps (API calls) for each successful data transfer... _start(), _getstate() polling, and _end()... and the order in which these API's are called is important.

- you must call _abort() to prematurely abort a receive process (if the radio is waiting in receive mode and you need to do something else with the system)

- there is a mechanism included in the radio driver to service the data phase of a transfer via interrupts... the driver is expecting a rising edge event via IRQ pin... and you must place an ljmp RadioInterrupt; in the PSoC GPIO ISR... it's best not to start your learning efforts trying to only use this mechanism... things can get more difficult if you require other PSoC GPIO ISR code that needs servicing, too... the good news is that you can utilize the more typical polling mechanism illustrated in my code snippets

- limit SPI SCK to ~2MHz as a starting point
-t
Cheese Wheel
Cheese Wheel
 
Posts: 114
Joined: Wed Aug 04, 2004 8:38 pm

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby dougm007 » Thu Oct 22, 2009 2:11 pm

Mr. "-t", et.al.,

Thanks for your help. I have Artaflex AWP24S modules talking to an AWP24U dongle, pretty much using the code snippets and suggestions from "-t".

General question: For a given "raw data rate", what maximum "actual data rate" can I expect? I am sending an alphabet character from the U device to one of the S devices, to request data. The S device then transmits 2 packets of 16 bytes each. Using 8DR (eight data rate), 32-chip DSSS, on both devices, I receive the data at a rate of about 43kbps, where the "raw data rate" should be 250kbps.

Does this sound about right, or should I be able to do better than this? The data is reliable. I am not using PN codes or CRC checks, no retries or anything fancy.

I am using a C# program (RF_Chat, modified) that Artaflex provided, which uses the CyUSB.sys driver and calls functions from CyUSB.DLL. This (the C#/CyUSB front end) seems to introduce significant latency, as changing data rates from 62.5kbps (DDR-32chips) to 250kbps (8DR-32 chips) only improved the actual data rate by about 25% (NOT 4X faster). Also, switching channels between each 2-16 byte packets, which should have only added a hundred microseconds or so to this cycle time dropped the actual data rate to about 6kbps! (using the DDR-32 parameters).

Any comments would be appreciated.

Thanks,

Doug
dougm007
Cheese Cube
Cheese Cube
 
Posts: 31
Joined: Thu Sep 10, 2009 7:28 am

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby -t » Fri Oct 23, 2009 10:11 pm

you're very welcome :)

your reported #'s sound reasonable to me, especially when using a non-optimized "control application" running on a PC, congrats!!!

for 16B (non-streaming driver) 8DR32/SOP32/AutoACK-based packets one might expect to achieve something like 125kbps tx<>rx link, no PC "control application", ~50%, using a fast channel.

for 40B (streaming driver) 8DR32/SOP32/AutoACK-based packets one might expect to achieve something like 175kbps tx<>rx link, no PC "control application", ~70%, using a fast channel.

for 40B (streaming driver) GFSK/SOP32/AutoACK-based packets one might expect to achieve something like 370kbps tx<>rx link, no PC "control application", ~37%.

note: above are calculations only and assume 0 usec inter-packet gap/delay and ENDSTATE set to IDLE, i personally have never attempted to optimize throughput

in my example snippet the default ENDSTATE of the radio is SLEEP... which is meant to save power, but certainly isn't a setting optimized for throughput, as the crystal takes ~750usec to settle, typ.

for a 16B 8DR64/SOP64/AutoACK-based packet that's ~37% contribution, let's label it "setup", to the overall packet transmission time, with your payload data representing ~37%, using a slow channel (synth settle added here to the "setup" contribution). just setting ENDSTATE to IDLE (0 usec for crystal settle time) changes those #'s to ~14%, ~50% respectively.

generally, the radio settings I've used in my example snippet are intended to maximize range for short infrequent small payload data transfers while attempting to extend battery life.
-t
Cheese Wheel
Cheese Wheel
 
Posts: 114
Joined: Wed Aug 04, 2004 8:38 pm

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby dougm007 » Tue Oct 27, 2009 7:02 am

"t-",

You have been very helpful. I am transmitting data from an Artaflex AWP24S module using 16B (non-streaming driver) 8DR32/SOP32/AutoACK-based packets at a rate of about 105kbps, very close to the 125kbps you expected. (I basically just timed how long it took to blast tons of data as fast as I could, from code that I know works at a slow rate, but had no expedient way to verify the data integrity). This is more than adequate for my application. However, it is even clearer now that the C# interface program to the AWP24U dongle that Artaflex gave me (called RF_Chat, which uses CyUSB.dll calls to the CY7C64215 enCoRe USB Controller on the dongle) is the bottle neck, limiting me to about 21kbps actual data rate (sending an alpha character to request data, then receiving 2-16 byte packets for each request, etc). If I could double this rate, I'd be in business! I'll continue to try to get Artaflex to help me. Otherwise, it looks like I need to design my own "dongle" or try to re-write code for their dongle or come up with some other way to talk to their dongle through their driver...

Regards,
Doug
dougm007
Cheese Cube
Cheese Cube
 
Posts: 31
Joined: Thu Sep 10, 2009 7:28 am

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby -t » Wed Oct 28, 2009 12:58 pm

i suspect the dll/sys driver is fine for your needs, but you'll need to rewrite/rearchitect the Artaflex firmware and software. my guess is that they just wanted something simple for demonstration purposes, "throughput" might not have even reached the whiteboard :) 20kbps isn't bad ...certainly makes me believe there's more "control" than "chat" architected into their implementation. i'm sure there's a way to acheive both, given the right motivational factors :)

let me know if you're interested in changing the architecture to better suite your needs. i have been fiddling with '6935 as of late, so i haven't written code for the '6936 for quite some time now :)

if you'd like some help... and if Artaflex is okay with it... for starters, PM me their sample firmware & software once you have a chance
-t
Cheese Wheel
Cheese Wheel
 
Posts: 114
Joined: Wed Aug 04, 2004 8:38 pm

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby dougm007 » Thu Nov 05, 2009 2:10 pm

"t-",

I'm just posting this to wrap-up this thread of "Artaflex" programming concerns.

See my 11 May 2010 post which corrects some content of this following paragraph. Sorry about that :-)
[XXX The AWP24U dongle uses a CY7C64215 enCoRe III USB controller and talks to a CYRF7936 radio, unlike the CYRF6936 radio used in the AWP24S design. CORRECTION: A January 2009 data sheet now shows the AWP24S using the CYRF7936, as verified visually with some radios I recently bought. CORRECTION: WirelessUSB LP function calls ARE compatible with the CYRF7936 radio, but not the enCoRe controller, apparently. Also, CYFISPI modules are no longer available in Designer 5, so I couldn't use CYFISPI examples I found. You are apparently pretty much forced to use "CYFISNP" (star network protocol) radio function calls, for which I found some skimpy code snippets, which did not seem to work in the short time I messed with them. Perhaps Artaflex had trouble with that code also, as all of their code for the "U" dongle appears to be custom. By the way, they did NOT want me to send you their code without me signing an NDA, for some reason. XXX]

My issues with the Artaflex U dongle are no longer issues. I realized that I can just use the very same custom PSoC 3 board we are designing for "node" devices, put it in a box, run a USB cable from it to a PC, and plug an Artaflex "S" board into it, and voila, I have my own "dongle", with complete programming freedom, which uses the Wireless USB LP functions, which I am already comfortable with, and I think may be a plus. I've already got the USB interface to the PC working, so that's not an issue. So on to learning how to use the PSoC 3/ PSoC Creator!

Thanks for all of your help and let me know if I can help you in the future.

Regards,
Doug
Last edited by dougm007 on Tue May 11, 2010 9:28 am, edited 1 time in total.
dougm007
Cheese Cube
Cheese Cube
 
Posts: 31
Joined: Thu Sep 10, 2009 7:28 am

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby gregelectric » Wed Feb 24, 2010 11:17 am

Doug,

I am trying to do exactly what you wanted to do. Connect via the AWP24U dongle to AWP24S on device.
I gather that you could not succeed without the code provided by Arteflex?
I have spoken with Arteflex and am awaiting code but am not sure what they are sending.
I do not want to have to re-program the usb dongle and was told by Arteflex that I should not have to.
It is all very confusing and the documentation ends before providing sufficient information.

Sincerely,
Greg
gregelectric
Cheese Cube
Cheese Cube
 
Posts: 35
Joined: Fri Sep 04, 2009 8:25 pm

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby dougm007 » Wed Mar 03, 2010 3:34 pm

Greg and others,

Artaflex did provide me with some example code that would indeed communicate between the AWP24S and the AWP24U and I was able to modify the code and also to re-program the AWP24U via an adaptor to the AWP24U USB port, which they provided a schematic for. The communication was just too slow using their higher-level code, which appeared to be custom, from what I remember. If they give you the same utility ("Artaflex_Listener" or "RF_Chat"), one thing you may find is that the "channel" value in their Windows interface to the AWP24U may need to be set to a value of 1 or 2 less than other radios communicating with it (perhaps a difference in setting "frequency" vs. setting "channel" ?).

FYI, my company developed some custom boards, using the AWP24S radio, and using the Cypress WirelessUSB LP driver code and we operate at the full expected speed (250kbps with 8DR and 32chip DSSS), even with "streaming" code, as I am using 24-byte payload packets. The only glitch is that the "hub" radio randomly, somewhat frequently (on the order of once or twice per second) fails to respond in the timeframe I expect, and further reception attempts fail, returning constants, and occassionally the radio chip hangs indefinitely. My "cure" has been to issue a "RadioForceState(END_STATE_IDLE)" command whenever I have radio transmit or receive "timeouts" (a timeout that I implement), radio errors indicated in the variable RADIO_ERROR after a transmit or receive, or if I receive an unexpected packet size. This is annoying, but seems to be a workable solution for me so far. Cypress has, supposedly, been trying to solve this problem for a long time, as I provided them with some stripped-down code that exhibits the problem.

Good luck.
-doug
dougm007
Cheese Cube
Cheese Cube
 
Posts: 31
Joined: Thu Sep 10, 2009 7:28 am

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby angela88 » Thu Apr 15, 2010 8:37 am

Thanks for all answers!




Watch Robin Hood 2010 Movie Online
angela88
Newbie
Newbie
 
Posts: 3
Joined: Thu Apr 15, 2010 8:35 am

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby dougm007 » Tue May 11, 2010 9:26 am

All Artaflex Radio Users:

I guess I have to eat crow (again). I stated long ago that the WirelessUSB Lp radio driver code did not appear to be compatible with the Artaflex AWP24U Dongle. Wrong! Below is a resonse I sent to another user.

==========

I hope this makes your day. I couldn't resist going back and seeing if what I learned over the months could be applied to making the Artaflex Dongle work with the WirlessUSB LP driver.

Success!

I couldn't spend a lot of time cleaning up my code, but attached is a "dongle" project and a "remote radio" program that work. I used the "RealTerm" ASCII/Hex terminal I sent you before to send an 'L' to the Dongle on my laptop USB port (you can use Microsoft's Hyperterminal or your own application). This in turn transmitted the 'L' to the remote radio, which transmitted the string "** Left Device *" back to the Dongle, which relayed it back via USB to the RealTerm program.

Note that I am using a single radio channel in this example. Each radio responds only when appropriate to avoid collisions. If you programmed another remote radio that responds to 'R', for example, this should work also.

Long term, you need to handle errors as I have discussed on other posts (implement timeouts, check for RADIO_ERRORs, check for wrong number of bytes received, etc, and do "RadioForceState(END_STATE_IDLE)" (or maybe Radio_Abort(), which is supposed to be faster) to "slap the radio" to make it work again.

Note also that I have used 16-byte maximum transmission (used lpnonstreaming.asm).

Please give me some feedback, as this should work for you. Of course you'll have to configure your "remote radio" appropriately, as I used the CY3209 Kit 29666 radio quadrant.
==========

Hope this helps others,
Doug
Attachments
Doug_Dongle.zip
(782.81 KiB) Downloaded 272 times
dougm007
Cheese Cube
Cheese Cube
 
Posts: 31
Joined: Thu Sep 10, 2009 7:28 am

Re: Artaflex AWP24S-to-AWP2U dongle communication

Postby christopher0026 » Mon Jan 21, 2013 8:36 am

hey guys..i am new to use wireless on psoc..really dont know how to configure artaflex24s modem to psoc 5 .i want to build point to point communication between two psoc5 devices .can anyone give me some example programs and how to start the design ? i have psoc first touch starter kit and 2 artaflex modems .i dont get any example program on cypress web site.
i exactly dont know how to configure modems on psoc creator software schemetic ????
i need help urgently as i want to start project in this field.....
christopher0026
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 18
Joined: Mon Aug 13, 2012 5:31 am


Return to “%s” USB

Who is online

Users browsing this forum: No registered users and 3 guests