# Tag Info

27

Using dynamic memory allocation on a 16 bit MCU with 4kb RAM is very poor engineering. Not so much because of the usual problems with memory leaks. Not so much because of heap memory fragmentation. Not even because of the rather steep execution time overhead needed for the allocation routines. But because it is completely pointless and makes no sense. You ...

25

FRAM is great, however, the technology has destructive reads. Flash technology has a limited write/erase cycles, but the reading cycles are almost unlimited. In FRAM, each read cycle actually affects the memory and it starts to degrade. TI states that they've found the FRAM has "Wear-out free endurance to 5.4 × 10^13 cycles and data retention equivalent of ...

17

The watchdog timer (WDT) is on by default, it's a useful thing to have in more complex applications, but trips a lot of new people up. They often will not service the WDT in their code or include an interrupt service routine (ISR) to handle the WDT event, so, when their chip keeps resetting they become very frustrated. Additionally, the sample programs are, ...

16

It's not so bad, actually. I've done this a few times at work, writing and signing an .INF/.CAT for a Microchip PIC24FJ64GB002-based USB CDC-ACM-to-I2C interface. Establish a relationship with a certificate authority. You will need to provide them some basic information which they will validate. If you go for Extended Validation (EV) they will ask for a lot ...

13

You could do a 3:1 gear ratio and do the divisor at 32768. 32768 = 10,923 + 10,923 + 10,922 which indicates a state machine that first counts to 10,923 repeats and then drops a count, it would be accurate every 3 seconds. The worst absolute error you would see is 31 PPM which is about what the crystal can do (depending on your crystal).

12

From what I can see, the (main) difference between it and SRAM is it's slower, and the difference between it and EEPROM is it's more expensive. I'd say it's sort of "in between" both. Being a pretty new technology, I'd expect the price to drop a fair bit over the next year or so providing it becomes popular enough. Even though it's not as fast as SRAM, the ...

11

A lot isn't explained in the chip's own datasheet. With 450 processor models, this makes perfect sense : the datasheet describes the chip-specific stuff; common information is refactored out into a user manual covering the entire family of devices. The user manual for that device family is MSP430x2xx Family User's Guide Literature Number: SLAU144J ...

11

Take the 32,768 Hz square wave and feed it through a 98 kHz band pass filter to leave (mainly) its 3rd harmonic - this is fairly trivial. Now you have 3 times 32,768 Hz which you can divide with the previous circuit you used to get 3 Hz.

11

I think I've found the answer. It turns out this is a known problem, but I only found that after I'd decided where the problem was, and searched for that! Here is the process I went through, so you can follow it (and, if necessary, you can then adapt your investigation if you see results which differ from my assumptions). The bottom line is that there ...

10

This is called memory fragmentation. There are all kinds of fancy algorithms to deal with it, but the bookkeeping overhead makes them unsuitable for a small MCU. Instead, you can write you own memory allocation routines based on your expected usage pattern. You might have a separate routine for each thread of execution, for example. If you can guarantee ...

9

To use an external 32.768 KHz crystal with the MSP430G2553, the crystal needs to be soldered between the Xin and Xout pins of the microcontroller. In the DIP package, those are pins 18 and 19. No additional components are required for this. TA0CLK has nothing to do with this crystal's connection, please see the pin descriptions in the datasheet. See this ...

9

