Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Qbo_electronics
PostPosted: Aug 28, 2011 - 09:54 AM
Newbie


Joined: Jun 14, 2009
Posts: 15


Shame on me.. Thanks
 
 View user's profile Send private message  
Reply with quote Back to top
petter@inventech.no
PostPosted: Oct 12, 2011 - 09:47 AM
Rookie


Joined: Oct 12, 2011
Posts: 26
Location: Norway

Hi,
I'm trying out the serialnet democode from the sdk downloaded from atmel on a atzb-24-a2 module(no developer board, custom for my app). when i download over isp i can connect over serial communication at 38400baud and it reply's to command's and everything is fine. but when i put in a bootloader or use the bootloader preloaded on the module. i cant connect at all. the device don't reply to any serial commands.

When i use ISP to transfer the code i use the SerialNet_ZigBit_Rf230.hex file from the sdk, avrisp and AVRStudio 5.0.

when i use bootloader to transfer i use the bootloader provided in the sdk to upload SerialNet_ZigBit_Rf230.srec. in both cases the code is verified and ok on the chip.

Is there any difference to the hex code and the srec code?
or is the bootloading disrupting the code in some way??

Has anyone succededed in uploading the serialnet code using bootloader or is everyone using jtag or isp to upload code?

Anyone got any idea of why i got this problem? Smile
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Oct 12, 2011 - 12:03 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

It should work. Can you program bootloader, upload the image using bootloader and then read back full image?

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I'm affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
aquafood
PostPosted: Oct 12, 2011 - 07:18 PM
Newbie


Joined: Sep 28, 2009
Posts: 6


Hi,
I am trying to use an ATZb-24-A2.
I made a blinking program.Its source code is:
Code:

#include <avr/io.h>
#include <util/delay.h>

int main(void) {
   DDRG=0xff;
   DDRD=0xff;

   PORTD=0xff;
   PORTG=0xff;

   while(1)
   {
      PORTG=0xff;
      PORTD=0xff;
      _delay_ms(1000);
      PORTG=0x00;
      PORTD=0x00;
      _delay_ms(1000);
   }
}

It is working fine.
I try to write the same program that uses the bitcloud API. Its source code is:
Code:

#include <appTimer.h>
#include <zdo.h>
#include <blink.h>
#include <gpio.h>


static HAL_AppTimer_t blinkTimer;                           // Blink timer.
static void blinkTimerFired(void);                         // blinkTimer handler.

void APL_TaskHandler(void)
{
   
   GPIO_4_make_out();
   GPIO_4_set();   

   GPIO_6_make_out();
   GPIO_6_set();   
      
   GPIO_7_make_out();
   GPIO_7_set();   
   
  // Configure blink timer
  blinkTimer.interval = 2000;           // Timer interval
  blinkTimer.mode     = TIMER_REPEAT_MODE;        // Repeating mode (TIMER_REPEAT_MODE or TIMER_ONE_SHOT_MODE)
  blinkTimer.callback = blinkTimerFired;          // Callback function for timer fire event
  HAL_StartAppTimer(&blinkTimer);                 // Start blink timer
}

static void blinkTimerFired()
{
 
  GPIO_4_toggle();
  GPIO_6_toggle();
  GPIO_7_toggle();
   
}
/*******************************************************************************
  Description: just a stub.

  Parameters: are not used.
 
  Returns: nothing.
*******************************************************************************/
void ZDO_MgmtNwkUpdateNotf(ZDO_MgmtNwkUpdateNotf_t *nwkParams)
{
  nwkParams = nwkParams;  // Unused parameter warning prevention
}

/*******************************************************************************
  Description: just a stub.

  Parameters: none.
 
  Returns: nothing.
*******************************************************************************/
void ZDO_WakeUpInd(void)
{
}

#ifdef _BINDING_
/***********************************************************************************
  Stub for ZDO Binding Indication

  Parameters:
    bindInd - indication

  Return:
    none

 ***********************************************************************************/
void ZDO_BindIndication(ZDO_BindInd_t *bindInd)
{
  (void)bindInd;
}

/***********************************************************************************
  Stub for ZDO Unbinding Indication

  Parameters:
    unbindInd - indication

  Return:
    none

 ***********************************************************************************/
void ZDO_UnbindIndication(ZDO_UnbindInd_t *unbindInd)
{
  (void)unbindInd;
}
#endif //_BINDING_

//eof blink.c


But the leds are not blinking.
What can be the problem?

Thanks!
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Oct 12, 2011 - 07:27 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

Where is your main() function? It looks correct otherwise.

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I'm affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
aquafood
PostPosted: Oct 12, 2011 - 09:34 PM
Newbie


Joined: Sep 28, 2009
Posts: 6


Sorry, but i don't understand your question.
What kind of main function do you miss?
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Oct 13, 2011 - 05:14 AM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

