[Tinyos-help] TinyOS directory structure

Michael Schippling schip at santafe.edu
Fri Sep 23 13:41:09 PDT 2005


You are quoting my email about mica2 pin assignments so I feel I should
respond...Sorry this so long in coming but I've been occupied...

I'm not sure about the use of "TOSH_ALIAS_PIN" but I've used:

TOSH_ASSIGN_PIN( MOTOR1PWM, B, 6 );	// PortB Pin6 named MOTOR1PWM
TOSH_MAKE_MOTOR1PWM_OUTPUT();		// make it an output port
TOSH_CLR_MOTOR1PWM_PIN();		// set pin to 0

I'm not sure about the include order, but I think local defines take
precidence. You can look in the .../build/mica2/app.c file to see
the nesc results of your compile and verify what actually got set.
Duplicate names may be reported by nesc, but I'm fairly sure that
it doesn't check for overloaded pin assignments. If you use a register
or port/pin that is being used by another module included in your
program, all bets are off on who gets control. If there is a standard
TOS module that uses your reg/port/pin, but is not used by your
program, it shouldn't interfere with your work.

MS


Lima GANSE Kenneth wrote:
> Hi all,
>  
> I have a problem with assigning pins and knowing which pins are pre- 
> assigned in TinyOS. I understand if i am compiling with *make mica2* 
> then the compiler goes through the following:
>  
> 1. Looks at my locally defined pin assignments in myinclude.h
> 2. Looks at those in tos\platform\mica2\hardware.h
>  
> Is this assumption correct?
>  
> Secondly, if it does, does it overwrite any pin assignment i do locally 
> with the ones it finds in tos\platform\mica2\hardware.h ?
>  
> I know for example that the AVR Atmega128 controller automatically uses 
> PORTB pin5 (PB5) as a Timer1 PWM output. I also read a mail on this 
> forum that quoted
>  
> ATMEGA MICA2 MICA2
> port pin pin Name    Description
> PB
>   0 10 -- none     10K pulldown, enables SPI
>   1 11 18 SPI_SCK     U3 DCK - Radio, and program
>   2 12 16 SPI_MOSI    Program in, not used internally
>   3 13 17 SPI_MISO    U3 DIO - Radio data and program out
>   4 14 23 PWM0      (available -- PWM out)
>   5 15 24 PWM1A      (available -- PWM out)
>   6 16 49 PWM1B      (available -- PWM out)
>   7 17 -- none     tied to PB1 for SPI clock
> 
>  
> So i used
> TOSH_ALIAS_PIN(USOUND_TXR_CTL, PWM1A);
>  in my local myinclude.h and used
>  
> TOSH_MAKE_USOUND_TXR_CTL_OUTPUT();
>  
> in my main module hoping to have declared PB5 like an output for PWM. 
> The AVR automatically creates PWM signals on PB5 when certain timer1 
> bits are set, so i did the same but nothing was being output on that 
> pin. Can anyone help explain this to me or am i misunderstanding the 
> directory structure of tinyOS?
>  
> Thanks in advance
> Kenneth
>  
>  
>  
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at Millennium.Berkeley.EDU
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


More information about the Tinyos-help mailing list