Jump to content

roadrunner84

Members
  • Content Count

    1,370
  • Joined

  • Last visited

  • Days Won

    33

Reputation Activity

  1. Like
    roadrunner84 reacted to greeeg in RGB 4x4 button thing   
    The new board that has been designed. I tidied up alot of signals. Clumping them together to ensure a larger ground plane coverage.
     
    No componets have been changed. But I added the bypass capacitor onto Vcore pin. Also enabled thermal relief for all pads, but not vias.
     
    Top

     
    Bottom

     
    I'm loving kicads interface. Definitly not as polished as AD. But core functionality is there. Like labeling net names on traces.

     
    It even has a 3d viewer! (not sure if gifs are supported on this forum.. but this was a gif)

     
    So I don't have a readme or anything fancy set up on the bitbucket page yet. But all the design files are there. If you want to have a look.
    https://bitbucket.org/Greeeg/4squared
  2. Like
    roadrunner84 reacted to oPossum in Printing large numbers in small spaces (64 bits in 5 chars)   
    This code will print a 64 bit unsigned integer in 5 characters using 3 significant digits and and an SI prefix. Several revisions are shown beginning with the obvious implementation and then optimizing it to improve speed and decrease code size. Compilers used are TI 4.4.4 and GCC 4.9.1 Test hardware is the F5529 Launchpad running at the default clock of 1.016 MHz.
     
    The general strategy of the code is:
    - Count the number of digits in the decimal representation
    - Divide the value to reduce it to 3 digits.
    - Print the 3 digits with proper formatting and SI prefix.
    - Handle the special case of values of 99 or less that must be printed with 2 or 1 digits and no decimal.
     
    A series of values from zero to the maximum possible 64 bit value are used to test the performance and correct operation of the code...

    static const uint64_t td[] = { 0ULL, 1ULL, 12ULL, 123ULL, 1234ULL, 12345ULL, 123456ULL, 1234567ULL, 12345678ULL, 123456789ULL, 1234567890ULL, 12345678901ULL, 123456789012ULL, 1234567890123ULL, 12345678901234ULL, 123456789012345ULL, 1234567890123456ULL, 12345678901234567ULL, 123456789012345678ULL, 1234567890123456789ULL, 12345678901234567890ULL, 18446744073709551615ULL }; The first version uses C standard library functions for a very simple implementation. Decimal digits are counted using log10(). Dividing the digit count by three using the div() function provides values for formatting, division, and the SI prefix. The divisor needed to reduce the value to three digits is calculated with pow(). The special case of values of 99 or less is handled by using a fixed digit count for values less than 1000 rather than the actual base ten digit count. Conversion from uint64_t to double will have a loss of precision for large values due to float having a 52 bit significand. This is not a problem for this code because only three significant digits are printed.Code size for the TI compiler is 20,636 bytes and the execution time for the test case is 1.22 seconds. The GCC compiler does not produce working code.

    static void sprint_f3d(char * s, double f) { static char const * const fmt[3] = { "%1.2f%c", "%2.1f%c", "%4.0f%c" }; div_t const d = div((f < 1000.0) ? 2 : (int)log10(f), 3); sprintf(s, fmt[d.rem], f / pow(1000.0, d.quot), " kMGTPEZY"[d.quot]); } The C standard library does not have integer versions of log10() and pow(), so another strategy will be used. The value is divided by 10 until it is less than 1000. The number of divisions is counted to determine the number of base ten digits. Stopping the division when the value is less than 1000 handles the special case for values of 99 or less by limiting the digit count to 3 or more. The resulting 3 digit value will be split as necessary for formatting using the div() library function.Code size for the TI compiler is 5,346 bytes and the execution time for the test case is 3.24 seconds.
    Code size for the GCC compiler is 36,040 bytes and the execution time for the test case is 981 milliseconds.
    The poor performance of the TI compiler is due the an inefficient intrinsic 64 bit unsigned divide.

    static void sprint_u64_a(char *s, uint64_t n) { unsigned d = 2; while(n >= 1000) n /= 10, ++d; div_t qr = div(d, 3); char const u = " kMGTPE"[qr.quot]; switch(qr.rem) { case 0: qr = div((int)n, 100); sprintf(s, "%i.%02i%c", qr.quot, qr.rem, u); break; case 1: qr = div((int)n, 10); sprintf(s, "%2i.%i%c", qr.quot, qr.rem, u); break; case 2: sprintf(s, "%4i%c", (int)n, u); break; } } Using this 64 bit unsigned divide provides much better performance on the TI compiler, but much worse on the GCC compiler.Code size for the TI compiler is 5,666 bytes and the execution time for the test case is 396 milliseconds.
    Code size for the GCC compiler is 36,116 bytes and the execution time for the test case is 4.06 seconds.
    Future revisions will use intrinsic divide for GCC and this divide function for TI.

    static uint64_t divu64(uint64_t n, uint64_t d) { if((n < d) || (!d)) return 0; uint64_t register b = 1; if(((uint16_t)(n >> 48)) & 0x8000) { while(!(((uint16_t)(d >> 48)) & 0x8000)) d <<= 1, b <<= 1; if(n < d) d >>= 1, b >>= 1; } else { d <<= 1; while(n >= d) d <<= 1, b <<= 1; d >>= 1; } uint64_t q = b; n -= d; while(!(b & 1)) { d >>= 1; b >>= 1; if(n >= d) n -= d, q |= b; } return q; } The number of 64 bit divides can be reduced by using constants of 10 to the power of 2 to the power of N rather than iterative division by 10.Code size for the TI compiler is 5,886 bytes and the execution time for the test case is 160 milliseconds.
    Code size for the GCC compiler is 36,256 bytes and the execution time for the test case is 223 milliseconds.

    unsigned d = 2; if(n >= 1000000000000000000ULL) n = divu64(n, 10000000000000000ULL), d += 16; if(n >= 10000000000ULL) n = divu64(n, 100000000ULL), d += 8; if(n >= 1000000ULL) n = divu64(n, 10000ULL), d += 4; if(n >= 10000ULL) n = divu64(n, 100ULL), d += 2; if(n >= 1000ULL) n = divu64(n, 10ULL), ++d; The number of 64 bit divides can be reduced to one by using a table to determine the number of base ten digits. The table is searched for the highest value that is less than or equal to the value to be printed. The value is then divided by the table entry that is 1/100th of the value representing the base ten digit count to reduce the value to 3 digits.Code size for the TI compiler is 5,886 bytes and the execution time for the test case is 143 milliseconds.
    Code size for the GCC compiler is 36,096 bytes and the execution time for the test case is 143 milliseconds.

    static uint64_t const pt[] = { // Powers of 10 // 18446744073709551615 // 2^64 - 1 10000000000000000000ULL, // 10^19 NN.N E 1000000000000000000ULL, // 10^18 N.NN E 100000000000000000ULL, // 10^17 NNN P 10000000000000000ULL, // 10^16 NN.N P 1000000000000000ULL, // 10^15 N.NN P 100000000000000ULL, // 10^14 NNN T 10000000000000ULL, // 10^13 NN.N T 1000000000000ULL, // 10^12 N.NN T 100000000000ULL, // 10^11 NNN G 10000000000ULL, // 10^10 NN.N G // 4294967295 // 2^32 - 1 1000000000ULL, // 10^9 N.NN G 100000000ULL, // 10^8 NNN M 10000000ULL, // 10^7 NN.N M 1000000ULL, // 10^6 N.NN M 100000ULL, // 10^5 NNN k 10000ULL, // 10^4 NN.N k 1000ULL, // 10^3 N.NN k 100ULL, // 10^2 NNN 10ULL, // 10^1 NN 1ULL, // 10^0 N }; unsigned d = 2; if(n >= 1000) { d = 19; uint64_t const *p = pt; while (n < *p) ++p, --d; n = divu64(n, p[2]); } The sprintf() function takes significant space, so it is replaced with decimal to ASCII conversion using the div() library function.Code size for the TI compiler is 1,660 bytes and the execution time for the test case is 25.8 milliseconds.
    Code size for the GCC compiler is 3,384 bytes and the execution time for the test case is 82.0 milliseconds.

    div_t qr; qr.rem = (int)n; div_t const dp = div(d, 3); if(dp.rem == 2) *s++ = ' '; if(qr.rem < 100) { *s++ = ' '; qr.quot = 0; } else { qr = div(qr.rem, 100); *s++ = '0' + qr.quot; } if(dp.rem == 0) *s++ = '.'; if((!qr.quot) && (qr.rem < 10)) { *s++ = ' '; } else { qr = div(qr.rem, 10); *s++ = '0' + qr.quot; } if(dp.rem == 1) *s++ = '.'; *s++ = '0' + qr.rem; *s++ = " kMGTPE"[dp.quot]; *s = 0; The final optimization removes all division. The base ten tables values are used with iterative subtraction to create the ASCII string.Code size for the TI compiler is 1,368 bytes and the execution time for the test case is 10.8 milliseconds.
    Code size for the GCC compiler is 2,452 bytes and the execution time for the test case is 19.9 milliseconds.

    uint64_t const *p = pt + 17; if(n >= 1000) { p = pt; while (n < *p) ++p; } // n += (p[2] >> 1); // optional rounding int dp = p - pt; while (dp > 2) dp -= 3; if (dp == 2) *s++ = ' '; char c; if(n < 100) { c = ' '; } else { c = '0'; while(n >= *p) n -= *p, ++c; } *s = c; ++p; if(dp == 1) *++s = '.'; if((*s == ' ') && (n < 10)) { c = ' '; } else { c = '0'; while(n >= *p) n -= *p, ++c; } *++s = c; ++p; if(dp == 0) *++s = '.'; c = '0'; while (n >= *p) n -= *p, ++c; *++s = c; *++s = " EEPPPTTTGGGMMMkkk "[p - pt]; *++s = 0; Performance summary
    function TI GCC ---------------------------------------------- sprint_u64 1368 10.8 ms 2452 19.9 ms sprint_u64_e 1660 25.8 ms 3384 82.0 ms sprint_u64_d 5886 143 ms 36096 143 ms sprint_u64_c 5886 160 ms 36256 223 ms sprint_u64_b 5666 396 ms 36116 4.06 s sprint_u64_a 5346 3.24 s 36040 981 ms sprint_f3d 20636 1.22 s non-functional Network bandwidth display (lower right) using 3 digits.
     
    Complete code

    #include <msp430.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <stdio.h> #define PU64 sprint_u64 //#define PU64 sprint_u64_e //#define PU64 sprint_u64_d //#define PU64 sprint_u64_c //#define PU64 sprint_u64_b //#define USE_DIV_FUNC //#define PU64 sprint_u64_a //#define PU64 sprint_f3d //#define PU64 sprint_u64_null static void sprint_u64(char *s, uint64_t n) { static uint64_t const pt[] = { // Powers of 10 // 18446744073709551615 // 2^64 - 1 10000000000000000000ULL, // 10^19 NN.N E 1000000000000000000ULL, // 10^18 N.NN E 100000000000000000ULL, // 10^17 NNN P 10000000000000000ULL, // 10^16 NN.N P 1000000000000000ULL, // 10^15 N.NN P 100000000000000ULL, // 10^14 NNN T 10000000000000ULL, // 10^13 NN.N T 1000000000000ULL, // 10^12 N.NN T 100000000000ULL, // 10^11 NNN G 10000000000ULL, // 10^10 NN.N G // 4294967295 // 2^32 - 1 1000000000ULL, // 10^9 N.NN G 100000000ULL, // 10^8 NNN M 10000000ULL, // 10^7 NN.N M 1000000ULL, // 10^6 N.NN M 100000ULL, // 10^5 NNN k 10000ULL, // 10^4 NN.N k 1000ULL, // 10^3 N.NN k 100ULL, // 10^2 NNN 10ULL, // 10^1 NN 1ULL, // 10^0 N }; uint64_t const *p = pt + 17; if(n >= 1000) { p = pt; while (n < *p) ++p; } // n += (p[2] >> 1); // optional rounding int dp = p - pt; while (dp > 2) dp -= 3; if (dp == 2) *s++ = ' '; char c; if(n < 100) { c = ' '; } else { c = '0'; while(n >= *p) n -= *p, ++c; } *s = c; ++p; if(dp == 1) *++s = '.'; if((*s == ' ') && (n < 10)) { c = ' '; } else { c = '0'; while(n >= *p) n -= *p, ++c; } *++s = c; ++p; if(dp == 0) *++s = '.'; c = '0'; while (n >= *p) n -= *p, ++c; *++s = c; *++s = " EEPPPTTTGGGMMMkkk "[p - pt]; *++s = 0; } static uint64_t divu64(uint64_t n, uint64_t d) { #if defined( __GNUC__) & !defined(USE_DIV_FUNC) return n / d; #else if((n < d) || (!d)) return 0; uint64_t register b = 1; if(((uint16_t)(n >> 48)) & 0x8000) { while(!(((uint16_t)(d >> 48)) & 0x8000)) d <<= 1, b <<= 1; if(n < d) d >>= 1, b >>= 1; } else { d <<= 1; while(n >= d) d <<= 1, b <<= 1; d >>= 1; } uint64_t q = b; n -= d; while(!(b & 1)) { d >>= 1; b >>= 1; if(n >= d) n -= d, q |= b; } return q; #endif } static void sprint_u64_e(char *s, uint64_t n) { static uint64_t const pt[] = { // Powers of 10 // 18446744073709551615 // 2^64 - 1 10000000000000000000ULL, // 10^19 NN.N E 1000000000000000000ULL, // 10^18 N.NN E 100000000000000000ULL, // 10^17 NNN P 10000000000000000ULL, // 10^16 NN.N P 1000000000000000ULL, // 10^15 N.NN P 100000000000000ULL, // 10^14 NNN T 10000000000000ULL, // 10^13 NN.N T 1000000000000ULL, // 10^12 N.NN T 100000000000ULL, // 10^11 NNN G 10000000000ULL, // 10^10 NN.N G // 4294967295 // 2^32 - 1 1000000000ULL, // 10^9 N.NN G 100000000ULL, // 10^8 NNN M 10000000ULL, // 10^7 NN.N M 1000000ULL, // 10^6 N.NN M 100000ULL, // 10^5 NNN k 10000ULL, // 10^4 NN.N k 1000ULL, // 10^3 N.NN k 100ULL, // 10^2 NNN 10ULL, // 10^1 NN 1ULL, // 10^0 N }; unsigned d = 2; if(n >= 1000) { d = 19; uint64_t const *p = pt; while (n < *p) ++p, --d; n = divu64(n, p[2]); } div_t qr; qr.rem = (int)n; div_t const dp = div(d, 3); if(dp.rem == 2) *s++ = ' '; if(qr.rem < 100) { *s++ = ' '; qr.quot = 0; } else { qr = div(qr.rem, 100); *s++ = '0' + qr.quot; } if(dp.rem == 0) *s++ = '.'; if((!qr.quot) && (qr.rem < 10)) { *s++ = ' '; } else { qr = div(qr.rem, 10); *s++ = '0' + qr.quot; } if(dp.rem == 1) *s++ = '.'; *s++ = '0' + qr.rem; *s++ = " kMGTPE"[dp.quot]; *s = 0; } static void sprint_u64_d(char *s, uint64_t n) { static uint64_t const pt[] = { // Powers of 10 // 18446744073709551615 // 2^64 - 1 10000000000000000000ULL, // 10^19 NN.N E 1000000000000000000ULL, // 10^18 N.NN E 100000000000000000ULL, // 10^17 NNN P 10000000000000000ULL, // 10^16 NN.N P 1000000000000000ULL, // 10^15 N.NN P 100000000000000ULL, // 10^14 NNN T 10000000000000ULL, // 10^13 NN.N T 1000000000000ULL, // 10^12 N.NN T 100000000000ULL, // 10^11 NNN G 10000000000ULL, // 10^10 NN.N G // 4294967295 // 2^32 - 1 1000000000ULL, // 10^9 N.NN G 100000000ULL, // 10^8 NNN M 10000000ULL, // 10^7 NN.N M 1000000ULL, // 10^6 N.NN M 100000ULL, // 10^5 NNN k 10000ULL, // 10^4 NN.N k 1000ULL, // 10^3 N.NN k 100ULL, // 10^2 NNN 10ULL, // 10^1 NN 1ULL, // 10^0 N }; unsigned d = 2; if(n >= 1000) { d = 19; uint64_t const *p = pt; while (n < *p) ++p, --d; n = divu64(n, p[2]); } div_t qr = div(d, 3); char const u = " kMGTPE"[qr.quot]; switch(qr.rem) { case 0: qr = div((int)n, 100); sprintf(s, "%i.%02i%c", qr.quot, qr.rem, u); break; case 1: qr = div((int)n, 10); sprintf(s, "%2i.%i%c", qr.quot, qr.rem, u); break; case 2: sprintf(s, "%4i%c", (int)n, u); break; } } static void sprint_u64_c(char *s, uint64_t n) { unsigned d = 2; if(n >= 1000000000000000000ULL) n = divu64(n, 10000000000000000ULL), d += 16; if(n >= 10000000000ULL) n = divu64(n, 100000000ULL), d += 8; if(n >= 1000000ULL) n = divu64(n, 10000ULL), d += 4; if(n >= 10000ULL) n = divu64(n, 100ULL), d += 2; if(n >= 1000ULL) n = divu64(n, 10ULL), ++d; div_t qr = div(d, 3); char const u = " kMGTPE"[qr.quot]; switch(qr.rem) { case 0: qr = div((int)n, 100); sprintf(s, "%i.%02i%c", qr.quot, qr.rem, u); break; case 1: qr = div((int)n, 10); sprintf(s, "%2i.%i%c", qr.quot, qr.rem, u); break; case 2: sprintf(s, "%4i%c", (int)n, u); break; } } static void sprint_u64_b(char *s, uint64_t n) { unsigned d = 2; while(n >= 1000) n = divu64(n, 10), ++d; div_t qr = div(d, 3); char const u = " kMGTPE"[qr.quot]; switch(qr.rem) { case 0: qr = div((int)n, 100); sprintf(s, "%i.%02i%c", qr.quot, qr.rem, u); break; case 1: qr = div((int)n, 10); sprintf(s, "%2i.%i%c", qr.quot, qr.rem, u); break; case 2: sprintf(s, "%4i%c", (int)n, u); break; } } static void sprint_u64_a(char *s, uint64_t n) { unsigned d = 2; while(n >= 1000) n /= 10, ++d; div_t qr = div(d, 3); char const u = " kMGTPE"[qr.quot]; switch(qr.rem) { case 0: qr = div((int)n, 100); sprintf(s, "%i.%02i%c", qr.quot, qr.rem, u); break; case 1: qr = div((int)n, 10); sprintf(s, "%2i.%i%c", qr.quot, qr.rem, u); break; case 2: sprintf(s, "%4i%c", (int)n, u); break; } } static void sprint_f3d(char * s, double f) { static char const * const fmt[3] = { "%1.2f%c", "%2.1f%c", "%4.0f%c" }; div_t const d = div((f < 1000.0) ? 2 : (int)log10(f), 3); sprintf(s, fmt[d.rem], f / pow(1000.0, d.quot), " kMGTPEZY"[d.quot]); } static void sprint_u64_null(char *s, uint64_t n) { *s = 0; } static void print(char const *s) { while(*s) { while(!(UCA1IFG & UCTXIFG)); UCA1TXBUF = *s++; } } #define smclk_freq (32768UL * 31UL) // SMCLK frequency in hertz #define bps (9600UL) // Async serial bit rate int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer // P4SEL = BIT4 | BIT5; // Enable UART pins P4DIR = BIT4 | BIT5; // // // Initialize UART UCA1CTL1 = UCSWRST; // Hold USCI in reset to allow configuration UCA1CTL0 = 0; // No parity, LSB first, 8 bits, one stop bit, UART (async) const unsigned long brd = (smclk_freq + (bps >> 1)) / bps; // Bit rate divisor UCA1BR1 = (brd >> 12) & 0xFF; // High byte of whole divisor UCA1BR0 = (brd >> 4) & 0xFF; // Low byte of whole divisor UCA1MCTL = ((brd << 4) & 0xF0) | UCOS16; // Fractional divisor, oversampling mode UCA1CTL1 = UCSSEL_2; // Use SMCLK for bit rate generator, release reset static const uint64_t td[] = { 0ULL, 1ULL, 12ULL, 123ULL, 1234ULL, 12345ULL, 123456ULL, 1234567ULL, 12345678ULL, 123456789ULL, 1234567890ULL, 12345678901ULL, 123456789012ULL, 1234567890123ULL, 12345678901234ULL, 123456789012345ULL, 1234567890123456ULL, 12345678901234567ULL, 123456789012345678ULL, 1234567890123456789ULL, 12345678901234567890ULL, 18446744073709551615ULL }; char s[32]; int n; uint64_t const *p; // Print test array to application UART print("\r\n"); n = sizeof(td) / sizeof(td[0]); p = td; do { PU64(s, *p++); print(s); print("\r\n"); } while(--n); // Time the test array - make string only - do not print TA0EX0 = 7; TA0CTL = TASSEL_2 | ID_3 | MC_2; TA0CTL |= TACLR; n = sizeof(td) / sizeof(td[0]); p = td; do { PU64(s, *p++); } while(--n); uint64_t et = TA0R * 63ULL; // Elapsed time in microseconds PU64(s, et); print(s); print(" us\r\n"); for(;; return 0; }
  3. Like
    roadrunner84 got a reaction from Taggsladder in UART voltage levels question :)   
    The datasheet also has this nice graph that tells you what the maximum frequencies are, given a certain supply voltage.
    If you cannot lower the voltage to the desired operating level for the UART, you could use a logic level converter. You could also use the Vf voltage drop over a diode as a level converter, dropping roughly 0.6 to 0.7 volts per diode in forward setup.
    So if you have a supply of 4V, which is too high for the MSP430, you can use one diode to drop it to about 3.3V, which is enough to power it at even 16MHz.
    Then you need to drop from 3.3V to 2.4, which is again 0.7V, so you can use a single diode in the UART line from the MSP430 tx to the device's rx. Note that since the device will send out UART at 2.8V typically, you should not drop the level there, while it's still high enough to be considered a high level by the msp430. This is true because the datasheet says that worst case 0.75 Vcc is still considered high, 3.3 * 0.75 = 2.475V it's close, but since the current will be really low, so will the voltage drop (it's not really a constant voltage drop).
    So even with worst case parameters, you can play things fine when using only 2 diodes.
  4. Like
    roadrunner84 got a reaction from Taggsladder in UART voltage levels question :)   
    The datasheet also has this nice graph that tells you what the maximum frequencies are, given a certain supply voltage.
    If you cannot lower the voltage to the desired operating level for the UART, you could use a logic level converter. You could also use the Vf voltage drop over a diode as a level converter, dropping roughly 0.6 to 0.7 volts per diode in forward setup.
    So if you have a supply of 4V, which is too high for the MSP430, you can use one diode to drop it to about 3.3V, which is enough to power it at even 16MHz.
    Then you need to drop from 3.3V to 2.4, which is again 0.7V, so you can use a single diode in the UART line from the MSP430 tx to the device's rx. Note that since the device will send out UART at 2.8V typically, you should not drop the level there, while it's still high enough to be considered a high level by the msp430. This is true because the datasheet says that worst case 0.75 Vcc is still considered high, 3.3 * 0.75 = 2.475V it's close, but since the current will be really low, so will the voltage drop (it's not really a constant voltage drop).
    So even with worst case parameters, you can play things fine when using only 2 diodes.
  5. Like
    roadrunner84 got a reaction from Adnan in Implementing WSN   
    You can use <insert favourite IDE> combined with the gnu compiler that is underlying to Energia, it's just a bit more work.
  6. Like
    roadrunner84 got a reaction from Adnan in Implementing WSN   
    Energia is a terrible framework if you want to do serious low power work, just use CCS and plain C code instead of the Sketch framework.
  7. Like
    roadrunner84 got a reaction from nipponbob in Struct, classes and a strange error.   
    If you want to save on memory, how about subclassing your Animation class?
    Depending on your scenarios, you could make Breathe a subclass of Animation, as you could make Rainbow a subclass of Animation. Even better, make Animation a pure virtual class / interface.
    This might make each separate object a little bigger, but if your object does only need the Breathe code, it will not contain the properties / member variables for the Rainbow class. As such, you might save on allocated yet unused memory.
  8. Like
    roadrunner84 got a reaction from RROMANO001 in Mailbag   
    I kind of agree with your wife...
  9. Like
    roadrunner84 got a reaction from nipponbob in Struct, classes and a strange error.   
    I count 48 bytes per class instance, so that would be 96 bytes for the two of them, that should fit I think. Of course, note that other stuff (like your includes) might take RAM space as well!
    One thing that causes me doubt is that you have a global variable FadeDone, which is thus modified by both objects. I don't think that is desirable behaviour. Should the FadeDone boolean be part of the class, or shoud the loop() poll the FadeDone status of either object?
     
    RainbowUpdate() calls ColorSet(), followed by a show(). But ColorSet() itself already calls show(), I think this is unintentional, the more so because BreatheUpdate() does not class show() after ColorSet().
  10. Like
    roadrunner84 got a reaction from spirilis in "Your Ideas are Worthless"   
    personal time, what's that? oh, that stuff I had before I got kids
  11. Like
    roadrunner84 reacted to chicken in [POTM] dAISy - A Simple AIS Receiver   
    History of this project in 14 seconds.

  12. Like
    roadrunner84 got a reaction from spirilis in "Your Ideas are Worthless"   
    personal time, what's that? oh, that stuff I had before I got kids
  13. Like
    roadrunner84 got a reaction from spirilis in "Your Ideas are Worthless"   
    personal time, what's that? oh, that stuff I had before I got kids
  14. Like
    roadrunner84 reacted to abecedarian in Energia AttachInterrupt   
    @@roadrunner84
     
    Same animal; different ways to skin it.
  15. Like
    roadrunner84 got a reaction from abecedarian in Energia AttachInterrupt   
    @@abecedarian yeah, that could be possible too, not what I had in mind though
    One approach is to count timer ticks while a certain line is visible, as you suggest. What I was thinking was to have two timers running, and have one be clocked from the square wave generated by the lines, the other will be internally timed (the watchdog for example). Then when the watchdog triggers, sample the value of the timer that is timed by the lines, and as such you know that, for example, there are 4021 lines per second.
  16. Like
    roadrunner84 got a reaction from gsutton in Enlarging size of Energia as displayed on PC screen   
    Do you mean that the text size is constant to the display, rather than the resolution? You could try changing the font size settings in your Windows Theme (assuming you're running on Windows).
  17. Like
    roadrunner84 got a reaction from energia in Connecting Multiple MSP430G2553 to a Single Computer   
    Is far as I know, you basically CAN'T program multiple launchpads this way using Energia.
    The COM port you select in Energia is just for the console interface, the programming interface is not visible as a COM port. The driver just selects the first FET it finds.
    You could either use a gang programmer, but then you can't use serial, or make one launchpad act as a programming hub, while using the serial interfaces over USB. Note that in such a case you'd have to remove the RESET and TEST jumpers from the slave Launchpads, since you'll be connecting these to the hub using jumper wires.
  18. Like
    roadrunner84 got a reaction from gsutton in Enlarging size of Energia as displayed on PC screen   
    Do you mean that the text size is constant to the display, rather than the resolution? You could try changing the font size settings in your Windows Theme (assuming you're running on Windows).
  19. Like
    roadrunner84 reacted to enl in 220DC dropout   
    There are a bunch of issues here. I'll address a couple.
     
    First is the issue of isolation: In general, it is a good idea to isolate derived low voltage from the high voltage source
     
    Second is regulation: if the target required reasonably well regulated voltage, then some means is needed to ensure he regulation
     
    These lead to the commonly applied options (there are others, but they really shouldn't be implemented by someone that isn't quite conversant with power supply design and safety): Transformer voltage conversion and isolation, followed by regulation.
     
     
    The two traditional methods (over the last 50 years) are to use a transformer to reduce the potential, filter with a capacitor, then use either a linear or a switching regulator to produce the output voltage. Today, there are integrated switching solutions that make this the preferable method for currents greater than maybe half an amp. TI, National, Maxim, and pretty much every other manufacturer of power supply IC's have reference designs for such applications, and these should be implemented directly for reliable service.
     
    Rectification at high voltage (220V, in your case) will produce high, unisolated, voltage (300VDC or more in your case) that requires an experienced designer to safely deal with. DO NOT DO THIS. If you need to ask the question, you are 1) not ready to handle this, and 2) smart enough to realize that you are not yet ready to handle this. Good for asking. There are solutions for HV rectification (and many commercial supplies use them)  but they require good understanding of switching supply design to implement with proper isolation for safety.
     
     
    If I was going to make a recommendation, I would say transformer to 12VAC to 24VAC, rectify and filter (producing about 15 to 17VDC for 12v V or 30 to 34VAC for 24V transformer,with some ripple with the appropriate filter cap) and use a switching reg running at 100KHz or so. I am a few years out of date on this so don't know what the best choice today is. There are several TI options, as well as from other manufacturers. The last time I dealt with this was about 6 years ago, and the design was roughly 500W, converting -38VDC to +12VDC. Used a National 5pin switcher, which required a hand wound toroidal. Design was close to reference design from the data sheet. The topology you are looking for is a buck converter. These can be very efficient, even with low voltage drop, and provide very high current outputs.
     
    I would NOT recommend that you do this without more experience, but if I needed to do this without a transformer, I would use one of the available buck converter IC's designed for high voltage input. They are available, but come with some real risks for damage to equipment or personal injury/death if not imlemented correctly.
     
    EDIT: elaboration last two paragraphs
  20. Like
    roadrunner84 reacted to jpnorair in A new MSP430 coming [MSP432 ARM]   
    The [extremely sophisticated] benchmarks I have will port easily to MSP432 and STM32L4.  Atmel will be later in the year, but I have low hopes for Atmel, and I might not bother.
     
    Warning: Rant ahead.
     
    Anyway, Atmel uses more BS in their datasheet and marketing than TI does, and TI uses *slightly* more than ST.  
    Atmel's marketing numbers are unrealistic, best case figures where all the peripherals are off, the integral DC-DC is running, the chip is running at 12 MHz only, and it is running specially crafted code from a small region of SRAM.  Practically, it does 100uA/MHz.  Look at the datasheet, it's all there, albeit somewhat hidden.  Moreover, it's CM0+, so you really should multiply all figures by 66% to compare to CM4: 100 --> 166. TI's numbers are more honest.  A benchmark library is running from FLASH, the clock is 48 MHz, peripherals are mostly on, but the DC-DC is running with input 3.0V.  TI provides a great amount of information about what the power figures are when running with LDO, and they are still quite good (~160uA/MHz). ST is running Dhrystone benchmarks with all the peripherals going, clock at 80 MHz, code from flash, 128 KB of SRAM active, and there is no DC-DC on the device, so it's just LDO.  112 uA/MHz.  I have to guess they have implemented a mixed-size process with the core at 65nm, because they are a "quantum" ahead of the TI and Atmel offerings. I do wireless IoT, at "low" frequencies (sub 1-GHz), and with low power.  I tend to shun DC-DC converters because they kick up a lot of noise that does affect my radios (I've measured, it can be seriously bad).  It takes a lot of design time to cut-down the noise of DC-DC converters, and it's not always possible (if you can control the switching frequency in software, it's a whole lot better though).  Moreover, the input voltage limit of MSP432 and SAML21 is 3.7 and 3.6V respectively, so IT'S USELESS. It needs to be 4.3V at least, so we can use Li-Ion.  Otherwise, I need to make my own step-down from the Li-Ion, and I'm inclined to use my own DC-DC, with a totally vetted analog design and low EMI, that feeds 1.8V to my system.
     
    I really don't need the M4F, but the truth is that I really do prefer the M3/M4 to the M0+.  M0 is a "red-haired step child."  It doesn't fit into a good standard (it's ARMv6+ vs the gold-standard ARMv7).  Compilers are worse.  It only has 8 registers that can be batched to the stack, whereas all the regs in M3/M4 can be (so threading sucks on M0).  It has a crippled NVIC, and on and on.  Basically, it's a low cost hack.  For low power, you actually do better with M3/M4.  For performance, M3/M4 also.
     
    M4F gives the MSP432 (and STM32L4) a really good entry point into sophisticated signal processing apps.  Hell yeah, we're going to do FFT on these things.  I think it is ridiculously cool to do FFT -- fast -- with 4-8 mA.  Not everyone here realizes the kinds of possibilities this opens-up.  You might not think you need FFT, but the best Reed-Solomon algorithm uses FFT, and RS is awesome for error correction and data integrity in lossy IoT networks.  So it's a completely legit thing to talk about.
     
    I want to reiterate that I only hate Atmel because they make me hate them by being disingenuous.  If they changed their ways, I would have no issue.  I have "no dog in this fight."
     
    Anyway, I can tell you now that any performance difference between MSP432P4 and STM32L4 will almost certainly be outweighed by the difference in the development packages, features, and peripherals.  But I still think it is worth the time to explore all the little things that don't get marketed, which actually do have a huge impact on low-power RTOS functionality.  These will be in the official review, coming sometime in May or June I would guess.
  21. Like
    roadrunner84 got a reaction from ferro in How to set serial protocol SERIAL_8N2: 1 start bit, 8 data bits, 2 stop bits   
    The driver in Energia does not support it, but you can modify the settings of the serial peripheral:
    // some code here Serial.begin() // after this line add: UCA0CTL0 |= UCSPB; // set the flag that sets the serial interface to two stop bits // some more code here
  22. Like
    roadrunner84 got a reaction from morelius21 in methods of burn a msp430   
    The LaunchpadG2 can be used to flash any msp430g2xxx device, the used protocol is SbW then. More advanced MSP430's cannot be flashed with the Launchpad G2.
    Some MSP430's also sport JTAG or a factory flashed bootloader to flash over serial.
  23. Like
    roadrunner84 reacted to bluehash in Anyone interested in the Wi-Fi Camera BoosterPack?   
    I'll take care of that
    Added you to the list.
  24. Like
    roadrunner84 got a reaction from ElectricHorizon in 16 voice wavetable synth/sampler with MSP430G2553   
    @@ElectricHorizon SBW is short for Spy-bi-Wire, TI's in-system/circuit-programming protocol, it's roughly a multiplexed JTAG protocol. SbW requires you to have the two SbW pins and the ground connected, provided your device is self powered.
  25. Like
    roadrunner84 reacted to luligar in Tiva TM4C GPIO pins with "two logic-high states"   
    Hi mgh,
     
    It is indeed an amazing board, specially for the price! Shortly before your reply, I was sifting through these forums and I saw a thread about the 0 Ohm resistors you mentioned. I went back to the flyer and they show the pin pairs that are shorted in the signals diagram, but the resistors themselves, as R9, R10, were not mentioned. Sure enough, I took them out and one of my boards had its PD1 pin taken out , I guess after I tried using the stronger current drivers . On my second board, to my surprise, all 4 pins were fine!
     
    I don't see how to close an issue, if that is even intented in this forum. But I consider it closed and solved. Thanks for your quick and kind reply!
     
    Regards,
    Luis
×