All C applications should have a "void main(void)" function.
In BitCloud applications it usually looks like:
Code:
int main(void)
{
  SYS_SysInit();

  for(;;)
  {
    SYS_RunTask();
  }
}
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
babic060
PostPosted: Jan 15, 2012 - 03:52 AM
Newbie


Joined: Jan 15, 2012
Posts: 6


Hi,

I have a problem to establish any connection between two ATMEL atzb-24-A2 modules.
I have two keyboards, two displays and two uC STM32F100RB. When those two are connected via UART using wires, exchange messages works perfectly. Now, i want to do it wireless, but receiver doesnt receive anything.
I am student and beginner in this area.

I want to send some text from first uC to another via ZigBee, and from second to first. So, both of them shoud be coordinator and end device at a time.

At start, i configure both of them as a receiver. The one that shoud send some text is firstly configured as a transfmitter, and after that, the message is sent, but the receiver didnt receive anything.

When sending:
AT+WAUTONET=0 z
CR
ATX
CR
AT+GSN=1
CR
AT+WPANID=1620
CR
AT+WCHMASK=100000
CR
AT+WROLE=0 +WSRC=0
CR
AT+WWAIT=3000
CR
AT+WAUTONET=1 z
CR

ATD 55
CR
myText
CR


When receiving:
AT+WAUTONET=0 z
CR
ATX
CR
AT+GSN=2
CR
AT+WPANID=1620
CR
AT+WCHMASK=100000
CR
AT+WROLE=1 +WSRC=55
CR
AT+WAUTONET=1 z
CR

After every command i get OK so i have no idea what is wrong.
Please, do you have any idea to help me?
Thanks
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Jan 16, 2012 - 08:17 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

Try using AT+WJOIN instead of switching autonet on and off.

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I'm affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
babic060
PostPosted: Jan 20, 2012 - 12:23 PM
Newbie


Joined: Jan 15, 2012
Posts: 6


Hi,

When I tried with WJOIN, it seems it works faster to get OK, but still, there is no successful exchange of any data.
Actually, I have new problems. I am using two LEDs to watch current status. Initially, both modules are configured as receivers, and while configuration is on, those LEDs are on too. After getting every OK, LEDs are turning off which means that both ZigBees are ready to receive. The problem is that both LEDs are very often always on, which means that some OKs was issed. In that case, the code was written to repeat sending that AT command until OK is there, but it almost never comes up.

But, when configuration successes, after i push the button on one uC, one Atmel is started to be configured as a transmitter, after i send data and configure as a receiver again. But, the other uC still doesnt receive anything.


My question is:
is it ok to always repeat the described situatin: configure a modul as Rx and wait for data. When it should transmit, configure it as a transmitter, send some data, and configure it back as a receiver?

Is there anything else I should do to receive data except configuring with next AT commands:
ATX
AT+GSN=2
AT+WPANID=1620
AT+WCHMASK=100000
AT+WROLE=1 +WSRC=55
AT+WJOIN
and, of course, enabling interrupt for uart?

I am not sure if ZigBee modul should return any status after sending data:
ATD 55
CR
myData
CR

I expected to get OK or ERROR after every CR that i send to ZigBee modul, but after ATD 55 or DATA, i dont receive anything.



I am sorry if my english was bad or if my text was too long.
Thanks for any help.
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Jan 20, 2012 - 09:57 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

There is no "configuration as transmitter" and "configuration as receiver". Once configured (and not sleeping) node always in receive state unless asked to send data.

Here are minimal configuration commands for Coordinator, Router and End Device:
Code:

AT+GSN=1
AT+WSRC=0
AT+WROLE=0
AT+WPANID=1234
AT+WCHMASK=40000
ATX0
AT+WJOIN


AT+GSN=2
AT+WSRC=1
AT+WROLE=1
AT+WPANID=1234
AT+WCHMASK=40000
ATX1
AT+WJOIN

AT+GSN=3
AT+WSRC=2
AT+WROLE=2
AT+WPANID=1234
AT+WCHMASK=40000
ATX1
AT+WJOIN


Data should return OK or ERROR status, but in case of error it might take a while (up to 40 seconds).

Try running this commands (1 and 2) on two devices and post what responses do you get to each of them.

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I'm affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
babic060
PostPosted: Jan 21, 2012 - 10:52 PM
Newbie


Joined: Jan 15, 2012
Posts: 6


Hi,

Your previous post was very useful to me. Now, i have something Smile
I ran commands (1 and 2), and I turned echo on too (ATE1 command).

Should I always resend those sets of AT commands after returning power on or only ATD and DATA are enough to start sending?


When I had sent set 1 or 2, i got error for every command except ATX and WJOIN (those two gave me OK). When I asked "ATS0?", i found that some commands was not able to be processed at current state,
and some unspecified error (code 4).
And when I used wautonet instead of wjoin, i got OK for every message. After that, I used WJOIN again, was getting some errors again, but now i was able to send some data.
I suppose those commands are stored in rom, so those errors have no efect.

