msp430

Embedded C UART conventions

血红的双手。 提交于 2021-01-27 18:30:51
问题 I need advice on proper way of handling UART communication. I feel like I've done handling sending serial commands over UART well but I don't know if the way I'm parsing the response or receiving serial data is the best way to do it. Any tips are appreciated but I just want to know if there's a better more and elegant way to parse UART RX. This is for an MSP430 uC by the way... First I have these declared in the header file: const unsigned char *UART_TX_Buffer; unsigned char UART_TX_Index;

msp430 timer interrupts and port interrupts

我与影子孤独终老i 提交于 2020-05-09 16:56:15
问题 I have written the following C code to trigger two port interrupts in order to blink a LED at different rates, I have used _delay_cycles(900000); instead I want to use a method delayMS(125); using timer interrpts, I tried as shown but Does not work , please help... #include <msp430.h> void initTimer_A(void); void delayMS(int msecs); unsigned int ofCount; int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer BCSCTL1 = CALBC1_1MHZ; //Set DCO to 1Mhz DCOCTL = CALDCO_1MHZ; P1OUT=0X00;

MSP430 Assembly Stack Pointer Behavior

纵然是瞬间 提交于 2020-01-23 12:37:26
问题 While trying to analyze a simple Assembly file generated through the msp430-gcc, I stumbled upon a set of instructions that I don't understand dealing with the frame pointer and the MSP430's stack pointer. C Program: #include "msp430g2553.h" int main() { int i; for(i = 0; i < 3; i++); } Assembly minus directives: main: mov r1, r4 ;Stores address of stack pointer in r4(frame pointer) add #2, r4 ; ? sub #2, r1 ; subtract 2 to allocate int i mov #0, -4(r4) ; assign 0 to i jmp .L2 ; start loop

Adding my own library to Contiki OS

馋奶兔 提交于 2020-01-02 04:07:09
问题 I want to add some third party libraries to Contiki, but at the moment I can't. So I wanted to just test with a simple library. I wrote two files hello.c hello.h, in hello.c I have: printf(" Hello everbody, library call\n"); In hello.h I have: extern void print_hello(); I created hello.o using the command: msp430-gcc -mmcu=msp430f1611 hello.c -o hello.o I created an archive file: ar -cvq libhello.a hello.o I move to contiki, i write a simple program that calls hello.h to execute a function.I

How to pass a compile flag to cmake initial compiler test?

故事扮演 提交于 2020-01-02 01:41:06
问题 I'm trying to use CMake for building a project which uses the MSPGCC cross-compiler for a MSP430 microcontroller. To successfully compile any simple program with it, we need to pass a compile flag indicating the target processor, or else it fails like this: $ msp430-gcc -o test test.c In file included from test.c:1:0: /usr/local/lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2: warning: #warning Unable to identify and include MCU header, use -mmcu=MCU [-Wcpp] /usr/local/lib/gcc

RTC with msp430

折月煮酒 提交于 2020-01-01 20:09:21
问题 I have asked this question before, but I think this time I can ask with some more clarity. The below is my RTC Test code. I am using msp430f5418 with IAR EW 5. My problem is after some time (we tested with 15 minutes and more) the minutes interrupt is coming earlier than expected. ie, On first time, after exactly 60 seconds and after 15 minutes the minute interrupt comes on 45th seconds itself. Why is it so? We are using the library provided by TI for RTC register manipulation. Can anybody

RTC with msp430

折月煮酒 提交于 2020-01-01 20:09:11
问题 I have asked this question before, but I think this time I can ask with some more clarity. The below is my RTC Test code. I am using msp430f5418 with IAR EW 5. My problem is after some time (we tested with 15 minutes and more) the minutes interrupt is coming earlier than expected. ie, On first time, after exactly 60 seconds and after 15 minutes the minute interrupt comes on 45th seconds itself. Why is it so? We are using the library provided by TI for RTC register manipulation. Can anybody

Hashing a 64-bit value into a 32-bit MAC address

强颜欢笑 提交于 2019-12-25 04:38:09
问题 I'm looking into suggestions on how to convert a 64-bit die revision field into a 32-bit MAC address I can use a for a wireless application to avoid collisions. The die information is struct { uint32_t lot; uint16_t X_coordinate; uint16_t Y_coordinate; } I don't know the range of coordinates, but based on a few samples, I think the coordinates are limited to < 256. That effectly reduces the space by 2 bytes. But the lot number is fully populated. I'm going to try this (pseudocode to make it

How can I link the source path of a compiled library to a different location in Eclipse?

落花浮王杯 提交于 2019-12-24 10:59:19
问题 I've installed the msp430-gcc compiler and associated tools to do some open-source msp430 development at home using Eclipse. I'm developing on a slightly older Macbook Pro running OS X Lion and installed the tools using MacPorts. I'm running Eclipse 3.7.2 with the CDT and GCC Cross Compiler Support plug-ins. I have a simple empty main() written that compiles and links just fine. The ELF parser lets me view the contents of the ELF binary just fine with the exception of one component; when I

Embedded console log optimization

烈酒焚心 提交于 2019-12-24 00:14:26
问题 A while back I had posted this question on SO. In that question I was looking for a way to implement a solution which we had thought of. But from the answers I got, I saw that that solution was unimplementable using the default C preprocessor. So I've decided to post the problem directly and see if a proper solution can be found. PROBLEM STATEMENT We have a custom hardware platform on which we've used the Contiki OS to build the firmware. The hardware is based on the MSP430 micro-controller.