[riot-devel] vtimer on msp430

Milan Babel babel at inf.fu-berlin.de
Fri May 24 09:59:39 CEST 2013


I got the vtimer working on the wsn430, however would be nice if 
somebody could have a look if the attached patch breaks the vtimer on 
other mcu's.

On 23.05.2013 10:43, Milan Babel wrote:
> When the update_shortterm function is called it tries to set the 
> hwtimer to 4096000000, but on the msp430 hwtimer stores the counter in 
> the register TAR which has 16bit and maximum value of 65535.
> In the hwtimer_arch_set this value is converted to a unsinged int, so 
> the next overflow happens.
To avoid this i had to virtually increase the hwtimer max ticks on the 
msp430 from 0xFFFF to 0xFFFFFFFF.
To get this happen i had to waste one timer (No. 0), but this timer was 
not useable for me before.

> At a 32768 Hz Crystal I should have around 31 MICROSECONDS_PER_TICK, 
> whenever I reach 1000000 microseconds I have to overflow them to 
> seconds. But I think the vtimer_ticks don't need that frequent as the 
> hwtimer ticks?
I needed to inlcude at a few places a conversion from ticks to us and 
vice versa.

Since an unsigned long is not everywhere 32bit, it is hard to display 
such a value like uint32_t with printf.
I have nowhere seen this in the code but in inttypes.h are some macros 
defined which will output an unint32_t e.g. with PRIu32.
Is a reason given not to use them?


-------------- n?chster Teil --------------
Ein Dateianhang mit Bin?rdaten wurde abgetrennt...
Dateiname   : vtimer-msp430.patch
Dateityp    : text/x-patch
Dateigr??e  : 7206 bytes
Beschreibung: nicht verf?gbar
URL         : <http://lists.riot-os.org/pipermail/devel/attachments/20130524/89c21752/attachment.bin>

More information about the devel mailing list