My problem at the moment is that the other side receives the message but with some bytes missing. If I send "123456", I will receive something
like this: "AA 000, 6:145" but i thought i will get DATA 0,6:123456" or something like that.

I turned on hardware flow control, but I am not sure if it is helpful for this.



So, is there a way to stabilize sending and not to lose any byte?

Are those sets of AT commands (minimal configuration commands) ok to stay intact or shoud i add something more?

For how long shoud my uart wait for data? Is there any charachter that is always sent the last by ZigBee when uC receives (maybe CR or LF)?

And thanks a lot Smile
 
 View user's profile Send private message  
Reply with quote Back to top
babic060
PostPosted: Jan 22, 2012 - 06:44 PM
Newbie


Joined: Jan 15, 2012
Posts: 6


Hi, again.

I solved the problem. My program was too busy in interrupt routine. I found a way to properly receive a data and to put it on display, but i can send it once successfuly and every next try results in errror after about 30sec.
Maybe I can fix it too with better optimized program, but i want only to ask about the procedure for send/receive.
I am using wautonet on and off to configure modules, and after that only atd0 and data (atd1 and data for other device).

So, my questions are:
-what is the procedure to exchange data (text) normally, something like chat? The question is about (re)configuring modules and other AT commands.

-What are advantages and disadvantages with using wautonet and wjoin? I really don't know what to choose for final. With wjoin, initialization is shorter, but i get errors with setting wrole, wsrc... with autonet it is slower, but all results are ok

BR
 
 View user's profile Send private message  
Reply with quote Back to top
babic060
PostPosted: Jan 22, 2012 - 07:46 PM
Newbie


Joined: Jan 15, 2012
Posts: 6


...and update of the current status:

one keyboard, displey, uC and ZigBee is A, and the other set is B:
sending data from A to B and from B to A in next order:

src; data sent; dest; data received;

A 1 B 1
B 2 A 2
A 3 B 3
B 4 A 4
B 5 A (none)
A 6 B 6
A 7 B (none)
A 8 B (none)
B 9 A 9 but now B receives '8' (7 never arrived)

So, i can exchange data successfuly, but one must to send and to receive before next send. I hope that this is not a must and i hope that my program has some bug unfound yet.
Next, if i try to send from A or B three times in a row, some error ocures, and the sender receive some response:
Sometimes it is D1<data that i tried to send>
and sometimes it is TD1<data> and i have to wait for about 10 sec (like reinitilizing with wautonet).

I hope this is familiar to you. It is possible that i have a problem with memory menagment and i will try few things, but i wonder if this is some known issue.

Thanks anyway
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Jan 23, 2012 - 07:54 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

babic060 wrote:
So, my questions are:
-what is the procedure to exchange data (text) normally, something like chat? The question is about (re)configuring modules and other AT commands.
Just a regular ATD command is usually enough. There is no need to reconfigure anything.

babic060 wrote:
-What are advantages and disadvantages with using wautonet and wjoin? I really don't know what to choose for final. With wjoin, initialization is shorter, but i get errors with setting wrole, wsrc... with autonet it is slower, but all results are ok
Autonet just makes sure that module will try to join automatically. Settings are exactly the same for both them. When you say that you receive errors please post complete log of commands you send, it is impossible to say what is wrong otherwise.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
alexru
PostPosted: Jan 23, 2012 - 07:56 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

babic060 wrote:
So, i can exchange data successfuly, but one must to send and to receive before next send.
I think you have some problems with handling received data.

babic060 wrote:
Next, if i try to send from A or B three times in a row, some error ocures, and the sender receive some response:
Do you wait for OK or ERROR between those attempts?
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
babic060
PostPosted: Jan 25, 2012 - 10:59 PM
Newbie


Joined: Jan 15, 2012
Posts: 6


It's amazing how much you helped me with so few words Smile
Thank you very much. Now, everything works perfectly. The main problem was because i had disabled receiving (generating an interrupt) in interrupt routine after one message had been received. With receiver always enabled, it is all ok.

Once more again, thank you very much Smile
 
 View user's profile Send private message  
Reply with quote Back to top
mkpolska
PostPosted: Feb 09, 2012 - 04:29 PM
Newbie


Joined: Jan 22, 2012
Posts: 10


Hi,

i don't want to create new topic so i write here.
I have one question.
I have new atzb-24-a2 module.
I want load to this module SerialNet.
It is posible through ISP programmer?
It is posible through RS232(via converter with MAX3232)?
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 09, 2012 - 04:43 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

Yes and yes.

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I'm affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
mkpolska
PostPosted: Feb 09, 2012 - 05:17 PM
Newbie


Joined: Jan 22, 2012
Posts: 10


Ok.
so i'd like to use ISP programmer.
should i connect pins in this configuration?:

PROGRAMMER | ATZB-24

MOSI <-> SPI_MOSI(3)
MISO <-> SPI_MISO(2)
GND <-> GND(9,22,23,35)
VCC <-> VCC(24,25)
RST <-> RESET(8 )
SCK <-> SPI_CLK(1)

?
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits