Support Engineering Group : Valve Pack Controller This page last changed on Jan 18, 2011 by tm. # Valve Pack Controller Valve Pack Controller: Pressure tolerant hydraulic valve pack controller with ModBus interface for use on Doc Ricketts (Tiburon2) tool sled. ##### Requirements Modbus RTU, 19200 baud. 16 valves (32 solenoids) Max Upto 4 solenoids (valves) on (max) at any given time Valve Manufacturing and Research Co. P/N 9043-2 (20-28vdc, 20 watts) 750 ma continuous at 24vdc Design for 24v DC unregulated input (might be regulated per ECO on Tiburon2 power transformer) 9 in x 4 in max size. 3/4 inch height max Status LEDs on FET outputs RS485 TX RS485 RX MODBUS CRC error Pressure tolerant electonics - 10k tested / 4000m depth. Immersed in Oil. Temperature: -10 degrees C to 85 degrees C Connectors Molex for RS485 / MODBUS Molex for RS232 MODBUS Molex for 2nd serial port RS232 debug Phoenix (green 0.156" screw terminal) for power Both power and comms on one end of the board #### Tasks Hardware Design Design and Schematic Capture [Done] MSP430F169 (has 32 ports and ModBus stack) Low side FET (higher voltage version of FET used on ERC) RS485 using Maxim for ModBus interface RS232 using MAX3222 RS232 for debug and to set ModBus address RS232 as an option for ModBus interface Analog In/Out using TL084 with +/- 12v rails Current monitoring of +24v supply 22uf Tantalum caps for power rail stiffness IR sensor for test Crystal selection (Epson recommended by DMO) SG-304 SG-531PCG SG-636PCE oscillator (ordered) MA-506 xtal (ordered) SG-615PCV Linear Tech LTC6907 Silicon oscillator (resistor set 50Khz - 4Mhz) PCB Layout (in progress start 5/27) Footprints (Thom / Jose) [Done 5/28] Placement (Jose per Thom's physical description) Routing (Jose) 24v trace 6.8A with 10deg C rise in temp (2oz copper, 6 x 80mil http://circuitcalculator.com/wordpress/2006/01/24/trace-resistance-calculator) Checkplot (Thom / Jose) [Done 6/5] PCB Manufacture Advanced Circuits (qty 5/10/20 is $600) [Start 6/6 - expected 6/11, received at 12:50pm on 6/11] Assembly Assembled by Jim Montgomery. Initial build of 2 (received 1st board 12:45pm on 16 June 08 - wahoo!) Board Bringup (Thom) Notes on First board Bringup +24v / GND not visible on to layer silkscreen - 22uF caps have a band on positive that can be used for polarity indicator. Power supply setup for 100ma currrent limit - applied 10v and the PS went into current limit. ADM4073 (current sense) was hot - suspect part in backwards. Removed ADM4073. R272 (0 ohm) was not soldered on one side LM317 voltage setting resitors: R195 should be 1k and R196 should be 100 (backwards on schematic and as stuffed on PCB) 22uF tantalum caps C118, C152 are backwards on the schematic (and PCB layout). Due to cut and paste error on from negative regulator circuit on schematic and rush to layout (no stuff on first rev). ICL7662 is hot and only producing -5v (should be -13.8v or so). Clipped pin 8 (V+) and will diagnose later. LED issue. The "ON" Green LED was not working, voltage to LED was around 3.3v. Removed LED, and reversed it. Still not working. Replaced LED with oposite polarity, now it works. Silkscreen is bad (+ is on the K cathode). LEDs on Coil circuits will be blown if stuffed backwards. For all LEDs: Stuff LED's reverse from silk Blue LEDs (BLINKY1, BLINKY2) are missing the ground. Run a small wire from adjacent LED to ground the cathode on the bottom side of board. TXD and RXD LED's blink too fast during serial comms - not useful as an activity indicator (LEDs are hardwired to RXD and TXD lines). Consider using the Signals for the Blue LEDs to make serial comms activity indicators ADM4073 has sense inputs wired backwards on the schematic and the pcb layout. Swap inputs at the capacitor C153. Replaced SG636 - 3.6848 MHz osc with LTC6097 silicon oscillator (1% resistors used. Fout = 50K / Rset * 4Mhz). For Fout = 3.6864 MHz, Rset = 54.2535Kohm. 53.6K + 665 || 3.01k was used and measured with Tektronix TDS2022B to be 3.68395Mhz with the last digit dithering between 2 and 9. Note: SG636 3.6864MHz oscillator was stuffed and measured to be 3.6862MHz with the same Tektronix scope. Analog checkout TL084 has wrong schematic symbol and incorrect layout. RS485 - one side should be pulled up, the other pulled to ground. For VPC on toolsled, termination will be done off board so no rework required. RS485, RS232 Modified the clock settings for the 3.6848 MHz clock oscillator (was 32khz with FLL/DCO to 4Mhz on Olimex dev board). Port Bits and FETS Working as designed - confirmed LED current of 10ma. Analog Inputs Analog Outputs Populated 10K's with a 100k feedback resistor with expectation of gain = -5. DAC0 Signal passes but attenuated rather than amplified. Found an Schematic error on 2nd opamp (pins 5 and 6 are swapped). Pressure Testing Smoke test 26 June 2008 Ran one cycle to 10000 psi (6600 meters) in approximately 25 minutes with silicon oscillator. Board was powered up and sent modbus commands thru the entire pressure cycle. Note: During the initial pressurization, the PC lost communications. The host side app (modbus poll) was restarted and communication was re-established. It was thought to be due to noise from the pump/solenoid of the pressure vessel. There were no apparent component failures. Note: the reset and test switches were more difficult to activate after being immersed in oil. These will not be stuffed on the deployed version so it's a non-issue but good to know they fail open. A bag of parts was also pressure tested. 10 Cycle test 2 July 2008 - 5 cycles to 6500 psi. Two boards (#1, #2), one with SG636 osc and the other with LTC silicon osc. Board #2 (with SG636) was powered and continuously running vpc-unit-test-master during the pressure test. Both boards verified operational after the test. Note: as before, the switches were crippled likely an effect of the oil on the conductive rubber, the good news is they fail open not short. 10 Cycle test to 6000 psi 2 Aug 2008. Final test of the three boards handed to Dale (Boards #2, #3, #4). Power was not applied to the boards during test. After the test, the boards were all three connected to an RS485 network and continuously cycled using the vpc master unit test program for 1 week before handoff to DMO (Dale). Software Design Develop software on MSP430F169 Eval board from Olimex Leverage ModBus stack previously evaluated by Mike Risi (http://freemodbus.berlios.de) MSP430 CPU and Peripheral Initialization [Done] Modbus stack integration [Done] modify vMBPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable ) to enable RS485 TXEN when transmitter is active (in portserial.c) modify xMBRTUTransmitFSM to post a flag (hackFlg) to disable RS485 TXEN after last byte xmit. Would like to have done it in statemachine but this did not work as the line was de-asserted during last byte xmit. Technique is to post a waitTX flag which then causes a poll for TX complete (TXEPT) to time delay after last byte TX interrupt to insure serial shift of last byte is complete. D/A output [Done] A/D input for current and temperature ModBus Address Configurator (PC Program) to write the slave address into the VPC. Target Flash Write (for programming ModBus Address) ModBus Unit Test program Candidates: WinTech ModScan32: http://www.win-tech.com/html/modscan32.htm.&nbsp;&nbsp;&nbsp; Useful for basic test. Free download is slightly crippled, doesn't run overnight. Modus Poll: http://www.modbustools.com/modbus_poll.asp.&nbsp;&nbsp;&nbsp; "ModBus Poll" Useful for testing ModBus modes, free download expires after 30days and only polls for 10 minutes. $99 for single seat, $299 for site license FieldTalk Modpoll: http://www.focus-sw.com/fieldtalk/modpoll.html.&nbsp;&nbsp;&nbsp; Free command line utility for polling, runs overnight. [Chosen for unit test] LibModBus: https://launchpad.net/libmodbus/. Open source, C language library for linux hosted development. On a linux machine (RHEL 5) expand the tar file: tar xvf libmodbus-2.0.0.tar.tar in vpc/test directory cd to vpc/test/libmodbus-2.0.0 and run ./configure make clean; make What was done (you don't need to) in tests directory, copied unit-test-master.c (from libmodbus-2.0.0/tests directory) and named vpc/test/vpc-unit-test-master.c. Modified and expanded for vpc unit testing. after building libmodbus, copied shared lib libmodbus-2.0.0\modbus\.libs\libmodbus.so.2 to vpc/test For the VPC unit test, in vpc/test, type make to build. This will produce a vpc-unit-test-master executable. to Run the test, ./vpc-unit-test-master (on a linux box with RS232 cable connected to ttyS0 and B&B RS232 to RS485 adapter) Slave address is 1, baud rate is 19200, etc. recompile to change. ToDo: Find out why invalid address on reading input register. Reading holding registers is the workaround as these are the same coil values as would be read by input registers. To Do List [Complete] RS485 termination. VPC pullup is 3.3v. Need to check if Tiburon interface is providing the pullup. RS485 termination removed from the VPC. [Complete] TX and RX LED activity indicators. Modified (ECO) the circuit to provide +3.3v to the Anode and pulled down the cathode - DMO approved. Analog Input for Hall Effect (will result in a resettable count for cable payout indicator) [Complete] The 2 development boards have been pressure tested, need to pressure test the remaining boards. All boards have been cycled 10 times to 6000 psi. Order parts (22uF tantalum caps) Slave Address Setter Utility (for writing ModBus slave address thru the spare serial port). Updated plan to use Hyperterminal rather than write a utility. Order solder paste stencil and evaluate using stencils to speed assembly time [Complete] Depopulate switches as they are damaged by the oil [Complete] Scribe the board serial number - currently done on ground fill top side near the 'test' switch (SW2) above Coil 2B silk Build 4 more boards for DMO - 2 for Dale, 2 for Craig Dawe. Quote from Indtec is 0.20 to 0.25 per component. Component count is 499 Updated BOM for 'no analog' build Working with Jim Montgomery on the package. ECO List for Rev 1.0 PCB Valve Pack Controller "No Analog Build" ECO's: LED silk screen is wrong. + is not Anode, but rather Cathode. Action is to stuff LED's reverse from the silk. Action for Jose to fix the PCB component. LED's SP1 and SP2 (Blinky1 and Blinky2) require a ground wire be added to the cathode. A small gauge wire can be routed from the cathode of I/O ERR LED on the bottom side across the cathode of SP1 and SP2. LEDs for TXD and RXD are on at idle. Modification is to stuff the LED's cathodes per the silkscreen (backwards) and tie the anodes together (not stuffed in the hole) and tie with wire wrap wire to +3.3v (board edge side of C10) C118 and C152 need to be stuffed opposite of the silkscreen (silkscreen is backwards). R195 is 1K and R196 is 100 (schematic error has the values swapped). The BOM spreadsheet is correct, the schematic (v1.0) is incorrect. RS485 Termination is incorrect. Should be a pull up and a pull down. R204 should be a pull down (un verified). #### #### Miscellaneous uart calculator: http://mspgcc.sourceforge.net/baudrate.html this program license is at: http://www.fsf.org/licenses/licenses.html#GPL this program is distributed WITHOUT ANY WARRANTY clock: 3686400Hz desired baud rate: 19200bps division factor: 192 effective baud rate: 19200bps maximum error: 0us 0.00% time table (microseconds): event desired effective error error% startbit->D0 52.08 52.08 +0 +0.00 D0->D1 104.17 104.17 +0 +0.00 D1->D2 156.25 156.25 +0 +0.00 D2->D3 208.33 208.33 +0 +0.00 D3->D4 260.42 260.42 +0 +0.00 D4->D5 312.50 312.50 +0 +0.00 D5->D6 364.58 364.58 +0 +0.00 D6->D7 416.67 416.67 +0 +0.00 D7->stopbit 468.75 468.75 +0 +0.00 end of stopb 520.83 520.83 +0 +0.00 */ UBR00=0xC0; UBR10=0x00; UMCTL0=0x00; /* uart0 3686400Hz 19200bps */ UBR01=0xC0; UBR11=0x00; UMCTL1=0x00; /* uart1 3686400Hz 19200bps */ #### The simplest way to use the USART in UART mode is this: interrupt is not enabled, the software checks if it can output the next byte (UTXIFG = 1), and if a new character has been received (URXIFG = 1). #### Modbus Register Map REG_INPUT_START 512 // input registers start at 512 REG_INPUT_NREGS 8 // 8x16 bit registers REG_SOLENOIDS_A 0 // Holding registers start at 0 (16 coils for each A and B) REG_SOLENOIDS_B 1 REG_HOLDING_START 0 // to match WAGO REG_HOLDING_NREGS 40 // 40 is more than actual (2) REG_COILS_START 0 // read individual coils (was 1000) REG_COILS_SIZE 32 // 32 coils REG_DISC_START 0 // discrete (was 1000) REG_DISC_SIZE 32 // 32 coils ### MODBUS Commands Read Input Register (0x04) Read Holding Registers (0x03) Write Single Register (0x06) Write Multiple Registers (0x10) Read/Write Multiple Registers (0x17) Read Coils (0x01) Write Single Coil (0x05) Write Multiple Coils (0x0F) Read Discrete Inputs (0x02) Report Slave ID (0x11) Address Slave ID Berlios ModBus Stack The modbus stack is config'd in mbconfig.h which is located in vpc\modbus\include ### Debugging MSP430 #### Starting gdbproxy The next step is starting gdbproxy, which is responsible for the communication between GDB and the FET: msp430-gdbproxy --port=2000 msp430 If your FET is properly connected to the parallel port, you should see a message like the following: info: msp430: Target device is a 'MSP430F12x' (type 11) notice: msp430-gdbproxy: waiting on TCP port 2000 #### Using Insight (Windows) After you have started Insight (c:\msp430\bin\msp430-gdb.exe), click on "File->Open" and select the elf-file (e.g. "test.elf") you want to debug. Now click on "Run->Connect to target" and enter the following settings: Target: "Remote/TCP" Hostname: "localhost" Port: "2000" Set breakpoint at 'main': yes Set breakpoint at 'exit': yes Attach to target: yes Download Program: yes Command after attaching: "monitor erase all" Run Method: Continue from last Stop When you click on "Ok" Insight should tell you that the connection was successful, and gdbproxy should say "notice: msp430-gdbproxy: connected". To start the debugging click on "Run" or simply press "r". If everything worked correctly you should now see the sourcecode of your program with the first line of main() marked green. The red point is the breakpoint that has been set by Insight automatically. You can set or remove breakpoints by clicking on the '-' in front of the line. Now you can 'c'ontinue the execution to the next breakpoint, 's'tep through the code, or step a single assembler instruction... but be careful with "finish": Insight sometimes seems to lock up with this command. So if you want to finish a function, I recommend setting a breakpoint to the end of the function and using "continue". ## Installing the Compiler Tool Chain To obtain and install the compiler: Go to the MSPGCC download page and obtain the latest MSPGCC installation. I used the 'mspgcc-20040723.exe' download which installed everything I needed for a Win32 setup. This step need only be performed if you wish to use the graphical version of GDB. The latest MSPGCC download only includes the command line GDB debugger. I prefer to use the graphical version called Insight. A slightly older prebuilt version of Insight can be used. Install this older version of insight into a different directory to that chosen for the latest MSPGCC installation as you don't want to overwrite the files obtained in step 1. You should now have two installations. The latest version of MSPGCC installed during step 1, and a slightly older version of Insight from step 2. Both versions of the GDB debugger are called msp430-gdb.exe so one needs to be renamed. Locate the older version msp430-gdb.exe from the files installed during this step and rename it msp430-insight.exe. Ensure the BIN directory from the files installed during step 1 and the BIN directory from the files installed during step 2 are included in your PATH environment variable. The MSPGCC download includes a program called msp430-gdbproxy.exe. This intercepts the GDB TCP commands and redirects them to the parallel port. Start msp430-gdbproxy (a shortcut to this will have been placed on the start menu when MSPGCC was installed). By default msp430-gdbproxy uses port 3333 - do not change this. Program the flash as per the instruction in the section above. The flash can be programmed from within GDB but it is much faster to do it separately and beforehand. Start the debugger using the command ... msp430-insight a.out... the commands in the gdb.ini file will do the rest. If you prefer to use the command line debugger simply replace msp430-insight with msp430-gdb. Insight will start at and the program will stop at the breakpoint in main() as shown below. MSP430 Clocking MSP430 Basic Clock Module Clock Signals: ACLK: Auxiliary clock. The signal is sourced from LFXT1CLK with a divider of 1, 2, 4, or 8. (The calibration program for the serial link sets the divider to 4, but after the calibration it can be changed to any other values.) ACLK can be used as the clock signal for Timer A and Timer B. MCLK: Master clock. The signal can be sourced from LFXT1CLK, XT2CLK (if available), or DCOCLK with a divider of 1, 2, 4, or 8. MCLK is used by the CPU and system. SMCLK: Sub-main clock. The signal is sourced from either XT2CLK (if available), or DCOCLK with a divider of 1, 2, 4, or 8. SMCLK can be used as the clock signal for Timer A and Timer B. MSP430 Clocking pictorial: Attachments: PI_MBUS_300.pdf (application/pdf) freemodbus-v1.4.0.zip (application/x-zip-compressed) modscan32.zip (application/x-zip-compressed) 10020116_REV1-0_VPC_CORE_ENG BILL OF MATERIALS_ASM1.xls (application/octet-stream) MSP430_clocking.JPG (image/pjpeg) MSP430_clocking2.JPG (image/pjpeg) MSP430_BCSCTL1.JPG (image/pjpeg) MSP430_BCSCTL2.JPG (image/pjpeg)

Document generated by Confluence on Feb 03, 2026 16:22