Skip to main content

Topics

This section allows you to view all Topics made by this member. Note that you can only see Topics made in areas you currently have access to.

Topics - dmoisan

1
#twatch network LCD backpack / SNTP Display V1: New Firmware for #twatch
I've rewritten the firmware on my #twatch to implement a simple SNTP display.
[attachment=0]

I've wanted an SNTP display clock for a long time.  I work at a cable TV access facility and time is very important to us.  Commercial NTP displays are very expensive, and until recently, we could not even consider any sort of NTP server.

While the #twatch is not the ideal display I envisioned, it was an excellent first try on my part.  I had to make some simplifications due to the lack of configurability and the limitation of the flash memory in the Microchip controller.  The clock only displays UTC, and in the American format at that.  The display uses the default pool.ntp.org addresses to get its time from;  it's not possible to specify a custom NTP server.  (Both I and my workplace each have a Garmin GPS module and an NTP server, which were, ironically, much cheaper and easier than a display has proven to be!)

Code-wise, I removed Ian's twitter parsing code, and implemented new clock code using the UnixSeconds value that the Microchip stack provides, and the date/time determination code from a Maxim appnote.  I added some routines to Ian's HD44780.c to display zero-filled and space-filled number fields.

In main.c, my code monitors the tick count (and monitors the state of the LCD server) and calls my clock display code once a second.  The clock display code gets the Unix seconds from the stack and does the arithmetic to get the day of year, day of week, month, day, year, hours, minutes and seconds, which are all sent to the LCD (with English abbreviations for month and day.)  Otherwise, main.c is very similar to the #twatch with the addition of some human-readable display state codes.

The LCDTCPServer.c code is nearly as-is--I added some debugging code to display the status of the LCD Server state machine as a single character on the LCD, since I had some trouble with display codes being lost.  (The cause was due to some settings on my managed switch that the module is connected to;  this problem would not be seen on a consumer router.)

I don't have Microchip programming hardware so I depended on the TFTP bootloader.  I used the LCD itself for debugging quite a lot, and did a lot of commenting out until I got a time display that worked and counted.  (The numeric display code proved to be the long pole in the tent.  The LCD Server code was another thing altogether!)

I maintained full compatibility with the Matrix Orbital emulation on the original #twatch.  Since I am in a Windows environment and I am a sysadmin, I wanted to use the LCD emulation in my management software.  I wrote a module in PowerShell that accesses the display and allows scripts to interact with and use the display for notifications.

I fully implemented the MCHP discovery protocol in my Powershell code--I'm proud of that--so that it's not necessary to get the IP display on the #twatch to find its address, though I maintained that function.  In my module, one function will send a MCHP broadcast to the device, get its IP address, and return it to the script as an object to supply to the other modules to clear the LCD, display text, position the cursor and so forth.

I produced a video demonstration, showing the clock and the Powershell display code that runs throughout.
Edit:  Linked at http://http://www.youtube.com/watch?v=X1jNZl8mrMM&feature=player_embedded

I've collected many different dev boards over the years, but this is the first project I've actually gotten to complete.  While my clock doesn't have the big digits I wanted, or the NTP serving capability (that is next), I'm very happy with how it came out.  It looks striking, and would be even more so if I had farmed out the case (I am so not good at mechanical design!)  It's always good to have a first time and get through it--the next time will be easier, no matter what platform I work on!

(BTW, to put a question to rest here:  Heat has not been a problem with my enclosure, which is considerably larger and deeper than the device itself.  The #twatch barely gets warm.  I'm using it with a Phihong 7.5VDC wall plug from Mouser.  I have commerciallly-designed network hardware that you could cook off of!  Why the #twatch is such a hazard and my oven-hot DSL modem isn't, I have no clue...  I'd like Ian to have a talk with the engineers at Westell.)

Link to the firmware and source: http://http://davidcmoisan.wordpress.com/2012/05/22/a-simple-ntp-clock-display/

Thanks, Ian for your hardware design and your helpful advice when I got my device a few months back.
2
#twatch network LCD backpack / Trouble building firmware: .udata_StackTsk.o
I'm trying to build the original firmware (v0e) for the #twatch before I start modifying it.  I cannot get a build.

I get these errors.  I've redacted some banner and informational messages:

[code]MPLAB C18 v3.40 (evaluation)
[...]
C:Microchip Solutions v2011-10-18MicrochipTCPIP StackTCP.c:1454:Warning [2066] type qualifier mismatch in assignment
C:Microchip Solutions v2011-10-18MicrochipTCPIP StackTCP.c:4606:Warning [2066] type qualifier mismatch in assignment
C:Microchip Solutions v2011-10-18MicrochipTCPIP StackTCP.c:4619:Warning [2066] type qualifier mismatch in assignment
[...]
C:UsersdavidmoisanDocumentsdevtwatch-v0emain.c:72:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0emain.c:80:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0emain.c:181:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0emain.c:191:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0emain.c:201:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0emain.c:211:Warning [2066] type qualifier mismatch in assignment
[...]
C:UsersdavidmoisanDocumentsdevtwatch-v0etwatchv1.c:283:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0etwatchv1.c:287:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0etwatchv1.c:530:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0etwatchv1.c:533:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0etwatchv1.c:536:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0etwatchv1.c:538:Warning [2066] type qualifier mismatch in assignment
C:UsersdavidmoisanDocumentsdevtwatch-v0etwatchv1.c:549:Warning [2066] type qualifier mismatch in assignment
[...]
MPLINK 4.40, Linker
Device Database Version 1.3
Copyright (c) 1998-2011 Microchip Technology Inc.
Error - section '.udata_StackTsk.o' can not fit the section. Section '.udata_StackTsk.o' length=0x0000000b
Errors    : 1

Link step failed.

Here is the partial map:

MPLINK 4.40, Linker
Linker Error Map File - Created Sun Nov 13 23:22:21 2011

*Warning* - This is only a partial map file due to a link time error.
  Only sections which were allocated prior to the error are shown below.

CODEPAGES:
    Memory      Start        End              Section    Address Size(Bytes)
 ---------  ---------  ---------            ---------  ---------  ---------
      page    0x0000    0xdbbf          _entry_scn    0x0000    0x0006
                                          highVector    0x0008    0x0006
                                            lowVector    0x0018    0x0006
                                              .cinit    0x001e    0x00c2
                                          .code_TCP.o    0x00e0    0x6016
                                          .code_UDP.o    0x60f6    0x152a
                                    .code_twatchv1.o    0x7620    0x13e4
                                      .code_Helpers.o    0x8a04    0x0fa0
                                        .code_DHCP.o    0x99a4    0x0dec
                                    .code_ETH97J60.o    0xa790    0x0d98
                                          .code_DNS.o    0xb528    0x0d5e
                                        .code_TFTPc.o    0xc286    0x0d34
                                      .code_AutoIP.o    0xcfba    0x0942
                                          .code_ARP.o    0xd8fc    0x0696
                                      .code_HD44780.o    0xdf92    0x0616
                                          BIGINT_CODE    0xe5a8    0x05bc
                                        .code_ICMP.o    0xeb64    0x0546
                                        .code_main.o    0xf0aa    0x04ba
                                          .code_IP.o    0xf564    0x03fc
                                .code_LCDTCPServer.o    0xf960    0x0380
                                    .code_StackTsk.o    0xfce0    0x02c8
                                    .code_Announce.o    0xffa8    0x02be
                                              STRING    0x0266    0x0160
                                        .code_Tick.o    0x03c6    0x0144
                                        .stringtable    0x050a    0x0114
                                          _cinit_scn    0x061e    0x009e
                                      .code_fxm3232.o    0x06bc    0x0070
                                    .code_fxd3232u.o    0x072c    0x0048
                                  .romdata_twatchv1.o    0x0774    0x0041
                                                PROG    0x07b6    0x003c
                                    .code_fxd1616u.o    0x07f2    0x002c
                                                .code    0x081e    0x002c
                                  .romdata_HD44780.o    0x084a    0x0020
                                        _startup_scn    0x086a    0x001c
                                    .code_fxd0808u.o    0x0886    0x001c
                                      .romdata_TCP.o    0x08a2    0x000c

    config    0xfff8    0xfffd .config_1fff8_main.o    0xfff8    0x0001
                                .config_1fffa_main.o    0xfffa    0x0001
                                .config_1fffb_main.o    0xfffb    0x0001
                                .config_1fffd_main.o    0xfffd    0x0001

    devid    0xfffe    0xffff                                         


SHAREBANKS:

DATABANKS:
    Memory      Start        End              Section    Address Size(Bytes)
 ---------  ---------  ---------            ---------  ---------  ---------
      gpr0    0x0060    0x00ff        .udata_UDP.o    0x0060    0x0096

    gpr1b    0x0100    0x027f            TCB_uRAM    0x0100    0x0038

      gpr2    0x0280    0x02ff  SYN_QUEUE_RAM_SECT    0x0280    0x003c
                                        .udata_main.o    0x02bc    0x0033
                                        .udata_ICMP.o    0x02ef    0x0011

      gpr3    0x0300    0x03ff              trends    0x0300    0x00fe

    gpr10    0x0400    0x0c7f              tweets    0x0400    0x086f

    gpr12    0x0c80    0x0cff    .idata_twatchv1.o    0x0c80    0x0031
                                      .udata_AutoIP.o    0x0cb1    0x002f
                                        .udata_DNS.o    0x0ce0    0x0017

    gpr13    0x0d00    0x0dff              .stack    0x0d00    0x0100

    gpr14    0x0e00    0x0e7f      .udata_TFTPc.o    0x0e00    0x0028
                                        .udata_DHCP.o    0x0e28    0x0024
                                        .udata_ARP.o    0x0e4c    0x0014
                                          BIGINT_VARS    0x0e60    0x0013
                                .udata_LCDTCPServer.o    0x0e73    0x000c

    sfr14    0x0e80    0x0eff          SFR_BANKED0    0x0e80    0x0006
                                          SFR_BANKED1    0x0e8a    0x0001
                                          SFR_BANKED2    0x0e97    0x0003
                                          SFR_BANKED3    0x0ea0    0x0001
                                          SFR_BANKED4    0x0ea2    0x0003
                                          SFR_BANKED5    0x0ea6    0x0002
                                          SFR_BANKED6    0x0eaa    0x0002
                                          SFR_BANKED7    0x0eb2    0x0001
                                          SFR_BANKED8    0x0eb4    0x0001
                                          SFR_BANKED9    0x0eb6    0x0004
                                        SFR_BANKED10    0x0ec0    0x0012
                                        SFR_BANKED11    0x0ed4    0x0002
                                        SFR_BANKED12    0x0ed8    0x0002
                                        SFR_BANKED13    0x0ee2    0x0016
                                        SFR_BANKED14    0x0efb    0x0001
                                        SFR_BANKED15    0x0efd    0x0002

    gpr15    0x0f00    0x0f5f        .udata_TCP.o    0x0f00    0x0051
                                        .idata_main.o    0x0f51    0x000f


ACCESSBANKS:
    Memory      Start        End              Section    Address Size(Bytes)
 ---------  ---------  ---------            ---------  ---------  ---------
 accessram    0x0000    0x005f            .tmpdata    0x0000    0x0019
                                            MATH_DATA    0x0019    0x0014

 accesssfr    0x0f60    0x0fff        SFR_UNBANKED0    0x0f60    0x00a0

The text file included with the v0e source says that the stack is 5.0;  the earliest version I can get is 5.21.  This build was attempted with the latest stack (5.36).

What's happening?