The only real issue with FRAM is that for the really dense parts, the part of the market that drives volume and margin, they cannot yet compete on density (which is either a yield thing or a size thing - it doesn't really matter which). For the smaller parts (i.e. competing against older version of same technology) they do well. So yes, it's a good fit for ...

9

In addition to Samuel's point about people accidentally tripping the WDT, there's another important reason why it should be disabled initially. Even if your application is normally capable of resetting the timer correctly, it may not be able to do so during the initialisation code, for two reasons: Initialsation might take longer than a single WDT tick, ...

9

Can anyone explain to me what a strange protection if the password(code) 5Ah is known? It protects you from random modification by runaway code, e.g. on stack overflow. Why RCKEY always read as 69h(not 5Ah)? So you cannot simply read->write it - part of the protection mentioned above. Microcontroller code often contains code that read-modify-writes a ...

9

You can use a JTAG programming tool for this purpose. Pinout of the programmer looks like this: You can find matching pins on the IC: When you design your custom board, you can put in a row of header pins connected to these pins. When your PCB is assembled, use spring loaded pins or a cable connector to program the board. Somewhat like this (image source):

8

From the MSP430 Optimizing C/C++ Compiler v 3.1 User's Guide (SLAU132c.pdf) pp. 109: The __delay_cycles intrinsic inserts code to consume precisely the number of specified cycles with no side effects. The number of cycles delayed must be a compile-time constant. It is a intrinsic function, specifically designed to use up cycles. It should be good for ...

8

Start with option 3, for the Stellaris. Finish the setup. Launch CCS, Then go to Help --> Code Composer Studio Licensing Information --> tab Upgrade --> button Launch License Setup This time go to option 4. At this point, both licenses should be installed. Ref: http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/236260.aspx and http://...

8

Change the: TA0CCR1 |= (duty_cycle*100); To a simple assignment: TA0CCR1 = (duty_cycle*100); Otherwise you are OR'ing the previous value with the new one, eventually filling it with ones. That is why you can't go back to a lower duty cycle. By the way, I don't know if your MSP430 has a hardware multiplier, but if it doesn't you should avoid direct ...

8

Yes, all microcontrollers have some way to produce voltage signals controlled by the firmware. The brute force method is for the micro to include a digital to analog converter (D/A). The firmware writes a number to the D/A and it produces a voltage proportional to that number. One important spec of D/As is how many bits the number has. This determines ...

8

The MSP430FR58xx, MSP430FR59xx, and MSP430FR6xx Family User's Guide says in section 3.2 that the CS module default configuration is: LFXT is selected as the oscillator source for LFXTCLK. LFXTCLK is selected for ACLK (SELAx = 0) and ACLK is undivided (DIVAx = 0). and in 3.2.2: At power up, the LFXT clock defaults to "on" and is the source ...

8

If you try to use 9600 bps rate with 32768 Hz clock, it is not possible, the actual baud rate will be faster, 10923 bps. That is 13% faster than requested 9600 bps, and thus out of tolerance requirement for receiver operating at 9600 bps rate.

7

Look at the dissassembly of the code, remember the for loop adds some instructions which take a few cycles. With a 5000 loop, these extra cycles will add up. Also, how delay_cycles() is implemented can make a big difference. You can count the cycles for each loop in the simulator, do the math and compensate for the added cycles by passing the appropriate ...

7

CCSv5 has a graphical memory use display. Select View -> Other -> Code Composer Studio -> Memory Allocation. The first time I used this, it needed to set up some configuration for the project .... but it prompted for everything and was relatively simple.

7

It is true that 32768 Hz does not divide by 3 Hz, but it is not off by much. You need a solution which appears visually smooth and is accurate on average over time. Simply create logic which: Counts 10923 input clocks and takes a step Counts 10923 input clocks and takes a step Counts 10922 input clocks and takes a step and repeats. You would need ...

7

To get the specified 20 pF load for a crystal, you need two 40 pF caps, theoretically. However, these 40 pF caps in reality do include package pin capacitance (2-3 pF each pin), plus parasitic capacitance of traces and pads under the IC and under XTAL, which typically are about 5-6pF. Therefore in your case you should use about 33 pF caps. Together with pin ...

7

You can do a simple "loopback" test - connect your Tx output to your RX input - if all is well, you can talk to yourself. EDIT The loopback test only shows that your transmit/receive routines are working. As @BeB00 comments, this does not test the baud rate settings, as most UARTs use the same clock for both transmit and receive.

6

The UM6K1N / 2SK3018 from Rohm work very well with 3.3V circuits (max 1.5V $V_{GS(th)}$) and are rated 100mA $I_D$ and 30V $V_{DS}$. They also have gate protection clamping diodes. The only downside is that they're surface-mount only - you'll need to spin a small PCB to use them.

6

The intent here is probably to allow a low noise ground region around the crystal oscillator, so run AVSS from pin 3 to 38 and right round any components connected to Xin/Xout in a full loop (aka a guard ring) if you aren't using a full ground plane. And of course it must be joined to DVss somewhere... preferably in just one place to avoid loops, perhaps ...

6

Here's how an interrupt works: When a certain event happens (the one that triggers the corresponding interrupt) the processor stops what it's doing, saves it's current execution point (the program counter), and starts executing the interrupt handler. Usually the last instruction of an interrupt handler is a special instruction that tells the processor to ...

6

Flash is slow to write to, only accessible in blocks for erasing/writing, on many controllers (not sure about MSP430) slow to read data from (in contrast to reading instructions) and flash has limited write cycles (order of 100,000 times). So the answer is: It can probably be done, but you shouldn't want to do it. Maybe an external I2C RAM is an option.

Only top voted, non community-wiki answers of a minimum length are eligible