Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Hello @@JapiMostert, I just read this thread and your questions. Since I just finished my masters degree, I can well imagine how overwhelmed you feel facing the requirements of your project. As it's already been said, try to draw a graph of the components, how they interact and which functions you want to accomplish. Don't try to overaccomplish what's asked. Try to find the easiest ways. Don't be afraid of the term "data logging". If you just send the time of the stopwatch over UART, that's everything you need. On the MSP430G2 launchpad you have a UART->USB bridge (just in case you
  2. It executes the c-files that are being generated out of the grace.cfg during the compile process. Looking through the project settings I can't find where this gets done during compiling...
  3. I didn't know the grace config only depends on the raw text in that single cfg file, thanks @@roadrunner84 :-) I just copied the default main.cfg and renamed the second file. How does CCS determine what cfg file to use (when renamed)? Or does it just use the first *.cfg file it finds?
  4. that's a good point, thanks @@roadrunner84 If I change the check to "eventArray[i].nextTime <= millis()" the problem is also gone and saves the 4 bytes for another variable ;-) I just had a look at Energia source code. Energia spends quite some time to do the millis(); alone: __attribute__((interrupt(WDT_VECTOR))) void watchdog_isr (void) { // copy these to local variables so they can be stored in registers // (volatile variables must be read from memory on every access) unsigned long m = wdt_millis; unsigned int f = wdt_fract; m += sleeping ? SMILLIS_INC:MILLIS_INC; f += sle
  5. Erm, I think I've got it: EventTimer.h /* * EventTimer.h * * Created on: 07.07.2014 * Author: Leo_2 */ #include <msp430.h> #include "../types.h" #ifndef EVENTTIMER_H_ #define EVENTTIMER_H_ #define MAXEVENTS 10 #define EVENTTIMER_TxR TBR // Timer_B counter #define EVENTTIMER_CTL TBCTL // Timer_B control #define EVENTTIMER_MC0 MC0 // Mode control 0 #define EVENTTIMER_MC1 MC1 // Mode control 1 int AddTimerEvent(void (*function)(void), unsigned int millis, bool infinite); void initEventTimer(void); void startEventTimer(void); void stopEventTimer(void); bool g
  6. Hi there, I'm in the process of developing some wireless system. I want to have more than one transmitter - behaving just a little bit different from each other. Using Code Composer Studio I've discovered the ability to have different "build configurations". I made three different "main.c" files: main_transmitter1.c main_transmitter2.c main_transmitter3.c In build config 1 the second and third are excluded from build. In build config 2 the first and third are excluded... I think you get it. Now my question: To configure the peripherals I used Grace. Now I have a new idea
  7. Hi there, I've got something in my mind and need your advice Let's imagine we've got 8 LED's and 8 buttons attached to MSP430. (actually, it doesn't matter how many LED's or buttons, or which port they're attached to) We want a solution where a press of button one causes the first LED to light up for 1 second. After that time it'll switch off automatically. For now that's nothing special. Now, let's say every LED lights up when the corresponding button has been pressed, but every one of these LEDs switches off after a different amount of time. Moreover this whole mechanism should b
  8. Thanks @@RobG, I added that throughout my library. Up until now I'm happy with my ringbuffer implementation. Didn't encounter any issues by now Leo
  9. Thanks @@zlalanne, actually he has a lot of fifo implementations, most of them are hard to understand to me, but here's one that's pretty close to mine: http://users.ece.utexas.edu/~valvano/arm/FIFO.c I think I'll leave my implementation like it is ... until I discover a new problem ;-) Leo
  10. Hello @@igor, I had another night of trial and error As you correctly pointed out, the first byte got discarded by BufferOut. That was my solution to overcome the problem caused by directly transmitting the first byte in buffered_send_SPI. I have corrected this behaviour and again, had the problem of first byte getting sent double. Then I discovered the UCBUSY bit in UCxSTAT. Instead of directly sending the first byte to get the peripheral running... else if(in == send_toSPI_buffer.index_reading) { //IFG2 |= UCB0TXIFG; UCB0TXBUF = ch; } ... I fired an artificial interrupt t
  11. Hello @@igor, up until now I only used it to send data over a peripheral like SPI or UART. In this case only the ISR triggers BufferOut(). If the buffer is empty no new value gets written in the output buffer register of the peripheral. Thereby no ISR will fire anymore and the two indices will remain the same. Thats the reason why BufferIn() checks if the two indices were the same and if so, writes the current char directly to the register of the peripheral. If only one char has been sent to the buffer the ISR again will do nothing except increasing the reading index the thereby leading to
  12. I read that wikipedia article - I just can't make the transition to my actual case I'm now adding my current code (please excuse the german comments). First I have a layer that abstracts the ringbuffer logic: ringbuffer.h: #ifndef RINGBUFFER_H_#define RINGBUFFER_H_#define BUFFERLENGTH 64 // Must be 2^n#define BUFFER_MASK (BUFFERLENGTH-1) // Klammern auf keinen Fall vergessentypedef struct ringbuffer{ unsigned char ringbuffer[BUFFERLENGTH]; unsigned int index_reading; // zeigt auf das Feld das zuletzt gelesen wurde unsigned int index_writing; // zeigt auf das Feld in welches das n
  13. Hello, the last two days I've implemented a portable ringbuffer for use with UART, SPI or even different microcontrollers (minor changes required). I grabbed some ideas from here and there and mixed it all together in my own solution. I tested the functionality with some code that writes in unregular time distances into the buffer while the SPI TX interrupt is reading from it. It _seems_ to work well, but a friend of mine told me I definately have to deactivate the interrupt in "critical sections" of my code. Now I'm a little bit stuck. How do I identify what a critical section is? I
  14. Wow thanks for the quick answer oPossum I think I've misunderstood the purpose of UCxSTE. On the eZ430-RF2500T target board UCB0STE (Port 3.0) is connected to CSn of the CC2500. Therefore I thought UCxSTE is some kind of auto hardware controlled chip select that's being driven low when transmitting. Ok, if got it right, I have to use 3-pin mode and use P3.0 as a normal output that I manually drive low during communication with the attached cc2500, right? Leo
  15. Hello, after years of abstinence I'm back to playing with TI hardware. I'm using the eZ430-RF2500 Development Tool with CCS and Grace. While implementing a ringbuffer for SPI I ran into an unexpected behaviour. (using USCI_B ) By writing a byte to UCB0TXBUF the UCB0TXIFG Interrupt should fire, right? Ok, I made a minimal example with Grace, only clocks and the SPI interface configured. I placed a _NOP(); in the ISR and a breakpoint on it. In main I add the line UCB0TXBUF = 'a'; When the SPI interface is configured as 3-Pin it does halt at the breakpoint. If I configure
  • Create New...