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
guitero
PostPosted: Feb 03, 2012 - 02:07 PM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

Hello,

I am working on a ZigBee project at the moment. I'm using a proprietary board with the
ATmega128RFA1 as a controller and transceiver. For the first tests I used the MAC-stack from Atmel and the ATmega128RFA1-EK1 Board examples as a sample and adapted it to my hardware. All examples are working fine. Now I want climb the next step and use the ZigBee Pro Stack.
However, I have a problem with the adaption to the hardware and with the documentation. It is not as detailed as it was in case of the MAC-Stack.

One example: I would like to change the pins of the LEDs and buttons. But I cannot find a corresponding file. Does anyone have experience with ZigBee PRO, and can give me assistance.
The MAC stack was documented very well. I was hoping that ZigBee Pro could be handled similar to the MAC-Stack. Or did I miss one chapter in the document?

Thanks in advance. I would be grateful for any assistance!

guitero
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 04, 2012 - 06:19 PM
Raving lunatic


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

Board specific things are not documented very well in BitCloud. Board specific stuff is located at BitCloud/Components/BSP/*.

_________________
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
guitero
PostPosted: Feb 06, 2012 - 09:02 AM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

Thanks for your reply. I found the correct file.
If anyone experiences the same problem: bspLEDs.h in the folder Components\BSP\ATML_STK600\include
 
 View user's profile Send private message  
Reply with quote Back to top
guitero
PostPosted: Feb 06, 2012 - 05:36 PM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

@alexru
In some other threads you referred to the Atmel "Low Power" application. Where can I find this one? I downloaded the ZigBee Pro Package BitCloud_MEGARF_1_13_0.It only contains Blink and WSNDemo. I would be glad to have another example.
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 06, 2012 - 09:28 PM
Raving lunatic


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

Download ZigBit SDK, it includes the most complete set of examples, but it won't have project files, which are really easy to create based on existing projects from the correct SDK.

_________________
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
guitero
PostPosted: Feb 07, 2012 - 08:59 AM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

Thank you alexru!
There are two other problems!
1.
All of my applications need about 25 seconds to initialize. The blink-application for example needs 25 s until the LEDs start blinking. Is there something wrong or just normal behaviour?

2.
I would like to use a button. On my board it is on PB0.
But I don't know what to change exactly. So far I changed the following line in buttons.c

Code:
bspAddButton(BSP_KEY0, GPIO_B0_make_pullup, GPIO_B0_read);


But unfortunately this is not working.
Thanks for your assistance!
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 07, 2012 - 04:32 PM
Raving lunatic


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

guitero wrote:
All of my applications need about 25 seconds to initialize. The blink-application for example needs 25 s until the LEDs start blinking. Is there something wrong or just normal behaviour?
There is definitely something wrong. Initialization should not take more than 1-2 second in a worst case. What fuse settings do you have?

guitero wrote:
I would like to use a button. On my board it is on PB0.

Default BitCloud code handles only buttons on IRQx pins. PB0 is a PCINTx pin, so you need to trace and change entire chain application-BSP-HAL.

Another way to go is to put ISR for PCINT in your application and don't use BitCloud for this at all.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
guitero
PostPosted: Feb 07, 2012 - 04:56 PM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

Quote:
What fuse settings do you have?


Fuses that are enabled:
JTAG, SPIEN, Bootflash: 512 address: FE00, EESAVE, CKDIV8, Internal Oscillator.

Extended: 0xFE
High: 0x97
Low: 0x62


Quote:
Default BitCloud code handles only buttons on IRQx pins. PB0 is a PCINTx pin, so you need to trace and change entire chain application-BSP-HAL.


Okay. I'm not sure if I am able to manage that but I'll give it a try.
Thanks for your reply
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 07, 2012 - 05:02 PM
Raving lunatic


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

Fuses look fine. I would assume that something is wrong with the hardware. You need to start at HAL_Init() and see where it spends all this time.

_________________
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
guitero
PostPosted: Feb 07, 2012 - 05:19 PM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

Quote:
You need to start at HAL_Init() and see where it spends all this time.


I really do not know how to proceed now.
Would you use a timer for this? I don't know how to start, I'm sorry.
I would appreciate your help!
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 07, 2012 - 05:23 PM
Raving lunatic


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

You'll have to use debugger or just light an LED at different points and measure how long it takes for LED to light at different points.

Show PCB design and schematic for your module.

_________________
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
guitero
PostPosted: Feb 07, 2012 - 05:36 PM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

Quote:
You'll have to use debugger or just light an LED at different points and measure how long it takes for LED to light at different points.


Can I just take the HAL_Init() function separately without the other stack-Layers?

Quote:
Show PCB design and schematic for your module.


I'm sorry, but a business partner of my technical college developed the board so I'm not allowed to give out the schematics. I still hope that it's not a hardware problem. That would be a huge problem for me.
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 07, 2012 - 05:42 PM
Raving lunatic


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

guitero wrote:
Can I just take the HAL_Init() function separately without the other stack-Layers?
No, it has to be debugged as a part of BitCloud.

Also try to set CS_UID to a non-zero value in the configuration.h first.

guitero wrote:
so I'm not allowed to give out the schematics.
I don't need complete schematics, but I need surroundings of a megaRF and power supply chains. You can send them to my e-mail, if you don't want to share them publicly. Otherwise you on your own, start from CS_UID and proceed to debugging HAL_Init().
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
guitero
PostPosted: Feb 07, 2012 - 05:52 PM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

Quote:
Also try to set CS_UID to a non-zero value in the configuration.h first.


It's still the default value, 0x0LL but I also have tried other values.

Quote:
Otherwise you on your own, start from CS_UID and proceed to debugging HAL_Init().


Okay. I'll first try debugging and then post the results here.

Thank you for your great assistance Alex!
 
 View user's profile Send private message  
Reply with quote Back to top
guitero
PostPosted: Feb 07, 2012 - 06:36 PM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

I used the blink-application for testing. First I added a line to light a LED within the HAL_Init(). But nothing happened. Then I renamed the HALInit.c to test if its acually included. The file is located in Components\HAL\avr\atmega128rfa1\common\src. But the compiler gave no warning during compilation. It is possible to rename all the files that have to do with the HAL-Layer without getting a warning from the compiler. Did I forget an include?
But the application is running as desired. What am I doing wrong??
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 07, 2012 - 06:38 PM
Raving lunatic


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

You need to recompile HAL after any changes by hand. Run "make clean all" form a command line from the HAL directory.

_________________
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
guitero
PostPosted: Feb 07, 2012 - 07:10 PM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

The first short delay happens within halInitFreq(). But the problems seems to be halReadUid().
Here the results:

halInitFreq(): 4s
halReadUid(): 22s

Big thanks again!!
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 07, 2012 - 07:17 PM
Raving lunatic


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

Well, for some reason your MCU is really slow. The only reason why halReadUid() might take that much time is to wait until few bytes are sent over SPI.

Do you have 32 kHz crystal on your board? Stack will try to calibrate internal RC and if you don't have 32 kHz crystal then this calibration will not work. But I'm not sure if frequency can be set that low.

_________________
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
guitero
PostPosted: Feb 07, 2012 - 07:24 PM
Wannabe


Joined: Feb 03, 2012
Posts: 74
Location: Oldenburg

Quote:
Do you have 32 kHz crystal on your board?


No, I read the configuration somewhere here in the forum so I chose the internal oscillator divided by 8. On my board is a 16 MHz crystal between XTAL1 and XTAL2.
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 07, 2012 - 07:29 PM
Raving lunatic


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

16 MHz crystal is used by the radio part, your MCU runs on internal RC oscillator. But to calibrate internal RC oscillator BitCloud uses 32 kHz oscillator as a reference. It should be placed on PG3 and PG4. You may work without it, but you'll have to disable calibration in the HAL and you'll probably have troubles with sleeping.

_________________
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
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