<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://e-mode.phas.ubc.ca/mcewiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mhasse</id>
	<title>MCEWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://e-mode.phas.ubc.ca/mcewiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mhasse"/>
	<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php/Special:Contributions/Mhasse"/>
	<updated>2026-05-22T07:57:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.16</generator>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Template:MCE_hardware_table&amp;diff=7154</id>
		<title>Template:MCE hardware table</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Template:MCE_hardware_table&amp;diff=7154"/>
		<updated>2022-03-23T23:34:42Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: Fix PDF link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Component&lt;br /&gt;
! Type{{#if: {{{obsolete|}}}|/Part}}&lt;br /&gt;
! Doc. Id&lt;br /&gt;
! Technical&amp;lt;br/&amp;gt;Description&amp;lt;sup&amp;gt;&amp;amp;dagger;&amp;lt;/sup&amp;gt;&lt;br /&gt;
! Block&amp;lt;BR/&amp;gt;Diagram&amp;lt;sup&amp;gt;&amp;amp;dagger;&amp;lt;/sup&amp;gt;&lt;br /&gt;
! Schematics&lt;br /&gt;
! Rev.&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[Clock Card]]&lt;br /&gt;
| S581&lt;br /&gt;
| [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/CC_TechDescr.pdf PDF]]&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/board_block_diagram/cc_bd.pdf PDF]]&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Clock%20Card%20RevB/SC2-ELE-S581-101_RevB5_CC_Schematics.pdf PDF]]&lt;br /&gt;
| B5&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; rowspan=&amp;quot;2&amp;quot; | [[Readout Card]]&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | S582&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/SC2_ELE_S582_501_readout_card_description.pdf PDF]]&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/board_block_diagram/rc_bd.pdf PDF]]&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Readout%20Card%20RevB/RO_S582_101BIss9_Schematic.pdf PDF]]&lt;br /&gt;
| B9&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Readout%20Card%20RevE/RC_C582_101E0_Schematic.pdf PDF]]&lt;br /&gt;
| E0&lt;br /&gt;
| Low-power RC&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; rowspan=&amp;quot;9&amp;quot; | [[Bias Card]]&lt;br /&gt;
| rowspan=&amp;quot;9&amp;quot; | S583&lt;br /&gt;
| rowspan=&amp;quot;9&amp;quot; | [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/SC2_ELE_S583_501_bias_card_description.pdf PDF]]&lt;br /&gt;
| rowspan=&amp;quot;9&amp;quot; | [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/board_block_diagram/bc_bd.pdf PDF]]&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Bias%20Card%20RevD/BC_S583_101DIss6_Schematics.pdf PDF]]&lt;br /&gt;
| D6&lt;br /&gt;
| Original design&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Bias%20Card%20RevD/SC2-ELE-S583-101-RevDIss7&amp;amp;8_BiasCard_Schematics.pdf PDF]]&lt;br /&gt;
| D7/8&lt;br /&gt;
| High-current det_bias&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Bias%20Card%20RevD/SC2-ELE-S583-101D10_D11_BC_Schematic.PDF PDF]]&lt;br /&gt;
| D11&lt;br /&gt;
| High-current det_bias/no heater&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Bias%20Card%20RevE/BC_ELE_C583_101E0_Schematic.pdf PDF]]&lt;br /&gt;
| E0&lt;br /&gt;
| Multiple det_bias lines&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Bias%20Card%20RevF/ELE-C583-101F_BiasCard_Schematic.PDF PDF]]&lt;br /&gt;
| F0&lt;br /&gt;
| Multi det_bias &amp;amp; MHz-response bias lines; Low-noise bias lines turned off&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Bias%20Card%20RevF/ELE-C583-101F1_BiasCard_Schematic.PDF PDF]]&lt;br /&gt;
| F1&lt;br /&gt;
| Power turned off on ln_bias&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Bias%20Card%20RevF/ELE-C583-101F2_BiasCard_Schematic.PDF PDF]]&lt;br /&gt;
| F2&lt;br /&gt;
| Minor change in ln_bias circuit&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Bias%20Card%20RevF/ELE-C583-101F3_BiasCard_Schematic.PDF PDF]]&lt;br /&gt;
| F3&lt;br /&gt;
| low 1/f-noise opamp for channel 0-15&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Bias%20Card%20RevF/ELE-C583-101F4_BiasCard_Schematic.PDF PDF]]&lt;br /&gt;
| F4&lt;br /&gt;
| low 1/f-noise opamp for channel 15-31&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; rowspan=&amp;quot;2&amp;quot; | [[Address Card]]&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | S584&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/AC_TechDescr.pdf PDF]]&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/board_block_diagram/ac_bd.pdf PDF]]&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Address%20Card%20RevC/AC_S584_101CIss4_Schematics.pdf PDF]]&lt;br /&gt;
| C4&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Address%20Card%20RevD/AC_S584_101_RevDIss0_Schematics.pdf PDF]]&lt;br /&gt;
| D0&lt;br /&gt;
|&lt;br /&gt;
{{#if: {{{obsolete|}}}|&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} rowspan=&amp;quot;6&amp;quot; {{!}} [[Instrument Backplane]]&lt;br /&gt;
{{!}} rowspan=&amp;quot;2&amp;quot; {{!}} MCEv1&lt;br /&gt;
{{!}} rowspan=&amp;quot;2&amp;quot; {{!}} S587-101&lt;br /&gt;
{{!}} rowspan=&amp;quot;6&amp;quot; {{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/instr_backplane_descr.pdf PDF]]&lt;br /&gt;
{{!}} rowspan=&amp;quot;2&amp;quot; {{!}} &amp;amp;mdash;&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Instrument%20Backplane%20RevC/S587-101_Inst_Backplane_Schematics.pdf PDF]]&lt;br /&gt;
{{!}} C3&lt;br /&gt;
{{!}} Obsolete&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Instrument%20Backplane%20RevC/S587-101CI5_Inst_Backplane_Schematics.pdf PDF]]&lt;br /&gt;
{{!}} C5&lt;br /&gt;
{{!}}&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{#if: {{{obsolete|}}}||&lt;br /&gt;
{{!}} rowspan=&amp;quot;4&amp;quot; {{!}} [[Instrument Backplane]]&lt;br /&gt;
}}&lt;br /&gt;
| {{#if: {{{obsolete|}}}|MCEv2}} 5MDM&lt;br /&gt;
| C587-201&lt;br /&gt;
{{#if: {{{obsolete|}}}||&lt;br /&gt;
{{!}} rowspan=&amp;quot;4&amp;quot; {{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/instr_backplane_descr.pdf PDF]]&lt;br /&gt;
}}&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/mceV2_InstrumentBackplane/ELE_C587-201_RevA0_Inst_Backplane_Schematics.pdf PDF]]&lt;br /&gt;
| A&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; | {{#if: {{{obsolete|}}}|MCEv2}} 3MDM &lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; | C587-101&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; | [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/board_block_diagram/ELE-C580-100_MCEv2_Instrument_Bus_Block_Diagram.pdf PDF]]&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/mceV2_InstrumentBackplane/ELE-C587-101_RevB_Inst_Backplane_Schematic.pdf PDF]]&lt;br /&gt;
| B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/mceV2_InstrumentBackplane/ELE-C587-101_RevC1_3MDM_Inst_Backplane_Schematics.pdf PDF]]&lt;br /&gt;
| C1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/mceV2_InstrumentBackplane/ELE-C587-101_RevC2_3MDM_Inst_Backplane_Schematics.pdf PDF]]&lt;br /&gt;
| C2&lt;br /&gt;
|&lt;br /&gt;
{{#if: {{{obsolete|}}}|&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} [[Bus Backplane]]&lt;br /&gt;
{{!}} MCEv1&lt;br /&gt;
{{!}} S586&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/bus_backplane_descr.pdf PDF]]&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/Firmware_block_spec/atc_blkdia/fw_blkdia/Subrack.pdf PDF]]&lt;br /&gt;
{{!}} &amp;amp;mdash;&lt;br /&gt;
{{!}} C&lt;br /&gt;
{{!}} Obsolete&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{#if: {{{obsolete|}}}||&lt;br /&gt;
{{!}} rowspan=&amp;quot;2&amp;quot; {{!}} [[Bus Backplane]]&lt;br /&gt;
}}&lt;br /&gt;
| {{#if: {{{obsolete|}}}|MCEv2}} 3MDM&lt;br /&gt;
| C586-101&lt;br /&gt;
{{#if: {{{obsolete|}}}||&lt;br /&gt;
{{!}} rowspan=&amp;quot;2&amp;quot; {{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/bus_backplane_descr.pdf PDF]]&lt;br /&gt;
}}&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/mceV2_BusBackplane_RevD/ELE-C586-101_BusBP_Schematic%20Prints.pdf PDF]]&lt;br /&gt;
| A&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| {{#if: {{{obsolete|}}}|MCEv2}} 5MDM&lt;br /&gt;
| C586-201&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/mceV2_BusBackplane_RevD/ELE-C586-201_RevD0_BusBp_Schematics.pdf PDF]]&lt;br /&gt;
| D&lt;br /&gt;
| &lt;br /&gt;
{{#if: {{{obsolete|}}}|&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} [[Filter Board]]&lt;br /&gt;
{{!}} MCEv1&lt;br /&gt;
{{!}} S587-111&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} &amp;amp;mdash;&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} &amp;amp;mdash;&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/Filter%20Board/FB_S587_111BIss2_Schematics.pdf PDF]]&lt;br /&gt;
{{!}} B2&lt;br /&gt;
{{!}} Obsolete&lt;br /&gt;
}}&lt;br /&gt;
|-&lt;br /&gt;
{{#if: {{{obsolete|}}}||&lt;br /&gt;
{{!}} rowspan=&amp;quot;2&amp;quot; {{!}} [[Filter Board]]&lt;br /&gt;
}}&lt;br /&gt;
| {{#if: {{{obsolete|}}}|MCEv2}} 3MDM&lt;br /&gt;
| C587-111&lt;br /&gt;
{{#if: {{{obsolete|}}}||&lt;br /&gt;
{{!}} rowspan=&amp;quot;2&amp;quot; {{!}} &amp;amp;mdash;&lt;br /&gt;
{{!}} rowspan=&amp;quot;2&amp;quot; {{!}} &amp;amp;mdash;&lt;br /&gt;
}}&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/mceV2_Filter_Board/ELE-C587-111_Filter_Schematic.pdf PDF]]&lt;br /&gt;
| A&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| {{#if: {{{obsolete|}}}|MCEv2}} 5MDM&lt;br /&gt;
| C587-210&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/mceV2_Filter_Board/ELE-C587-210_Filter_Schematics.pdf PDF]]&lt;br /&gt;
| A&lt;br /&gt;
|&lt;br /&gt;
{{#if: {{{obsolete|}}}|&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} [[Power Supply Assembly]]&lt;br /&gt;
{{!}} [[PSU]]&lt;br /&gt;
{{!}} S585-103&lt;br /&gt;
{{!}} &amp;amp;mdash;&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/SCUBA-2%20Power%20Supply%20Specification%20Aug-26-2005%20JM%20WH.doc DOC]]&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/PowerSupplyUnit/PSU_S585_103B_20060502_schematics.pdf PDF]]&lt;br /&gt;
{{!}} B&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} Obsolete&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} [[PSUC]]&lt;br /&gt;
{{!}} S585-102&lt;br /&gt;
{{!}} &amp;amp;mdash;&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/PowerSupplyController/PSUC%20S585_102GIss8%20Schematic.pdf PDF]]&lt;br /&gt;
{{!}} G8&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} Wiring&lt;br /&gt;
{{!}} S585-104&lt;br /&gt;
{{!}} &amp;amp;mdash;&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/documentation/schematics_pcb/SC2-ELE-S585-104_RevB_PSA_Wiring_Diagram.pdf PDF]]&lt;br /&gt;
{{!}} B&lt;br /&gt;
}}&lt;br /&gt;
|}&lt;br /&gt;
'''&amp;lt;sup&amp;gt;&amp;amp;dagger;&amp;lt;/sup&amp;gt;''': Not updated since early design stages.&lt;br /&gt;
&lt;br /&gt;
=== External Hardware and Accessories ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Component&lt;br /&gt;
! Part&lt;br /&gt;
! Doc. Id&lt;br /&gt;
! Technical&amp;lt;br/&amp;gt;Description&amp;lt;sup&amp;gt;&amp;amp;dagger;&amp;lt;/sup&amp;gt;&lt;br /&gt;
! Block&amp;lt;BR/&amp;gt;Diagram&lt;br /&gt;
! Schematics&lt;br /&gt;
! Rev.&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[MDM Breakout Board]]&lt;br /&gt;
| S58H&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/MDM%20Pinout/SubrackIB-TestPinouts1b_Rev2.1.xls XLS]]&lt;br /&gt;
| B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[Linear Feed Card]]&lt;br /&gt;
| C585-104&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/PLA/Linear_PS_MCE_Adaptor-ELE-C585-104_RevB.pdf PDF]]&lt;br /&gt;
| B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | [[Vicor Power Assembly]]&lt;br /&gt;
| PCB&lt;br /&gt;
| C585-401&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/PowerSupplyVicor/ELE_C585-401_RevC2_VicorPSU_Schematics.pdf PDF]]&lt;br /&gt;
| C2&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| Wiring Harness&lt;br /&gt;
| C584-402&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/PowerSupplyVicor/ELE-C584-402_RevA_Wiring_Harness.pdf PDF]]&lt;br /&gt;
| A&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;4&amp;quot; | [[Sync Box]]&lt;br /&gt;
| PCB&lt;br /&gt;
| S589-101&lt;br /&gt;
| rowspan=&amp;quot;4&amp;quot; | [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf PDF]]&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/SyncBox/SC2-ELE-S589-101_RevA2_SyncGen_Schematics.pdf PDF]]&lt;br /&gt;
| A2&lt;br /&gt;
| Used in both Sync Box enclosures&lt;br /&gt;
|-&lt;br /&gt;
| AC-in: Internal Wiring&lt;br /&gt;
| S589-102&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/board_block_diagram/S589-001_Syncbox_Block_Diagram.pdf PDF]]&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/SyncBox/S589-102_SyncBox_Wiring_Diagram.pdf PDF]]&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | A2&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| AC-in: Cable Wiring&lt;br /&gt;
| S589-103&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/SyncBox/S589-103_SyncBox_IO_Cable_Wiring.pdf PDF]]&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| DC-in: Internal Wiring&lt;br /&gt;
| C589-102&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/board_block_diagram/ELE-C589-101B_DC-In_Sync_Blk_Diagram.pdf PDF]]&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/SyncBox/ELE-C589-102_Sync_Box_Connector_Pinouts.pdf PDF]]&lt;br /&gt;
| A&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[PCI fibre card]]&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/others/SDSU/250hzPCI_schematic.pdf PDF]]&lt;br /&gt;
| 5A&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[Extender Card]]&lt;br /&gt;
| S565-008&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/ext_card_descr.pdf PDF]]&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/ExtenderCard/extender_card_sc2_ele_s58A_101B PDF]]&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[IB Tester]]&lt;br /&gt;
| S58E-502&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/tech_description/sc2-ele-s58e-502_gpib_ib_tester_description.pdf PDF]]&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/IB%20Tester/ELE-S58E-101C_GPIB_IB_Tester_Schmatics.pdf PDF]]&lt;br /&gt;
| C&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; rowspan=&amp;quot;2&amp;quot; | [[2-slot Backplane]]&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | S58G&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/2slot_bp/SC2_ELE_S58G_101.pdf PDF]]&lt;br /&gt;
| A&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| &amp;amp;mdash;&lt;br /&gt;
| [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/2slot_bp/2-slot_bp_SC2_ELE_S565_101_RevB0.pdf PDF]]&lt;br /&gt;
| B&lt;br /&gt;
|&lt;br /&gt;
{{#if: {{{obsolete|}}}|&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} colspan=&amp;quot;2&amp;quot; {{!}} SCUBA2 24V Power Distribution&lt;br /&gt;
{{!}} S565-010&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/pdrdocs/24v_ps_descr.pdf PDF]]&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/board_block_diagram/24v_pwr_distr.pdf PDF]]&lt;br /&gt;
{{!}} &amp;amp;mdash;&lt;br /&gt;
{{!}}&lt;br /&gt;
{{!}} Obsolete&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} [[AC-DC Unit]] &lt;br /&gt;
{{!}} Rectifier Board&lt;br /&gt;
{{!}} S588-103&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/PowerSupplyUnit/SCUBA-2%20Power%20Supply%20Specification%20Aug-26-2005%20JM%20WH.doc DOC]]&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} &amp;amp;mdash;&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/acdcu/S588_103A_acdcu_rect_%28051128gf%29.pdf PDF]]&lt;br /&gt;
{{!}} A&lt;br /&gt;
{{!}} rowspan=&amp;quot;3&amp;quot; {{!}} Obsolete&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} Controller Board&lt;br /&gt;
{{!}} S588-104&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/acdcu/S588_104A_acdcu_cntrl_%28060719gf%29.pdf PDF]]&lt;br /&gt;
{{!}} A&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}} Wiring&lt;br /&gt;
{{!}} S588-105&lt;br /&gt;
{{!}} [[http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/acdcu/S588_105A_acdcu_wiring_%28060719gf%29.pdf PDF]]&lt;br /&gt;
{{!}} A&lt;br /&gt;
}}&lt;br /&gt;
|}&lt;br /&gt;
'''&amp;lt;sup&amp;gt;&amp;amp;dagger;&amp;lt;/sup&amp;gt;''': Not updated since early design stages.&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
This template contains the hardware document table.  It comes in two flavours:&lt;br /&gt;
&lt;br /&gt;
== Modern ==&lt;br /&gt;
  &amp;amp;#123;&amp;amp;#123;MCE hardware table}}&lt;br /&gt;
&lt;br /&gt;
is used on [[MCE hardware]] and produces:&lt;br /&gt;
{{MCE hardware table}}&lt;br /&gt;
&lt;br /&gt;
== Legacy ==&lt;br /&gt;
  &amp;amp;#123;&amp;amp;#123;MCE hardware table{{!}}obsolete=yes}}&lt;br /&gt;
is used on [[Old MCE Documents]] and produces:&lt;br /&gt;
{{MCE hardware table|obsolete=yes}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Main_Page&amp;diff=7116</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Main_Page&amp;diff=7116"/>
		<updated>2020-04-21T12:05:17Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This Wiki is for users of UBC's '''Multi-Channel Electronics''' (MCE), including the '''MCE Acquisition Software''' (MAS).&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== MCE Overview ==&lt;br /&gt;
The MCE described here borrows heavily from the designs used at [http://www.nist.gov/pml/ NIST]. Changes have been made to upgrade components, achieve higher integration, and match to the specific experimental configurations.&lt;br /&gt;
&lt;br /&gt;
In basic operation, one MCE [[subrack]] controls the SQUID amplifiers and multiplexer, and reads signals from one 32×41 pixel or 16×41 pixel sub-array. The system hardware is completely modular at the sub-array level. Each sub-array is connected via woven cryogenic cables to a single MCE subrack through 3 or 5 MDM connectors. Each MCE subrack is, in turn, connected by an optical fibre to a single data-acquisition PC running Linux and data-acquisition software ([[MAS]]) developed at UBC.&lt;br /&gt;
 &lt;br /&gt;
Each MCE consists of hybrid analog/digital hardware and firmware developed for [https://www.altera.com/ Altera] [https://www.altera.com/products/fpga/stratix-series.html Stratix FPGAs]. A subrack has up to nine cards: including 2 or 4 [[Readout card]]s each of which reads 8 output columns through 14-bit 50MHz ADCs; 1 [[address card]] to multiplex the first-stage SQUIDs biases at around 20kHz; 1 [[clock card]] to interpret commands and to synchronize all the cards using a 25MHz clock; 2 or 3 [[bias card]]s to control the SQUID series-array feedback, the second-stage SQUID bias and feedback as well as the bolometer bias and heater. During [[auto_setup|detector setup]], the MCE is used to calculate the optimal operating points for the bolometers and the SQUID amplifiers by measuring their characteristics using open and closed feedback loops. During observation, MCE uses a running PID-calculation to determine the first-stage SQUID feedback necessary to keep the whole amplification chain in a linear regime.&lt;br /&gt;
&lt;br /&gt;
In conjunction with the MCEs, a [[Sync Box]] supplies data-valid pulses with serial numbers to all MCE subracks and to the telescope pointing system. This allows synchronization between the data acquisition, the pointing system, and the telescope housekeeping.&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
&lt;br /&gt;
* [[ MCE hardware | MCE Hardware ]] - information on MCE hardware (and accessories)&lt;br /&gt;
* [[ MCE firmware | MCE Firmware ]] - firmware versions, features, and tools (including sync box and PCI card firmware)&lt;br /&gt;
* [[ MAS ]] - the MCE Acquisition Software - kernel driver and low-level tools&lt;br /&gt;
* [[ MCE script ]] - SQUID array setup programs&lt;br /&gt;
* [[ MCE usage ]] - practical usage and reference documents&lt;br /&gt;
* [[Publications]] - technical publications relating to the Multi-Channel Electronics&lt;br /&gt;
&lt;br /&gt;
== Contact Info ==&lt;br /&gt;
&lt;br /&gt;
The '''&amp;lt;code&amp;gt;[[mce-announce]]&amp;lt;/code&amp;gt;''' e-mail list is used to communicate important firmware and software updates to the MCE user community.  See the [[mce-announce]] page for details on how to subscribe.&lt;br /&gt;
&lt;br /&gt;
 MCE Lab:                   604-822-2585&lt;br /&gt;
 Halpern's Lab:             604-822-6709&lt;br /&gt;
 &lt;br /&gt;
 Hardware:         mandana at phas.ubc.ca, halpern at phas.ubc.ca&lt;br /&gt;
 Firmware:         mandana at phas.ubc.ca&lt;br /&gt;
 Software:         mhasselfield at flatironinstitute.org, dvw at phas.ubc.ca&lt;br /&gt;
  &lt;br /&gt;
 Department of Physics &amp;amp; Astronomy &lt;br /&gt;
 University of British Columbia&lt;br /&gt;
 6224 Agricultural Rd, Room 204&lt;br /&gt;
 Vancouver, BC V6T 1Z1 &lt;br /&gt;
 Canada&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_Firmware_Upgrade_using_dfu-programmer&amp;diff=6899</id>
		<title>Sync Box Firmware Upgrade using dfu-programmer</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_Firmware_Upgrade_using_dfu-programmer&amp;diff=6899"/>
		<updated>2017-05-04T15:46:19Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Related|Sync Box Firmware}}&lt;br /&gt;
This describes how to upgrade [[Sync Box Firmware]] using the free &amp;lt;tt&amp;gt;dfu-programmer&amp;lt;/tt&amp;gt; on linux.  This only applies to the microprocessor; often it is also necessary to upgrade the CPLD.&lt;br /&gt;
__TOC__&lt;br /&gt;
== Installation ==&lt;br /&gt;
The dfu-programmer software can be installed in Ubuntu like this:&lt;br /&gt;
 sudo apt-get install dfu-programmer&lt;br /&gt;
&lt;br /&gt;
Make sure your version supports the sync box device (&amp;lt;tt&amp;gt;at89c5131&amp;lt;/tt&amp;gt;):&lt;br /&gt;
 &lt;br /&gt;
 $ dfu-programmer --version&lt;br /&gt;
 dfu-programmer 0.6.1&lt;br /&gt;
 $ dfu-programmer --targets&lt;br /&gt;
 targets:&lt;br /&gt;
    at89c51snd1c       at89c51snd2c       at89c5130          '''at89c5131'''&lt;br /&gt;
    at89c5132          at90usb1287        at90usb1286        at90usb1287-4k&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
See [[Sync Box firmware#Enabling reprogramming over USB|the procedure on the Sync Box firmware page]] for instructions on how to get the bootloader to enter reprogramming mode.  This will cause it to present itself as a USB device to your computer.  When the device is properly detected, it will show up in &amp;lt;tt&amp;gt;lsusb&amp;lt;/tt&amp;gt; as something like:&lt;br /&gt;
 $ lsusb&lt;br /&gt;
 Bus 002 Device 049: ID 03eb:2ffd Atmel Corp. at89c5130/c5131 DFU bootloader&lt;br /&gt;
&lt;br /&gt;
In some versions of dfu-programmer, you must specify the USB bus and device address (2 and 49, respectively, in this example) along with the part name.  In others, you must not specify that information.  So the address will either look like &amp;quot;at89c5131&amp;quot; or &amp;quot;at89c5131:2,49&amp;quot;.  The latter syntax is assumed below.&lt;br /&gt;
&lt;br /&gt;
To prove things are working, dump the contents of the device into a file:&lt;br /&gt;
&lt;br /&gt;
 $ sudo dfu-programmer at89c5131:''&amp;lt;USB_BUS&amp;gt;'',''&amp;lt;USB_DEVNUM&amp;gt;'' dump &amp;gt; part_dump.bin&lt;br /&gt;
&lt;br /&gt;
where ''&amp;lt;USB_BUS&amp;gt;'' is the bus number from &amp;lt;tt&amp;gt;lsusb&amp;lt;/tt&amp;gt; and ''&amp;lt;USB_DEVNUM&amp;gt;'' is the device number from &amp;lt;tt&amp;gt;lsusb&amp;lt;/tt&amp;gt;. For the example &amp;lt;tt&amp;gt;lsusb&amp;lt;/tt&amp;gt; output above, this would give us:&lt;br /&gt;
&lt;br /&gt;
 $ sudo dfu-programmer at89c5131:2,49 dump &amp;gt; ./part_dump.bin&lt;br /&gt;
&lt;br /&gt;
The contents of part_dump.bin can then be inspected with &amp;lt;tt&amp;gt;hexdump -C ./part_dump.bin&amp;lt;/tt&amp;gt; to confirm it's the sync box code and not some other nonsense.  (It's also good to keep a copy of the previous program; if the new program doesn't work, you can always revert.)&lt;br /&gt;
&lt;br /&gt;
Then to program the device the syntax is:&lt;br /&gt;
 $ sudo dfu-programmer at89c5131:''&amp;lt;USB_BUS&amp;gt;'',''&amp;lt;USB_DEVNUM&amp;gt;'' flash ./sync_box_v22_26sept2014.hex&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://dfu-programmer.github.io/ dfu-programmer on github]&lt;br /&gt;
&lt;br /&gt;
[[Category:Sync Box Firmware]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_firmware&amp;diff=6898</id>
		<title>Sync Box firmware</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_firmware&amp;diff=6898"/>
		<updated>2017-05-04T15:44:08Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Related|Sync Box Firmware}}&lt;br /&gt;
There is an Altera CPLD (EPM570T144C3) and an Atmel micro-controller (AT89C51) on in the [[Sync Box]].&lt;br /&gt;
* SyncBox CPLD Firmware Description [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/SyncBox/SyncBox_FwDescr_S589_201.pdf PDF]] (SC2-ELE-S589-201)&lt;br /&gt;
* SyncBox Microcontroller Software Description [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/SyncBox/SyncBox_SWDescr_S589_202.pdf PDF]] (SC2-ELE-S589-202)&lt;br /&gt;
&lt;br /&gt;
Consequently, there are two sets of firmware:&lt;br /&gt;
*firmware for the CPLD part (*.pof file)&lt;br /&gt;
*firmware for the microcontroller (*.hex file)&lt;br /&gt;
&lt;br /&gt;
== Firmware Upgrade Instructions ==&lt;br /&gt;
=== Downloads ===&lt;br /&gt;
&lt;br /&gt;
Firmware is available from the MCE firmware repository:&lt;br /&gt;
&lt;br /&gt;
* http://e-mode.phas.ubc.ca/mce_firmware/sync_box&lt;br /&gt;
&lt;br /&gt;
To upgrade the Sync Box firmware, ''most times'' both the microcontroller and the CPLD firmware need to be reprogrammed.&lt;br /&gt;
&lt;br /&gt;
=== CPLD programming (&amp;lt;tt&amp;gt;.pof&amp;lt;/tt&amp;gt; file) ===&lt;br /&gt;
The CPLD firmware can be loaded using the Altera USB-Blaster that connects to the on-board P23 JTAG header, and Quartus Programmer software. A &amp;lt;tt&amp;gt;.pof&amp;lt;/tt&amp;gt; file needs to be loaded.  The P23 connector is not wired out to the sync box enclosure.  To access it, remove the sync box cover plate.&lt;br /&gt;
&lt;br /&gt;
=== Microcontroller programming (&amp;lt;tt&amp;gt;.hex&amp;lt;/tt&amp;gt; file) ===&lt;br /&gt;
The microcontroller program is loaded over a USB cable that connects your computer to the on-board J1 (USB-B) connector.  This connector is not wired out to the sync box enclosure: to access it, remove the top cover.  In the past we used Atmel's [http://www.atmel.com/tools/FLIP.aspx Flip Programmer].  Now we recommend running &amp;lt;tt&amp;gt;dfu-programmer&amp;lt;/tt&amp;gt; on linux.  See:&lt;br /&gt;
* [[Sync Box Firmware Upgrade using dfu-programmer]].&lt;br /&gt;
&lt;br /&gt;
==== Enabling reprogramming over USB ====&lt;br /&gt;
Regardless of what you use to program the sync box, you need to get the sync box bootloader to restart in reprogramming mode.  To do this, the procedure is:&lt;br /&gt;
# Start with the sync box powered off and disconnected from USB&lt;br /&gt;
# Depress ''both'' the on-board RESET switch and the PS_EN switch.  Both switches are located next to the USB J1 connector on the board.&lt;br /&gt;
# Power on the sync box.  The PS_EN switch may be labeled as PRG_EN.&lt;br /&gt;
# Release the RESET switch&lt;br /&gt;
# Release the PS_EN switch&lt;br /&gt;
# Plug in the USB cable&lt;br /&gt;
If this procedure is successfully performed, the sync box will present itself as a USB device to your computer.  Your computer should now detect the sync box as an Atmel AT89C5131 device.  If the sync box isn't accepting USB protocol commands, turn it off and try the procedure again.&lt;br /&gt;
&lt;br /&gt;
== Releases ==&lt;br /&gt;
&lt;br /&gt;
=== Firmware set Rev. 31 ===&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v31_21Jun2016.hex&lt;br /&gt;
: sync_box_v31_21Jun2016.pof&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: The two banks of Manchester outputs can now be configured independently.  This permits up to 4 MCEs to share one timing configuration, while up to 4 other MCEs share a second timing configuration.&lt;br /&gt;
: The microprocessor's on-board EEPROM can be used to load and save configurations.  A preferred configuration can be loaded &amp;quot;on startup&amp;quot;, so there is no need for per-experiment defaults.&lt;br /&gt;
&lt;br /&gt;
; Notes&lt;br /&gt;
: The firmware version is not reported by the serial interface.  Subsequent versions will report the version, so if you see the &amp;quot;eeprom&amp;quot; menu but no version number then you're probably looking at v31!&lt;br /&gt;
&lt;br /&gt;
=== Firmware set Rev. 30 ===&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: The microprocessor code has been ported to the sdcc compiler.  There are no changes in behaviour.  This code should continue to work with CPLD code from version 1f.&lt;br /&gt;
&lt;br /&gt;
=== Firmware set Rev. 22 ===&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v22_26sep2014.hex&lt;br /&gt;
: no change to cpld code&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: Sync Box default values are set for ACT values: fr=38, num_rows=33, row_len=50&lt;br /&gt;
&lt;br /&gt;
=== Firmware set Rev. 21 ===&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v21_02sep2014.pof&lt;br /&gt;
: no change to microcontroller code or *.hex file&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: DV_FTS and DV_POL are now duplicate copies of DV_SPARE1 and DV_SPARE2, respectively. See [http://e-mode.phas.ubc.ca/mcewiki/index.php/Sync_Box_AC-in_Rack_Mount_io IO for rackmount AC-in Sync Box]&lt;br /&gt;
&lt;br /&gt;
=== Firmware set Rev. 20 ===&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v20_22aug2013.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: hard-coded Spider values of fr=120, num_rows=33, row_len=53 (which translates to row_len=106 on mce front)&lt;br /&gt;
: firmware revision on rs232 interface now shows 20&lt;br /&gt;
=== Firmware set Rev. 1f ===&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v1f_25feb2010.pof&lt;br /&gt;
: sync_box_v1f_25feb2010.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: adds a ckd command to the rs232 interface to adjust the frequency of DV_Spare1 and DV_Spare2 by setting a 50MHz divisor through the command.&lt;br /&gt;
: when you turn on the sync box, the firmware revision 1f appears on the rs232 terminal&lt;br /&gt;
&lt;br /&gt;
=== Firmware set Rev. 1e (6e?) ===&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v6e_11aug2008.pof&lt;br /&gt;
: sync_box_v1c_17nov2006.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: added a 50MHz clock on SMA output of the Sync box&lt;br /&gt;
&lt;br /&gt;
; Note&lt;br /&gt;
: Since the microcontroller code is still 1c and that is what is reported in rs232 terminal, there is no way to identify this set from a 1c set.&lt;br /&gt;
&lt;br /&gt;
=== Firmware set Rev. 1c ===&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v6c_19oct2006.pof&lt;br /&gt;
: sync_box_v1c_17nov2006.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
original firmware&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
The sync box source (both CPLD and Atmel code) is available in the &amp;lt;tt&amp;gt;sync_box&amp;lt;/tt&amp;gt; project in the [[UBC SVN repository]].  So, something like this might work:&lt;br /&gt;
&lt;br /&gt;
 svn checkout --username=mceanon svn://e-mode.phas.ubc.ca/sync_box/trunk sync_box&lt;br /&gt;
&lt;br /&gt;
[[Category:Sync Box Firmware| ]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_firmware&amp;diff=6249</id>
		<title>Sync Box firmware</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_firmware&amp;diff=6249"/>
		<updated>2016-06-25T17:04:35Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Firmware set Rev. 31 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
There is an Altera CPLD (EPM570T144C3) and an Atmel micro-controller (AT89C51) on the Sync board. &lt;br /&gt;
* SyncBox CPLD Firmware Description [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/SyncBox/SyncBox_FwDescr_S589_201.pdf PDF]] (SC2-ELE-S589-201)&lt;br /&gt;
* SyncBox Microcontroller Software Description [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/SyncBox/SyncBox_SWDescr_S589_202.pdf PDF]] (SC2-ELE-S589-202)&lt;br /&gt;
&lt;br /&gt;
Consequently, there are two sets of firmware:&lt;br /&gt;
*firmware for the CPLD part (*.pof file)&lt;br /&gt;
*firmware for the microcontroller (*.hex file)&lt;br /&gt;
&lt;br /&gt;
= Firmware Upgrade Instructions =&lt;br /&gt;
To upgrade the Sync Box firmware,''most times'' both the microcontroller and the CPLD firmware need to be reprogrammed.&lt;br /&gt;
&lt;br /&gt;
The CPLD firmware can be loaded using the Altera USB-Blaster that connects to the on-board P23 JTAG header, and Quartus Programmer software. A *.pof file needs to be loaded.&lt;br /&gt;
&lt;br /&gt;
The micro-controller firmware can be loaded using a USB cable that connects to the on-board J1 connector, and [http://www.atmel.com/tools/FLIP.aspx Flip] Programmer software available from Atmel website. A *.hex file needs to be loaded.  Alternately, see if you can use free software dfu-programmer on linux: [[Sync Box Firmware Upgrade using dfu-programmer]].&lt;br /&gt;
&lt;br /&gt;
For more details, see section 9 in: [http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf Sync Box User's Guide]&lt;br /&gt;
&lt;br /&gt;
''Note: I had to install Flip on 3 computers before I could get the USB driver to work!''&lt;br /&gt;
&lt;br /&gt;
[http://e-mode.phas.ubc.ca/mce_firmware/ Firmware .hex &amp;amp; .pof Downloads]&lt;br /&gt;
&lt;br /&gt;
= Revisions =&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 31''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v31_21Jun2016.hex&lt;br /&gt;
: sync_box_v31_21Jun2016.pof&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: The two banks of Manchester outputs can now be configured independently.  This permits up to 4 MCEs to share one timing configuration, while up to 4 other MCEs share a second timing configuration.&lt;br /&gt;
: The microprocessor's on-board EEPROM can be used to load and save configurations.  A preferred configuration can be loaded &amp;quot;on startup&amp;quot;, so there is no need for per-experiment defaults.&lt;br /&gt;
&lt;br /&gt;
; Notes&lt;br /&gt;
: The firmware version is not reported by the serial interface.  Subsequent versions will report the version, so if you see the &amp;quot;eeprom&amp;quot; menu but no version number then you're probably looking at v31!&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 30''' ==&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: The microprocessor code has been ported to the sdcc compiler.  There are no changes in behaviour.  This code should continue to work with CPLD code from version 1f.&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 22''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v22_26sep2014.hex&lt;br /&gt;
: no change to cpld code&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: Sync Box default values are set for ACT values: fr=38, num_rows=33, row_len=50&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 21''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v21_02sep2014.pof&lt;br /&gt;
: no change to microcontroller code or *.hex file&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: DV_FTS and DV_POL are now duplicate copies of DV_SPARE1 and DV_SPARE2, respectively. See [http://e-mode.phas.ubc.ca/mcewiki/index.php/Sync_Box_AC-in_Rack_Mount_io IO for rackmount AC-in Sync Box]&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 20''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v20_22aug2013.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: hard-coded Spider values of fr=120, num_rows=33, row_len=53 (which translates to row_len=106 on mce front)&lt;br /&gt;
: firmware revision on rs232 interface now shows 20&lt;br /&gt;
== '''Firmware set Rev. 1f''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v1f_25feb2010.pof&lt;br /&gt;
: sync_box_v1f_25feb2010.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: adds a ckd command to the rs232 interface to adjust the frequency of DV_Spare1 and DV_Spare2 by setting a 50MHz divisor through the command.&lt;br /&gt;
: when you turn on the sync box, the firmware revision 1f appears on the rs232 terminal&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 1e (6e?)''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v6e_11aug2008.pof&lt;br /&gt;
: sync_box_v1c_17nov2006.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: added a 50MHz clock on SMA output of the Sync box&lt;br /&gt;
&lt;br /&gt;
; Note&lt;br /&gt;
: Since the microcontroller code is still 1c and that is what is reported in rs232 terminal, there is no way to identify this set from a 1c set.&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 1c''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v6c_19oct2006.pof&lt;br /&gt;
: sync_box_v1c_17nov2006.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
original firmware&lt;br /&gt;
&lt;br /&gt;
= Source code =&lt;br /&gt;
The sync box source (both CPLD and Atmel code) is available in the &amp;lt;tt&amp;gt;sync_box&amp;lt;/tt&amp;gt; project in the [[UBC SVN repository]].  So, something like this might work:&lt;br /&gt;
&lt;br /&gt;
 svn checkout --username=mceanon svn://e-mode.phas.ubc.ca/sync_box/trunk sync_box&lt;br /&gt;
&lt;br /&gt;
[[Category:Firmware]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_firmware&amp;diff=6242</id>
		<title>Sync Box firmware</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_firmware&amp;diff=6242"/>
		<updated>2016-06-21T17:49:19Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
There is an Altera CPLD (EPM570T144C3) and an Atmel micro-controller (AT89C51) on the Sync board. &lt;br /&gt;
* SyncBox CPLD Firmware Description [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/SyncBox/SyncBox_FwDescr_S589_201.pdf PDF]] (SC2-ELE-S589-201)&lt;br /&gt;
* SyncBox Microcontroller Software Description [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/SyncBox/SyncBox_SWDescr_S589_202.pdf PDF]] (SC2-ELE-S589-202)&lt;br /&gt;
&lt;br /&gt;
Consequently, there are two sets of firmware:&lt;br /&gt;
*firmware for the CPLD part (*.pof file)&lt;br /&gt;
*firmware for the microcontroller (*.hex file)&lt;br /&gt;
&lt;br /&gt;
= Firmware Upgrade Instructions =&lt;br /&gt;
To upgrade the Sync Box firmware,''most times'' both the microcontroller and the CPLD firmware need to be reprogrammed.&lt;br /&gt;
&lt;br /&gt;
The CPLD firmware can be loaded using the Altera USB-Blaster that connects to the on-board P23 JTAG header, and Quartus Programmer software. A *.pof file needs to be loaded.&lt;br /&gt;
&lt;br /&gt;
The micro-controller firmware can be loaded using a USB cable that connects to the on-board J1 connector, and [http://www.atmel.com/tools/FLIP.aspx Flip] Programmer software available from Atmel website. A *.hex file needs to be loaded.  Alternately, see if you can use free software dfu-programmer on linux: [[Sync Box Firmware Upgrade using dfu-programmer]].&lt;br /&gt;
&lt;br /&gt;
For more details, see section 9 in: [http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf Sync Box User's Guide]&lt;br /&gt;
&lt;br /&gt;
''Note: I had to install Flip on 3 computers before I could get the USB driver to work!''&lt;br /&gt;
&lt;br /&gt;
[http://e-mode.phas.ubc.ca/mce_firmware/ Firmware .hex &amp;amp; .pof Downloads]&lt;br /&gt;
&lt;br /&gt;
= Revisions =&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 31''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v31_21Jun2016.hex&lt;br /&gt;
: sync_box_v31_21Jun2016.pof&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: The two banks of Manchester outputs can now be configured independently.  This permits up to 4 MCEs to share one timing configuration, while up to 4 other MCEs share a second timing configuration.&lt;br /&gt;
: The microprocessor's on-board EEPROM can be used to load and save configurations.  A preferred configuration can be loaded &amp;quot;on startup&amp;quot;, so there is no need for per-experiment defaults.&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 30''' ==&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: The microprocessor code has been ported to the sdcc compiler.  There are no changes in behaviour.  This code should continue to work with CPLD code from version 1f.&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 22''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v22_26sep2014.hex&lt;br /&gt;
: no change to cpld code&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: Sync Box default values are set for ACT values: fr=38, num_rows=33, row_len=50&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 21''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v21_02sep2014.pof&lt;br /&gt;
: no change to microcontroller code or *.hex file&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: DV_FTS and DV_POL are now duplicate copies of DV_SPARE1 and DV_SPARE2, respectively. See [http://e-mode.phas.ubc.ca/mcewiki/index.php/Sync_Box_AC-in_Rack_Mount_io IO for rackmount AC-in Sync Box]&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 20''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v20_22aug2013.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: hard-coded Spider values of fr=120, num_rows=33, row_len=53 (which translates to row_len=106 on mce front)&lt;br /&gt;
: firmware revision on rs232 interface now shows 20&lt;br /&gt;
== '''Firmware set Rev. 1f''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v1f_25feb2010.pof&lt;br /&gt;
: sync_box_v1f_25feb2010.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: adds a ckd command to the rs232 interface to adjust the frequency of DV_Spare1 and DV_Spare2 by setting a 50MHz divisor through the command.&lt;br /&gt;
: when you turn on the sync box, the firmware revision 1f appears on the rs232 terminal&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 1e (6e?)''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v6e_11aug2008.pof&lt;br /&gt;
: sync_box_v1c_17nov2006.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: added a 50MHz clock on SMA output of the Sync box&lt;br /&gt;
&lt;br /&gt;
; Note&lt;br /&gt;
: Since the microcontroller code is still 1c and that is what is reported in rs232 terminal, there is no way to identify this set from a 1c set.&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 1c''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v6c_19oct2006.pof&lt;br /&gt;
: sync_box_v1c_17nov2006.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
original firmware&lt;br /&gt;
&lt;br /&gt;
= Source code =&lt;br /&gt;
The sync box source (both CPLD and Atmel code) is available in the &amp;lt;tt&amp;gt;sync_box&amp;lt;/tt&amp;gt; project in the [[UBC SVN repository]].  So, something like this might work:&lt;br /&gt;
&lt;br /&gt;
 svn checkout --username=mceanon svn://e-mode.phas.ubc.ca/sync_box/trunk sync_box&lt;br /&gt;
&lt;br /&gt;
[[Category:Firmware]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Mce_cmd&amp;diff=6212</id>
		<title>Mce cmd</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Mce_cmd&amp;diff=6212"/>
		<updated>2016-05-05T01:32:30Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
'''mce_cmd''' provides an interface between a Linux shell and the MCE.  The application can run interactively (accepting commands from a user and issuing responses to stdout), or can be used to execute scripts containing mce_cmd instructions.&lt;br /&gt;
&lt;br /&gt;
= Running mce_cmd =&lt;br /&gt;
&lt;br /&gt;
== Usage summary ==&lt;br /&gt;
&lt;br /&gt;
 mce_cmd [options] [-x cmd...]&lt;br /&gt;
 &lt;br /&gt;
  -i                     interactive mode, don't exit on errors&lt;br /&gt;
  -q                     quiet mode, only print errors or output data&lt;br /&gt;
  -p                     prefix-supression, don't print line number&lt;br /&gt;
  -e                     echo mode, print each command as well as response&lt;br /&gt;
  -r                     don't use readline on stdin (faster input in scripts)&lt;br /&gt;
 &lt;br /&gt;
  -n &amp;lt;card number&amp;gt;       use the specified fibre card ([[Multicard MAS]] only)&lt;br /&gt;
  -c &amp;lt;file&amp;gt;              choose a particular mce config file (mce.cfg)&lt;br /&gt;
  -m &amp;lt;file&amp;gt;              choose a particular MAS config file (mas.cfg)&lt;br /&gt;
  -f &amp;lt;batch file&amp;gt;        run commands from file instead of stdin&lt;br /&gt;
  -X &amp;quot;cmd string&amp;quot;        execute this command and exit (these can be stacked)&lt;br /&gt;
  -o &amp;lt;directory&amp;gt;         data file path&lt;br /&gt;
 &lt;br /&gt;
  -x &amp;lt;command&amp;gt;           execute remainder of line as an mce_cmd command&lt;br /&gt;
                         The -X command may be more useful as it allows multiple&lt;br /&gt;
                         commands to be executed, e.g.&lt;br /&gt;
                              mce_cmd -X &amp;quot;acq_config test_1 rc1&amp;quot; -X &amp;quot;acq_go 100&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  -v                     print version string and exit&lt;br /&gt;
&lt;br /&gt;
== Interactive mode ==&lt;br /&gt;
&lt;br /&gt;
When invoked with the '-i' option, mce_cmd can be used interactively.  A session command history (similar to the one in bash) can be accessed with the up and down arrow keys, and line editing is possible using emacs-based key-mappings.&lt;br /&gt;
 mce_cmd -i&lt;br /&gt;
&lt;br /&gt;
After displaying a version message, mce_cmd will be ready to accept input.  There is no user prompt.&lt;br /&gt;
&lt;br /&gt;
== Single command execution ==&lt;br /&gt;
&lt;br /&gt;
A single command can be issued using the '-x' option:&lt;br /&gt;
 mce_cmd -x rb cc {{param||fw_rev}}&lt;br /&gt;
The application will execute the command, display any output, and exit.&lt;br /&gt;
&lt;br /&gt;
Multiple commands may be executed with the '-X' option.  The commands are executed in order, in the same context.  The command must be passed as a single shell argument (put it in quotes...):&lt;br /&gt;
 mce_cmd -X &amp;quot;wb rc1 {{param|rc|data_mode}} 4&amp;quot; -X &amp;quot;wb rca {{param|rc|servo_mode}} 1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Script execution ==&lt;br /&gt;
&lt;br /&gt;
The '-f' option tell mce_cmd to read lines from the specified file and attempt to execute them.  The '-q' option suppresses unnecessary output.&lt;br /&gt;
 mce_cmd -q -f my_script.scr&lt;br /&gt;
&lt;br /&gt;
When redirecting commands to mce_cmd, the '-r' option should be used to disable the command history/line editing features of mce_cmd and decrease the execution time.&lt;br /&gt;
 cat my_script.scr | mce_cmd -q -r&lt;br /&gt;
&lt;br /&gt;
If a script command fails, mce_cmd will exit.  To suppress that behaviour (and continue attempting commands even after one of them has failed), pass the '-i' option.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Commands =&lt;br /&gt;
&lt;br /&gt;
We can break the mce_cmd command set into three broad categories: MCE commands, data acquisition commands, and output formatting commands.  Commands are case insensitive.&lt;br /&gt;
&lt;br /&gt;
== Special hardware commands ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;MCE_RESET&amp;quot;&amp;gt;&lt;br /&gt;
=== MCE_RESET: reset the MCE firmware using special character override ===&lt;br /&gt;
&lt;br /&gt;
The '''mce_reset''' command causes the PCI card to transmit a special character (0x0b) over the fibre-optic connection to the MCE. This command was originally invented to clear the cmd/reply path when either of fibre or backplane communication is frozen.  A tiny sniffer block in clock-card of the MCE detects this special character and asserts the mce_bclr line, which subsequently resets (only) the firmware on each MCE card.&lt;br /&gt;
&lt;br /&gt;
Upon firmware reset, all state machines go to idle, register-based variables are reset to 0, but RAM-based variables stay unchanged. A firmware reset does '''not''' refresh the DAC outputs. Note that after an '''mce_reset''', not all of the DAC outputs are set to zero.&lt;br /&gt;
&lt;br /&gt;
'''mce_reset''' may lead to misleading information from [[mce_status]], and '''rb''' commands in general.  For example, &amp;lt;code&amp;gt;flux_fb&amp;lt;/code&amp;gt;s are stored in registers which are overwritten by zero upon '''mce_reset'''.  But '''mce_reset''' does not cause a rewrite of the DAC outputs.  So, after a reset, '''rb flux_fb''' will report zero even if the actual flux_fb being applied is not zero.  Other registers, such as &amp;lt;code&amp;gt;servo_mode&amp;lt;/code&amp;gt;, which get reset, ''do'' affect the operation of MCE.  Registers can only reinitialised by rewriting them (via a '''wb''' command).  In gerenal, a &amp;lt;code&amp;gt;mce_reconfig&amp;lt;/code&amp;gt; is recommended after '''mce_reset''' to ensure the system is properly configured.&lt;br /&gt;
&lt;br /&gt;
It is advisable to wait several microseconds following the '''mce_reset''' command before issuing other MCE commands. &lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 mce_reset&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;DSP_RESET&amp;quot;&amp;gt;&lt;br /&gt;
=== DSP_RESET: reset the PCI card DSP firmware ===&lt;br /&gt;
&lt;br /&gt;
The '''dsp_reset''' command causes the PCI card to reset.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 dsp_reset&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Special driver access commands ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;FAKESTOP&amp;quot;&amp;gt;&lt;br /&gt;
=== FAKESTOP: cause the driver to issue a stop-frame ===&lt;br /&gt;
&lt;br /&gt;
In some cases an acquisition can hang because it has not received as many frames as it expected, and did not see a frame with the STOP bit set.  The '''fakestop''' command triggers the driver to generate one or two data frames and place them in the output buffer.  The last such frame will have the STOP bit set.  An mce_cmd session that is acquiring data will receive the frame, see the STOP bit, and exit.&lt;br /&gt;
&lt;br /&gt;
Note that in the absence of a data consumer, this command will leave frames outstanding in the data buffer.  It is prudent to issue an '''empty''' command after issuing '''fakestop'''.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 fakestop&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;EMPTY&amp;quot;&amp;gt;&lt;br /&gt;
=== EMPTY: cause the driver to empty the output data buffer ===&lt;br /&gt;
&lt;br /&gt;
In some cases, following a failed acquisition, the output data buffer of the driver may contain residual data.  This can lead to the failure of subsequent acquisitions.  The '''empty''' command causes the driver to update its pointers such that no data is retained.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 empty&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;FRAME&amp;quot;&amp;gt;&lt;br /&gt;
=== FRAME: set driver and PCI card frame-data size ===&lt;br /&gt;
&lt;br /&gt;
To acquire data without an associated data handler (to write the data to disk), it is necessary to inform the driver and PCI card of the expected frame size.  This is accomplished by passing the frame size, in 32-bit words, to the command '''frame'''.  If data acquisition is triggered (with the low-level '''go''' command, for example), and the driver/PCI card have not been informed of the frame size, the PCI card will simply discard the data.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 frame &amp;lt;int&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Scripting and output formatting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;SLEEP&amp;quot;&amp;gt;&lt;br /&gt;
=== SLEEP: delay execution for some number of microseconds ===&lt;br /&gt;
&lt;br /&gt;
Note that the delays smaller than a few milliseconds cannot be commanded reliably.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 sleep &amp;lt;microseconds&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;DISPLAY&amp;quot;&amp;gt;&lt;br /&gt;
=== DISPLAY: change integer output base ===&lt;br /&gt;
&lt;br /&gt;
The output from MCE read commands is displayed in decimal or hex, depending on the mce.cfg configuration.  To override this, decimal ('''dec''') or hexadecimal ('''hex''') output can be forced with the '''display''' command.  Passing '''def''' will return mce_cmd to its default behaviour.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 display [ def | dec | hex ]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ECHO&amp;quot;&amp;gt;&lt;br /&gt;
=== ECHO: echo commands to the terminal ===&lt;br /&gt;
&lt;br /&gt;
In some scripting situations it may be useful to have commands echoed to the terminal along with their responses.  This can be turned on and off by passing 1 or 0 to the '''echo''' command.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 echo [ 0 | 1 ]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MCE data block commands ==&lt;br /&gt;
&lt;br /&gt;
MCE configuration data is stored in blocks at certain card and parameter addresses (which we will call &amp;quot;block locations&amp;quot;).  A typical block address is&lt;br /&gt;
 rc2 {{param|rc|flx_quanta0|flx_quanta4}}&lt;br /&gt;
This block consists of 41 32-bit words where the user writes the squid-1 flux quantum size for column 4 on readout card 2.&lt;br /&gt;
&lt;br /&gt;
The most basic data manipulation commands are RB (&amp;quot;read block&amp;quot;) and WB (&amp;quot;write block&amp;quot;).  These commands read from or write to the entire range of data at the block location, starting at the beginning of the block.&lt;br /&gt;
&lt;br /&gt;
The commands RRA (&amp;quot;read range&amp;quot;) and WRA (&amp;quot;write range&amp;quot;) can be used to read or write particular subranges of the data in a block location.&lt;br /&gt;
&lt;br /&gt;
All read and write commands take a card (or [[virtual card]]s) name and a parameter name as the first two arguments.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;RB&amp;quot;&amp;gt;&lt;br /&gt;
=== RB: read block ===&lt;br /&gt;
&lt;br /&gt;
The read block ('''rb''') command returns the entire contents of a block location.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rb  &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
 rb rc1 {{param|rc|adc_offset0}}&lt;br /&gt;
 Line   1 : ok : 10 11 9 8 12 13 14 15&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;WB&amp;quot;&amp;gt;&lt;br /&gt;
=== WB: write block ===&lt;br /&gt;
&lt;br /&gt;
The write block ('''wb''') command writes the given data to the specified block location.  If the number of data is smaller than block size, the remaining block elements will not be altered.  If the number of data is larger than the block size, the behaviour depends on the implementation of the block location.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 wb  &amp;lt;card&amp;gt; &amp;lt;param&amp;gt; [val0 val1 val2 ...]&lt;br /&gt;
Example:&lt;br /&gt;
 wb rc1 {{param|rc|adc_offset0}} 0 1 2&lt;br /&gt;
 Line   1 : ok&lt;br /&gt;
 rb rc1 {{param|rc|adc_offset0}}&lt;br /&gt;
 Line   2 : ok :  0 1 2 8 12 13 14 15&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;RRA&amp;quot;&amp;gt;&lt;br /&gt;
=== RRA: read range ===&lt;br /&gt;
&lt;br /&gt;
The read range ('''rra''') command returns &amp;lt;count&amp;gt; values from the block location, starting from the value at &amp;lt;start_index&amp;gt; (indexed from 0).&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rra &amp;lt;card&amp;gt; &amp;lt;param&amp;gt; &amp;lt;start_index&amp;gt; &amp;lt;count&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
 rra rc1 {{param|rc|adc_offset0}} 2 4&lt;br /&gt;
 Line   1 : ok : 2 8 12 13&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;WRA&amp;quot;&amp;gt;&lt;br /&gt;
=== WRA: write range ===&lt;br /&gt;
&lt;br /&gt;
The write range ('''wra''') command writes the given values into the block location, starting at &amp;lt;start_index&amp;gt; (indexed from 0).  Other block data (i.e. at indices lower than start_index) are not changed.  (This command is implemented as a read-update-write and will usually take twice as long to execute as a '''wb''' command.)&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 wra &amp;lt;card&amp;gt; &amp;lt;param&amp;gt; &amp;lt;start_index&amp;gt; [val0 val1 val2 ...]&lt;br /&gt;
Example:&lt;br /&gt;
 wra rc1 {{param|rc|adc_offset0}} 4 100 200&lt;br /&gt;
 Line   1 : ok&lt;br /&gt;
 rb rc1 {{param|rc|adc_offset0}}&lt;br /&gt;
 Line   2 : ok :  0 1 2 8 100 200 14 15&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MCE data acquisition commands ==&lt;br /&gt;
&lt;br /&gt;
The acquisition of frame data is achieved by first configuring an output system (by specifying an output format, filename, and the target readout cards), and then by issuing '''acq_go''' commands to acquire frames.&lt;br /&gt;
&lt;br /&gt;
This simplest example will acquire 1000 frames from rc2 into the file /data/cryo/current_data/test:&lt;br /&gt;
 acq_config /data/cryo/current_data/test rc2&lt;br /&gt;
 Line   1 : ok&lt;br /&gt;
 acq_go 1000&lt;br /&gt;
 Line   2 : ok&lt;br /&gt;
&lt;br /&gt;
The configuration commands have mnemonics that begin with '''acq_config'''.  They allow a small variety of output formats.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_CONFIG&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_CONFIG: configure simple MCE frame file ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_CONFIG''' command configures a single output file to receive MCE frames.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_config &amp;lt;filename&amp;gt; &amp;lt;readout_card&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_config test1.dat rc2&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_CONFIG_FS&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_CONFIG_FS: configure file-sequenced MCE frame file ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_CONFIG_FS''' command will result in the outputting of the frame data into a set of files whose filename contains an increasing index.  The output file is changed after &amp;lt;change_interval&amp;gt; frames.  The output files will be called &amp;lt;filename&amp;gt;.000, &amp;lt;filename&amp;gt;.001, etc.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_config_fs &amp;lt;filename&amp;gt; &amp;lt;readout_card&amp;gt; &amp;lt;change_interval&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_CONFIG_DIRFILE&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_CONFIG_DIRFILE and ACQ_CONFIG_DIRFILE_FS: dirfile-based acquisitions ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_CONFIG_DIRFILE''' and '''ACQ_CONFIG_DIRFILE_FS''' commands behave analogously to '''ACQ_CONFIG''' and '''ACQ_CONFIG_FS''' except they acquire data to a [http://getdata.sourceforge.net/dirfile.html Dirfile] instead of to a MCE frame file.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_config_dirfile &amp;lt;dirfilename&amp;gt; &amp;lt;readout_card&amp;gt;&lt;br /&gt;
and:&lt;br /&gt;
 acq_config_dirfile_fs &amp;lt;dirfilename&amp;gt; &amp;lt;readout_card&amp;gt; &amp;lt;change_interval&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_GO&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_GO: acquire frame data ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_GO''' command causes the MCE to begin acquiring data.  The frame data will be stored according to the most recent '''ACQ_CONFIG...''' command.  It is not usually necessary to reconfigure the output system (i.e. perform another '''ACQ_CONFIG''') between '''ACQ_GO''' commands.  The exception to this is that if the frame structure changes (i.e. &amp;quot;cc {{param|cc|num_rows_reported}}&amp;quot; is altered), then '''ACQ_CONFIG''' should be issued again so that the acquisition system can determine the frame size. &lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_go &amp;lt;frame_count&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_config tes_bias_ramp rc1&lt;br /&gt;
 wb tes bias 5 5 5&lt;br /&gt;
 acq_go 1&lt;br /&gt;
 wb tes bias 10 10 10&lt;br /&gt;
 acq_go 1&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_PATH&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_PATH: set the default path for data output ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_PATH''' command sets the default output directory for frame data.  This path is only applied if the filenames given in an '''ACQ_CONFIG...''' do not specify a relative path.  The given path can be absolute, or relative to the mce_cmd's run-time working directory.  The default output location can also be specified using the '-o' command line option.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_path &amp;lt;path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_path /data/cryo/current_data&lt;br /&gt;
 acq_config test1 rc1&lt;br /&gt;
 acq_go 10&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_LINK&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_LINK: turn on updating a symlink to the current acquisition ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_LINK''' command specifies the name of a symlink which will be created/retargeted to a current acquisition.  This command only schedules the creation/retargeting of the link.  The link is modified by an '''ACQ_CONFIG...'''.  As a result this command must be used before an '''ACQ_CONFIG...''' for it to do anything.  As with the filename specified in '''ACQ_CONFIG''' and friends, if the specified name is not an absolute path, the path specified by '''ACQ_PATH''' or the -o option will be prepended.  If doing a sequencing acquisition (either '''ACQ_CONFIG_FS''' or '''ACQ_CONFIG_DIRFILE_FS''') the link will be updated whenever a new file is started.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_link &amp;lt;name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_path /data/cryo/current_data&lt;br /&gt;
 acq_link mas.lnk&lt;br /&gt;
 acq_config test1 rc1&lt;br /&gt;
 acq_go 10&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_OPTION&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_OPTION: set various acquisition options ===&lt;br /&gt;
The '''ACQ_OPTION''' command allows you to modify various optional parameters for a particular acquisition.  Options are grouped by acquisition type (either &amp;quot;dirfile&amp;quot; or &amp;quot;flatfile&amp;quot;, ignoring sequencing), and vary between acquisition type.  They must be specified before configuration to take effect.  Options are not persistent: an '''ACQ_CONFIG'''-type command consumes and then resets all relevant options to their default value after configuration (so '''ACQ_CONFIG_DIRFILE''' and '''ACQ_CONFIG_DIRFILE_FS''' reset the dirfile options after applying them to the acquisition it is configuring, but '''ACQ_CONFIG''' will neither reset nor use them).&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_option &amp;lt;acq_type&amp;gt; &amp;lt;option_name&amp;gt; &amp;lt;option_value&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently, only &amp;lt;tt&amp;gt;acq_type&amp;lt;/tt&amp;gt; &amp;quot;dirfile&amp;quot; has any options.  These are:&lt;br /&gt;
* &amp;lt;tt&amp;gt;'''include''' &amp;lt;filename&amp;gt;&amp;lt;/tt&amp;gt;: copies contents of the specified file to the output dirfile metadata.  The file is copied verbatim, but the contents are not verified by MAS to see if it makes sense to use it as dirfile metadata.  Default is the empty string, indicating no inclusion.  If &amp;lt;filename&amp;gt; is a relative path, it will be to the current directory.  (ie. it ignores both the -o option and '''ACQ_PATH''')&lt;br /&gt;
* &amp;lt;tt&amp;gt;'''spf''' &amp;lt;number&amp;gt;&amp;lt;/tt&amp;gt;: sets the samples-per-frame of the fields in the dirfile to the specified value, which must be positive.  Default is one.&lt;br /&gt;
* &amp;lt;tt&amp;gt;'''version''' &amp;lt;number&amp;gt;&amp;lt;/tt&amp;gt;: sets the [http://getdata.sourceforge.net/dirfile.html Dirfile Standards Version] used to write the dirfile metadata.  This can be any integer greater than or equal to 3 (a smaller number results in the default, 7, being used), but only a few values are really of interest:&lt;br /&gt;
** Versions &amp;lt; 7 are unable to properly extract signed bitfields from the packed MCE data.  This affects [[data mode]]s 4, 5, 7, and 10.&lt;br /&gt;
** Versions &amp;gt; 4 can't be read by default builds of kst-1.x. (It is possible to build kst-1.x against a modern GetData library, making newer Dirfiles readable, although I don't think any distro shipping kst-1 has done this.)&lt;br /&gt;
:Setting this to 4 should recover the behaviour of older versions of MAS.  Also note: the dirfile formatted runfile metadata output by &amp;quot;&amp;lt;tt&amp;gt;[[mce_status]] -d&amp;lt;/tt&amp;gt;&amp;quot; requires at least Version 8 to parse, but does not depend on, nor is affected by, the Version number specified here.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_option dirfile include /path/to/extra/format_metadata&lt;br /&gt;
 acq_option dirfile version 4&lt;br /&gt;
 acq_link mas.lnk&lt;br /&gt;
 acq_config_dirfile test1 rc1&lt;br /&gt;
 acq_go 10&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_MULTI_BEGIN&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_MULTI_BEGIN and ACQ_MULTI_END: manage multiple output syncs ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to output to multiple files at the same time (e.g. to record a dirfile and a flatfile simultaneously).  This is achieved my putting mce_cmd into &amp;quot;multisync&amp;quot; mode, creating a few different output configurations with an '''ACQ_CONFIG...''', and then issuing '''ACQ_GO'''.  The '''ACQ_MULTI_BEGIN''' command clears the acquisition stack and puts mce_cmd into multisync mode.  The '''ACQ_MULTI_END''' command clears the acquisition stack and disables multisync mode.  An '''ACQ_MULTI_END''' command is implicitly executed when &amp;lt;tt&amp;gt;mce_cmd&amp;lt;/tt&amp;gt; exits, so it is not usually necessary to execute this command explicitly.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_multi_begin&lt;br /&gt;
 acq_multi_end&lt;br /&gt;
&lt;br /&gt;
Example (output to flatfile and dirfile simultaneously):&lt;br /&gt;
 acq_multi_begin&lt;br /&gt;
 acq_config 1234560000_flat rcs&lt;br /&gt;
 acq_config_dirfile 1234560000_dirfile rcs&lt;br /&gt;
 acq_go 164000&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Voluntary lock-out mechanism ==&lt;br /&gt;
&lt;br /&gt;
The driver supports a voluntary lock-out mechanism to help prevent two agents from accessing the MCE simultaneously.  The MAS driver, API, and mce_cmd provide convenient access to a locking mechanism, but the user must add the appropriate calls into their acquisition scripts.  The general idea is:&lt;br /&gt;
* An acquisition script should issue &amp;quot;LOCK_DOWN&amp;quot; to acquire The Lock for a given MCE.&lt;br /&gt;
* If the LOCK_DOWN fails, it is because some other process holds the lock.&lt;br /&gt;
* The script can release The Lock by issuing LOCK_UP.&lt;br /&gt;
* If mce_cmd exits while The Lock is held, The Lock will '''automatically''' be released (this is so that random crashes do not leave The Lock locked).&lt;br /&gt;
&lt;br /&gt;
=== LOCK_DOWN: acquire lock ===&lt;br /&gt;
&lt;br /&gt;
Issuing '''LOCK_DOWN''' causes the driver to check the lock for the target PCI card.  If the lock is available, it is acquired.  Subsequent attemps to LOCK_DOWN will fail, whether they come from other processes or the present process.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 lock_down&lt;br /&gt;
&lt;br /&gt;
=== LOCK_UP: release lock ===&lt;br /&gt;
&lt;br /&gt;
Issuing '''LOCK_UP''' causes the lock to be released.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 lock_up&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LOCK_QUERY: check state of lock ===&lt;br /&gt;
&lt;br /&gt;
The '''LOCK_QUERY''' command allows a script to inspect the state of the lock.  The output from the command is '''1''' if the lock is held, and '''0''' if the lock is free.  (We recognize that this conflicts with the usual counting strategy for semaphores.)&lt;br /&gt;
&lt;br /&gt;
Note that if LOCK_QUERY returns 1, that is not a guarantee that LOCK_DOWN will succeed.  But if you hurry, maybe it will.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 lock_query&lt;br /&gt;
&lt;br /&gt;
=== LOCK_RESET: reset state of lock ===&lt;br /&gt;
&lt;br /&gt;
The lock can be forcefully reset (to the unlocked state) with the LOCK_RESET command.  Note that using LOCK_RESET in a script is likely to defeat the point of the locking mechanism.  It is mostly for hacking.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 lock_reset&lt;br /&gt;
&lt;br /&gt;
== Low-level MCE commands ==&lt;br /&gt;
&lt;br /&gt;
=== GO ===&lt;br /&gt;
&lt;br /&gt;
Issuing '''GO''' sends a MCE command packet to the MCE, but with no associated additional processing.  That is, even though '''GO''' causes the MCE to produce frame data, the frames will not be stored to disk and they will either accumulate in the driver's buffer or be discarded by the PCI card if they are not of the expected size.  In general, the MAS acquisition system ('''[[#ACQ_GO|ACQ_GO]]''', &amp;amp;c.) should be used instead of sending this command directly.&lt;br /&gt;
&lt;br /&gt;
The only parameter which responds to '''GO''' is the readout card's {{param|rc|ret_dat}} parameter.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 go &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== STOP ===&lt;br /&gt;
:''See: [[The STOP Command]]''&lt;br /&gt;
The '''STOP''' command is intended for terminating MCE frame data acquisitions.  The only parameter which responds to '''STOP''' is the readout card's {{param|rc|ret_dat}} parameter.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 stop &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
 stop rcs {{param|rc|ret_dat}}&lt;br /&gt;
&lt;br /&gt;
=== RS ===&lt;br /&gt;
&lt;br /&gt;
The '''RS''' command is used to activate a few special command registers.   Registers which use '''RS''' have the type '''rs''' in the [[MCE commands]] list.  They are mostly commands which reset devices in the MCE ('''RS''' stands for ''reset''), which means they must reply to the request before executing the command, unlike a normal '''WB''' command, which replies after execution.&lt;br /&gt;
&lt;br /&gt;
Note: although the [[MCE commands|command list]] indicates that RS commands take a single parameter with a value of '''1''', this is not needed when calling the command from MAS.  MAS ignores parameters passed to a RS command and will always issue the command with the '''1''' datum.  So, don't pass any data to a RS command.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rs &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 rs cc {{param|cc|config_fac}}&lt;br /&gt;
&lt;br /&gt;
== Raw commands ==&lt;br /&gt;
&lt;br /&gt;
In addition to the formatted commanding discussed above, raw reads and writes can be issued to the MCE by specifying numeric register addresses (and, optionally, a numeric card ID).  Raw commands can be used to access command registers which are not defined in the hardware description file ([[mce.cfg]]).&lt;br /&gt;
&lt;br /&gt;
Numeric ''card IDs'' are given in the following table:&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&lt;br /&gt;
|+ Card ids&lt;br /&gt;
|-&lt;br /&gt;
! Card !! Card id !! Upper card ID&amp;lt;br/&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller;&amp;quot;&amp;gt;[[64-row support|v6 firmware only]]&amp;lt;/span&amp;gt; !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| [[PSUC]] || class=&amp;quot;code&amp;quot; | 0x01 || rowspan=&amp;quot;2&amp;quot; | &amp;amp;mdash; || Obsolete.&lt;br /&gt;
|-&lt;br /&gt;
| [[Clock card]] || class=&amp;quot;code&amp;quot; | 0x02 || Card id is {{param||slot_id}}.&lt;br /&gt;
|-&lt;br /&gt;
| [[Readout card]] 1 || class=&amp;quot;code&amp;quot; | 0x03 || class=&amp;quot;code&amp;quot; | 0x13 || rowspan=8 | Lower card IDs are {{param||slot_id}}.  Upper card IDs supported only with [[64-row support|version 6 firmware]] and only for certain parameters.&lt;br /&gt;
|-&lt;br /&gt;
| [[Readout card]] 2 || class=&amp;quot;code&amp;quot; | 0x04 || class=&amp;quot;code&amp;quot; | 0x14&lt;br /&gt;
|-&lt;br /&gt;
| [[Readout card]] 3 || class=&amp;quot;code&amp;quot; | 0x05 || class=&amp;quot;code&amp;quot; | 0x15&lt;br /&gt;
|-&lt;br /&gt;
| [[Readout card]] 4 || class=&amp;quot;code&amp;quot; | 0x06 || class=&amp;quot;code&amp;quot; | 0x16&lt;br /&gt;
|-&lt;br /&gt;
| [[Bias card]] 1 || class=&amp;quot;code&amp;quot; | 0x07 || class=&amp;quot;code&amp;quot; | 0x17&lt;br /&gt;
|-&lt;br /&gt;
| [[Bias card]] 2 || class=&amp;quot;code&amp;quot; | 0x08 || class=&amp;quot;code&amp;quot; | 0x18&lt;br /&gt;
|- &lt;br /&gt;
| [[Bias card]] 3 || class=&amp;quot;code&amp;quot; | 0x09 || class=&amp;quot;code&amp;quot; | 0x19&lt;br /&gt;
|-&lt;br /&gt;
| [[Address card]] || class=&amp;quot;code&amp;quot; | 0x0A || class=&amp;quot;code&amp;quot; | 0x1A&lt;br /&gt;
|-&lt;br /&gt;
| rcs &amp;lt;span style=&amp;quot;font-size: smaller;&amp;quot;&amp;gt;(All [[RC]]s)&amp;lt;/span&amp;gt; || class=&amp;quot;code&amp;quot; | 0x0B || rowspan=&amp;quot;4&amp;quot; | &amp;amp;mdash; || Use only with {{param|rc|ret_dat}}.&lt;br /&gt;
|-&lt;br /&gt;
| bcs &amp;lt;span style=&amp;quot;font-size: smaller;&amp;quot;&amp;gt;(All [[BC]]s)&amp;lt;/span&amp;gt; || class=&amp;quot;code&amp;quot; | 0x0C || rowspan=&amp;quot;2&amp;quot; | Not supported by &amp;lt;tt&amp;gt;mce_cmd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| All FPGAs || class=&amp;quot;code&amp;quot; | 0x0D&lt;br /&gt;
|-&lt;br /&gt;
| All cards || class=&amp;quot;code&amp;quot; | 0x0E || Not supported by &amp;lt;tt&amp;gt;mce_cmd&amp;lt;/tt&amp;gt;. This is ''not'' the '''sys''' multi-address physical card.&lt;br /&gt;
|}&lt;br /&gt;
The last three of these (&amp;lt;tt&amp;gt;0x0C&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;0x0D&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;0x0E&amp;lt;/tt&amp;gt;) are not supported by MAS or &amp;lt;tt&amp;gt;mce_cmd&amp;lt;/tt&amp;gt;.  Sending commands to them will result in strange behaviour.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rb &amp;lt;card&amp;gt; &amp;lt;register&amp;gt; &amp;lt;count&amp;gt; [multiplier]&lt;br /&gt;
 wb &amp;lt;card&amp;gt; &amp;lt;register&amp;gt; val0 [val1 val2 val3 ...]&lt;br /&gt;
 rra &amp;lt;card&amp;gt; &amp;lt;register&amp;gt; &amp;lt;start_index&amp;gt; &amp;lt;count&amp;gt;&lt;br /&gt;
 wra &amp;lt;card&amp;gt; &amp;lt;register&amp;gt; &amp;lt;start_index&amp;gt; val0 [val1 val2 val3 ...]&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
 # read one sample from the clock card {{param||led}} register&lt;br /&gt;
 rb cc 0x99 1&lt;br /&gt;
 &lt;br /&gt;
 # the same, but by card ID:&lt;br /&gt;
 rb 0x02 0x99 1&lt;br /&gt;
 &lt;br /&gt;
 # set ac row_order, offset 12, to value 40&lt;br /&gt;
 wra 0x0a 0x01 12 40&lt;br /&gt;
&lt;br /&gt;
Because these requests bypass the command definitions in the hardware description file, a count of data to be returned must be specified with a read (RB) request.  Raw commands cannot be issued to the virtual card mappings implemented by MAS ('''tes''', '''sq1''', '''sq2''', &amp;amp;c.), nor the multi-address physical cards '''rca''' and '''sys'''.&lt;br /&gt;
&lt;br /&gt;
= Output formatting =&lt;br /&gt;
&lt;br /&gt;
Normally, mce_cmd produces a line of output following each command. The output consists of two or three parts, separated by colons.  If in line prefix mode (which is the default) the output is:&lt;br /&gt;
 Line &amp;lt;line number&amp;gt;: &amp;lt;success&amp;gt; [: data ... ]&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;success&amp;gt; indicator will be &amp;quot;ok&amp;quot; if the command succeeded, or &amp;quot;error&amp;quot; otherwise.  Successful commands may return data (for example, an RB command).  Failed commands will always return an error message as the data.&lt;br /&gt;
&lt;br /&gt;
If mce_cmd is invoked with prefixes turned off ('-p'), the output format is&lt;br /&gt;
 &amp;lt;success&amp;gt; [: data]&lt;br /&gt;
&lt;br /&gt;
If mce_cmd is invoked in quiet mode ('q'), then all command responses that have no output data are suppressed.  In quiet mode, &amp;quot;Line 12: ok&amp;quot; will not be displayed.&lt;br /&gt;
&lt;br /&gt;
[[Category: Software]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MAS_PC_specifications_email_template&amp;diff=6211</id>
		<title>MAS PC specifications email template</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MAS_PC_specifications_email_template&amp;diff=6211"/>
		<updated>2016-05-04T18:36:43Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;MAS should run without difficulty on any modern PC that has a standard PCI slot and can run Ubuntu 10.04.  In particular, MAS now supports 64-bit and multi-core machines.  We have run MAS on fairly weak machines (1 GHz single core w/ 1GB RAM), but during detector characterization phases users will probably prefer a much more powerful desktop machine with lots of speed and graphics support.&lt;br /&gt;
&lt;br /&gt;
Note also that MCE data can take up quite a bit of disk space; 1024 channels of 400 Hz will pile up at 1.6 MB/s.  If your data rate is comparable to this then your system should have at least 500 GB of space for MCE data.&lt;br /&gt;
&lt;br /&gt;
Again, each MCE requires a PCI slot for the fibre-optic interface board!  Some new motherboards do not have standard PCI slots, as PCI-express is becoming more popular.  One alternative to on-board PCI slots is to use a PCI adapter.  Users have reported good results with such hardware.  One such successful configuration is:&lt;br /&gt;
* PCIe to PCI Adapter: StarTech PCI Express to PCI Adapter Card Model PEX1PCI1&lt;br /&gt;
* StarTech PEX16RISER PCI Express Riser Card - x16 Left Slot Adapter&lt;br /&gt;
* GIGABYTE GA-H81M-DS2V LGA 1150 Motherboard.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Main_Page&amp;diff=6113</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Main_Page&amp;diff=6113"/>
		<updated>2016-02-03T21:09:07Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Contact Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This Wiki is for users of UBC's '''Multi-Channel Electronics''' (MCE), including the '''MCE Acquisition Software''' (MAS).&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== MCE Overview ==&lt;br /&gt;
The MCE described here borrows heavily from the designs used at [http://www.nist.gov/pml/ NIST]. Changes have been made to upgrade components, achieve higher integration, and match to the specific experimental configurations.&lt;br /&gt;
&lt;br /&gt;
In basic operation, one MCE [[subrack]] controls the SQUID amplifiers and multiplexer, and reads signals from one 32×41 pixel or 16×41 pixel sub-array. The system hardware is completely modular at the sub-array level. Each sub-array is connected via woven cryogenic cables to a single MCE subrack through 3 or 5 MDM connectors. Each MCE subrack is, in turn, connected by an optical fibre to a single data-acquisition PC running Linux and data-acquisition software ([[MAS]]) developed at UBC.&lt;br /&gt;
 &lt;br /&gt;
Each MCE consists of hybrid analog/digital hardware and firmware developed for Altera Stratix FPGAs. A subrack has up to nine cards: including 2 or 4 [[Readout card]]s each of which reads 8 output columns through 14-bit 50MHz ADCs; 1 [[address card]] to multiplex the first-stage SQUIDs biases at around 20kHz; 1 [[clock card]] to interpret commands and to synchronize all the cards using a 25MHz clock; 2 or 3 [[bias card]]s to control the SQUID series-array feedback, the second-stage SQUID bias and feedback as well as the bolometer bias and heater. During [[auto_setup|detector setup]], the MCE is used to calculate the optimal operating points for the bolometers and the SQUID amplifiers by measuring their characteristics using open and closed feedback loops. During observation, MCE uses a running PID-calculation to determine the first-stage SQUID feedback necessary to keep the whole amplification chain in a linear regime.&lt;br /&gt;
&lt;br /&gt;
In conjunction with the MCEs, a [[Sync Box]] supplies data-valid pulses with serial numbers to all MCE subracks and to the telescope pointing system. This allows synchronization between the data acquisition, the pointing system, and the telescope housekeeping.&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
&lt;br /&gt;
* [[ MCE hardware | MCE Hardware ]] - information on MCE hardware (and accessories)&lt;br /&gt;
* [[ MCE firmware | MCE Firmware ]] - firmware versions, features, and tools (including sync box and PCI card firmware)&lt;br /&gt;
* [[ MAS ]] - the MCE Acquisition Software - kernel driver and low-level tools&lt;br /&gt;
* [[ MCE script ]] - SQUID array setup programs&lt;br /&gt;
* [[ MCE usage ]] - practical usage and reference documents&lt;br /&gt;
* [[Publications]] - technical publications relating to the Multi-Channel Electronics&lt;br /&gt;
&lt;br /&gt;
== Contact Info ==&lt;br /&gt;
&lt;br /&gt;
The '''&amp;lt;code&amp;gt;[[mce-announce]]&amp;lt;/code&amp;gt;''' e-mail list is used to communicate important firmware and software updates to the MCE user community.  See the [[mce-announce]] page for details on how to subscribe.&lt;br /&gt;
&lt;br /&gt;
 MCE Lab:                   604-822-2585&lt;br /&gt;
 Halpern's Lab:             604-822-6709&lt;br /&gt;
 &lt;br /&gt;
 Hardware:         mandana at phas.ubc.ca, halpern at phas.ubc.ca&lt;br /&gt;
 Firmware:         mandana at phas.ubc.ca&lt;br /&gt;
 Software:         mhasse at psu.edu, dvw at phas.ubc.ca&lt;br /&gt;
  &lt;br /&gt;
 Department of Physics &amp;amp; Astronomy &lt;br /&gt;
 University of British Columbia&lt;br /&gt;
 6224 Agricultural Rd, Room 204&lt;br /&gt;
 Vancouver, BC V6T 1Z1 &lt;br /&gt;
 Canada&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=6101</id>
		<title>Hybrid row select for mux11d</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=6101"/>
		<updated>2015-11-13T19:24:09Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This document is under active development.'''&lt;br /&gt;
&lt;br /&gt;
In standard mux11d, the S1 selection signals (row_select) are provided by the Adress Card (AC).  &amp;quot;Hybrid row select&amp;quot; refers to the use of Bias Card (BC) flux_fb DAC lines to augment the number of addressable S1.&lt;br /&gt;
* Without any firmware modifications, it should be possible to multiplex any combination of AC and BC DACs, with num_rows up to 64.  However, without some firmware modification, one can configure at most 58 of those channels for servo and readout.  (Actually you can only read back 57 values from a register, so that's as far one should push it.)&lt;br /&gt;
* With some communication protocol modification, it should be possible to configure and readout any subset of 64 rows.&lt;br /&gt;
* Major modifications (especially to RC) are required to get more than 64 rows.&lt;br /&gt;
&lt;br /&gt;
===Software modifications===&lt;br /&gt;
&lt;br /&gt;
The software components affected by hybrid row select are:&lt;br /&gt;
* MAS low-level and mce_script -- internal code often assumes num_rows &amp;lt;= 41.  These instances shouldn't be too hard to find and remove.&lt;br /&gt;
* mux_lock -- rs_servo must be able to ramp the row_select DACs.&lt;br /&gt;
* config script system -- must be able to map selected row_select values to correct MCE registers.&lt;br /&gt;
&lt;br /&gt;
===mce.cfg considerations===&lt;br /&gt;
&lt;br /&gt;
The AC and BC are set up differently for fast switching, and thus a low-level solution based on virtual card re-mappings is not feasible.  &lt;br /&gt;
* AC accepts lists of on_bias and off_bias values, and order of their application is set by the row_order register.&lt;br /&gt;
* BC allows a completely arbitrary matrix of flux_fb values, which is more general than the AC model.  There is no equivalent of row_order, since the matrix rows themseleves can be modified to produce the equivalent reordering of output values.&lt;br /&gt;
&lt;br /&gt;
The biggest obstacle here is that the manipulation of &amp;quot;row_order&amp;quot; has very different implementations for the AC and BC.  The path to a transparent low-level solution is not clear.&lt;br /&gt;
&lt;br /&gt;
Otherwise, the changes to mce.cfg are straight-forward.  Switches should be added to increase the effective maximum num_rows to 57/58 or 64/66.  The &amp;quot;row select&amp;quot; and &amp;quot;row deselect&amp;quot; virtual targets will be eliminated in favour of a mapping described in experiment.cfg.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;br /&gt;
&lt;br /&gt;
The config script system must be able to take care of translating values in experiment.cfg to the appropriate MCE registers.  In order for that to take place, experiment.cfg must also encode a map from &amp;quot;row select&amp;quot; index into physical address lines.  We define the system by example:&lt;br /&gt;
&lt;br /&gt;
 # Activate hybrid mode.  With great power comes great complexity.&lt;br /&gt;
 mux11d_hybrid_row_select = 1;&lt;br /&gt;
 &lt;br /&gt;
 # Row select lines will be drawn from AC and from BC2.&lt;br /&gt;
 mux11d_row_select_cards = [&amp;quot;ac&amp;quot;, &amp;quot;bc2&amp;quot;];&lt;br /&gt;
 &lt;br /&gt;
 # For the purposes of mux_order, AC lines are indexed by [0,...,40] and BC lines are indexed by [50,...,81].&lt;br /&gt;
 mux11d_row_select_cards_row0 = [0, 50];&lt;br /&gt;
 &lt;br /&gt;
 # For mux cycles where the AC is not active, use ac on_bias[39] as a DAC to idle on.&lt;br /&gt;
 mux11d_ac_idle_row = 39;&lt;br /&gt;
 &lt;br /&gt;
 # The muxing order will be: 32 rows from AC (corresponding to on_bias[0] through on_bias[31],&lt;br /&gt;
 #  followed by 16 rows from BC (fb_col0 to fb_col15), followed by a single AC row (on_bias[40]).&lt;br /&gt;
 mux11d_mux_order = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,&lt;br /&gt;
                     10,11,12,13,14,15,16,17,18,19,&lt;br /&gt;
                     20,21,22,23,24,25,26,27,28,29,&lt;br /&gt;
                     30,31,&lt;br /&gt;
                     50,51,52,53,54,55,56,57,58,59,&lt;br /&gt;
                     60,61,62,63,64,65,&lt;br /&gt;
                     40 ];&lt;br /&gt;
&lt;br /&gt;
The values for row_select and row_deselect will then be stored in MUX order (rather than physical line order), in experiment.cfg settings:&lt;br /&gt;
 row_select   = [ 999,999,999,999,999,999... ]#(49 values total)&lt;br /&gt;
 row_deselect = [ 999,999,999,999,999,999... ]#(49 values total)&lt;br /&gt;
&lt;br /&gt;
We may as well allow the user to rescale row_select and row_deselect values prior to application to the DACs.  While it is more powerful to specify this on a per DAC or per MUX cycle basis, it is probably enough to specify the multiplier on a per-card basis.&lt;br /&gt;
 # Multiplier for row_select -&amp;gt; MCE values.&lt;br /&gt;
 mux11d_row_select_multipliers = [1, 0.5];&lt;br /&gt;
&lt;br /&gt;
These experiment.cfg settings will produce the following MCE configuration:&lt;br /&gt;
* '''ac row_order''' is like:&lt;br /&gt;
 wb ac row_order  0  1  2  3  4  5  6  7  8  9 \ &lt;br /&gt;
                 10 11 12 13 14 15 16 17 18 19 \&lt;br /&gt;
                 20 21 22 23 24 25 26 27 28 29 \&lt;br /&gt;
                 30 31 39 39 39 39 39 39 39 39 \&lt;br /&gt;
                 39 39 39 39 39 39 39 39 40&lt;br /&gt;
* row_select and row_deselect 999 and 0, except for row 39 which is 0 and 0.&lt;br /&gt;
 wb ac on_bias 999 999 999 .... 999 0 999&lt;br /&gt;
 wb ac off_bias 0 0 0 ... 0 0 0&lt;br /&gt;
* The '''bc2 col*''' registers are set to row_deselect values (probably 0) except for:&lt;br /&gt;
 wra bc2 col0  32 498&lt;br /&gt;
 wra bc2 col1  33 498&lt;br /&gt;
 wra bc2 col2  34 498&lt;br /&gt;
 wra bc2 col3  35 498&lt;br /&gt;
 ...&lt;br /&gt;
 wra bc2 col14 46 498&lt;br /&gt;
 wra bc2 col15 47 498&lt;br /&gt;
&lt;br /&gt;
=== mux_lock ===&lt;br /&gt;
&lt;br /&gt;
The rs_servo program has to ramp the '''row select''' DACs.  It will need to parse experiment.cfg to know how to do this.  It should only ramp the DACs listed in mux11d_mux_order.  It should properly decode mux_order and multipliers.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=6100</id>
		<title>Hybrid row select for mux11d</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=6100"/>
		<updated>2015-11-13T19:23:22Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This document is under active development.'''&lt;br /&gt;
&lt;br /&gt;
In standard mux11d, the S1 selection signals (row_select) are provided by the Adress Card (AC).  &amp;quot;Hybrid row select&amp;quot; refers to the use of Bias Card (BC) flux_fb DAC lines to augment the number of addressable S1.&lt;br /&gt;
* Without any firmware modifications, it should be possible to multiplex any combination of AC and BC DACs, with num_rows up to 64.  However, without some firmware modification, one can configure at most 58 of those channels for servo and readout.  (Actually you can only read back 57 values from a register, so that's as far one shoul&lt;br /&gt;
* With some communication protocol modification, it should be possible to configure and readout any subset of 64 rows.&lt;br /&gt;
&lt;br /&gt;
===Software modifications===&lt;br /&gt;
&lt;br /&gt;
The software components affected by hybrid row select are:&lt;br /&gt;
* MAS low-level and mce_script -- internal code often assumes num_rows &amp;lt;= 41.  These instances shouldn't be too hard to find and remove.&lt;br /&gt;
* mux_lock -- rs_servo must be able to ramp the row_select DACs.&lt;br /&gt;
* config script system -- must be able to map selected row_select values to correct MCE registers.&lt;br /&gt;
&lt;br /&gt;
===mce.cfg considerations===&lt;br /&gt;
&lt;br /&gt;
The AC and BC are set up differently for fast switching, and thus a low-level solution based on virtual card re-mappings is not feasible.  &lt;br /&gt;
* AC accepts lists of on_bias and off_bias values, and order of their application is set by the row_order register.&lt;br /&gt;
* BC allows a completely arbitrary matrix of flux_fb values, which is more general than the AC model.  There is no equivalent of row_order, since the matrix rows themseleves can be modified to produce the equivalent reordering of output values.&lt;br /&gt;
&lt;br /&gt;
The biggest obstacle here is that the manipulation of &amp;quot;row_order&amp;quot; has very different implementations for the AC and BC.  The path to a transparent low-level solution is not clear.&lt;br /&gt;
&lt;br /&gt;
Otherwise, the changes to mce.cfg are straight-forward.  Switches should be added to increase the effective maximum num_rows to 57/58 or 64/66.  The &amp;quot;row select&amp;quot; and &amp;quot;row deselect&amp;quot; virtual targets will be eliminated in favour of a mapping described in experiment.cfg.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;br /&gt;
&lt;br /&gt;
The config script system must be able to take care of translating values in experiment.cfg to the appropriate MCE registers.  In order for that to take place, experiment.cfg must also encode a map from &amp;quot;row select&amp;quot; index into physical address lines.  We define the system by example:&lt;br /&gt;
&lt;br /&gt;
 # Activate hybrid mode.  With great power comes great complexity.&lt;br /&gt;
 mux11d_hybrid_row_select = 1;&lt;br /&gt;
 &lt;br /&gt;
 # Row select lines will be drawn from AC and from BC2.&lt;br /&gt;
 mux11d_row_select_cards = [&amp;quot;ac&amp;quot;, &amp;quot;bc2&amp;quot;];&lt;br /&gt;
 &lt;br /&gt;
 # For the purposes of mux_order, AC lines are indexed by [0,...,40] and BC lines are indexed by [50,...,81].&lt;br /&gt;
 mux11d_row_select_cards_row0 = [0, 50];&lt;br /&gt;
 &lt;br /&gt;
 # For mux cycles where the AC is not active, use ac on_bias[39] as a DAC to idle on.&lt;br /&gt;
 mux11d_ac_idle_row = 39;&lt;br /&gt;
 &lt;br /&gt;
 # The muxing order will be: 32 rows from AC (corresponding to on_bias[0] through on_bias[31],&lt;br /&gt;
 #  followed by 16 rows from BC (fb_col0 to fb_col15), followed by a single AC row (on_bias[40]).&lt;br /&gt;
 mux11d_mux_order = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,&lt;br /&gt;
                     10,11,12,13,14,15,16,17,18,19,&lt;br /&gt;
                     20,21,22,23,24,25,26,27,28,29,&lt;br /&gt;
                     30,31,&lt;br /&gt;
                     50,51,52,53,54,55,56,57,58,59,&lt;br /&gt;
                     60,61,62,63,64,65,&lt;br /&gt;
                     40 ];&lt;br /&gt;
&lt;br /&gt;
The values for row_select and row_deselect will then be stored in MUX order (rather than physical line order), in experiment.cfg settings:&lt;br /&gt;
 row_select   = [ 999,999,999,999,999,999... ]#(49 values total)&lt;br /&gt;
 row_deselect = [ 999,999,999,999,999,999... ]#(49 values total)&lt;br /&gt;
&lt;br /&gt;
We may as well allow the user to rescale row_select and row_deselect values prior to application to the DACs.  While it is more powerful to specify this on a per DAC or per MUX cycle basis, it is probably enough to specify the multiplier on a per-card basis.&lt;br /&gt;
 # Multiplier for row_select -&amp;gt; MCE values.&lt;br /&gt;
 mux11d_row_select_multipliers = [1, 0.5];&lt;br /&gt;
&lt;br /&gt;
These experiment.cfg settings will produce the following MCE configuration:&lt;br /&gt;
* '''ac row_order''' is like:&lt;br /&gt;
 wb ac row_order  0  1  2  3  4  5  6  7  8  9 \ &lt;br /&gt;
                 10 11 12 13 14 15 16 17 18 19 \&lt;br /&gt;
                 20 21 22 23 24 25 26 27 28 29 \&lt;br /&gt;
                 30 31 39 39 39 39 39 39 39 39 \&lt;br /&gt;
                 39 39 39 39 39 39 39 39 40&lt;br /&gt;
* row_select and row_deselect 999 and 0, except for row 39 which is 0 and 0.&lt;br /&gt;
 wb ac on_bias 999 999 999 .... 999 0 999&lt;br /&gt;
 wb ac off_bias 0 0 0 ... 0 0 0&lt;br /&gt;
* The '''bc2 col*''' registers are set to row_deselect values (probably 0) except for:&lt;br /&gt;
 wra bc2 col0  32 498&lt;br /&gt;
 wra bc2 col1  33 498&lt;br /&gt;
 wra bc2 col2  34 498&lt;br /&gt;
 wra bc2 col3  35 498&lt;br /&gt;
 ...&lt;br /&gt;
 wra bc2 col14 46 498&lt;br /&gt;
 wra bc2 col15 47 498&lt;br /&gt;
&lt;br /&gt;
=== mux_lock ===&lt;br /&gt;
&lt;br /&gt;
The rs_servo program has to ramp the '''row select''' DACs.  It will need to parse experiment.cfg to know how to do this.  It should only ramp the DACs listed in mux11d_mux_order.  It should properly decode mux_order and multipliers.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_Firmware_Upgrade_using_dfu-programmer&amp;diff=6099</id>
		<title>Sync Box Firmware Upgrade using dfu-programmer</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_Firmware_Upgrade_using_dfu-programmer&amp;diff=6099"/>
		<updated>2015-11-04T20:42:31Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This describes how to upgrade [[Sync Box Firmware]] using the free dfu-programmer on linux.  This only applies to the microprocessor; often it is also necessary to upgrade the CPLD.&lt;br /&gt;
&lt;br /&gt;
The https://dfu-programmer.github.io/ software can be installed in Ubuntu like this:&lt;br /&gt;
 sudo apt-get install dfu-programmer&lt;br /&gt;
&lt;br /&gt;
Make sure your version supports the sync box device:&lt;br /&gt;
 &lt;br /&gt;
 act@wilson:~$ dfu-programmer --version&lt;br /&gt;
 dfu-programmer 0.6.1&lt;br /&gt;
 act@wilson:~$ dfu-programmer --targets&lt;br /&gt;
 targets:&lt;br /&gt;
    at89c51snd1c       at89c51snd2c       at89c5130          '''at89c5131'''&lt;br /&gt;
    at89c5132          at90usb1287        at90usb1286        at90usb1287-4k&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Connect the sync box to the computer over USB.  From [http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf  the manual]: &amp;quot;To reprogram BLJB or to get the bootloader to restart so that you can download new code, the&lt;br /&gt;
PSEN and RESET switches must be held down while the USB connector is inserted. Reset is&lt;br /&gt;
then released followed by PSEN. &amp;quot;&lt;br /&gt;
&lt;br /&gt;
When the device is properly detected it will show up in &amp;lt;tt&amp;gt;lsusb&amp;lt;/tt&amp;gt; as something like:&lt;br /&gt;
 act@wilson:~$ lsusb&lt;br /&gt;
 Bus 002 Device 049: ID 03eb:2ffd Atmel Corp. at89c5130/c5131 DFU bootloader&lt;br /&gt;
&lt;br /&gt;
To prove things are working, dump the contents of the device into a file:&lt;br /&gt;
&lt;br /&gt;
 act@wilson:~$ sudo dfu-programmer at89c5131:2,49 dump &amp;gt; part_dump.bin&lt;br /&gt;
&lt;br /&gt;
Note that we read the address '''2,49''' from the lsusb output.  The contents of part_dump.bin can then be inspected with &amp;lt;tt&amp;gt;hexdump -C&amp;lt;/tt&amp;gt; to confirm it's the sync box code and not some other nonsense.&lt;br /&gt;
&lt;br /&gt;
Then to program the device the syntax is:&lt;br /&gt;
 act@wilson:~$ sudo dfu-programmer  at89c5131:2,49 flash sync_box_v22_26sept2014.hex&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_Firmware_Upgrade_using_dfu-programmer&amp;diff=6098</id>
		<title>Sync Box Firmware Upgrade using dfu-programmer</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_Firmware_Upgrade_using_dfu-programmer&amp;diff=6098"/>
		<updated>2015-11-04T20:24:04Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This describes how to upgrade [[Sync Box Firmware]] using the free dfu-programmer on linux.  This only applies to the microprocessor; often it is also necessary to upgrade the CPLD.&lt;br /&gt;
&lt;br /&gt;
The https://dfu-programmer.github.io/ software can be installed in Ubuntu like this:&lt;br /&gt;
 sudo apt-get install dfu-programmer&lt;br /&gt;
&lt;br /&gt;
Make sure your version supports the sync box device:&lt;br /&gt;
 &lt;br /&gt;
 act@wilson:~$ dfu-programmer --version&lt;br /&gt;
 dfu-programmer 0.6.1&lt;br /&gt;
 act@wilson:~$ dfu-programmer --targets&lt;br /&gt;
 targets:&lt;br /&gt;
    at89c51snd1c       at89c51snd2c       at89c5130          '''at89c5131'''&lt;br /&gt;
    at89c5132          at90usb1287        at90usb1286        at90usb1287-4k&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Connect the sync box to the computer over USB.  From [http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf  the manual]: &amp;quot;To reprogram BLJB or to get the bootloader to restart so that you can download new code, the&lt;br /&gt;
PSEN and RESET switches must be held down while the USB connector is inserted. Reset is&lt;br /&gt;
then released followed by PSEN. &amp;quot;&lt;br /&gt;
&lt;br /&gt;
When the device is properly detected it will show up in &amp;lt;tt&amp;gt;lsusb&amp;lt;/tt&amp;gt; as something like:&lt;br /&gt;
 act@wilson:~$ lsusb&lt;br /&gt;
 Bus 002 Device 049: ID 03eb:2ffd Atmel Corp. at89c5130/c5131 DFU bootloader&lt;br /&gt;
&lt;br /&gt;
To prove things are working, dump the contents of the device into a file:&lt;br /&gt;
&lt;br /&gt;
 act@wilson:~$ sudo dfu-programmer at89c5131:2,49 dump &amp;gt; part_dump.bin&lt;br /&gt;
&lt;br /&gt;
Note that we read the address '''2,49''' from the lsusb output.  The contents of part_dump.bin can then be inspected with &amp;lt;tt&amp;gt;hexdump -C&amp;lt;/tt&amp;gt; to confirm it's the sync box code and not some other nonsense.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_Firmware_Upgrade_using_dfu-programmer&amp;diff=6097</id>
		<title>Sync Box Firmware Upgrade using dfu-programmer</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_Firmware_Upgrade_using_dfu-programmer&amp;diff=6097"/>
		<updated>2015-11-04T20:20:59Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: Created page with &amp;quot;The https://dfu-programmer.github.io/ software can be installed in Ubuntu like this:  sudo apt-get install dfu-programmer   Make sure it supports the sync box device:    act@wils…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The https://dfu-programmer.github.io/ software can be installed in Ubuntu like this:&lt;br /&gt;
 sudo apt-get install dfu-programmer&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure it supports the sync box device:&lt;br /&gt;
 &lt;br /&gt;
 act@wilson:~$ dfu-programmer --targets&lt;br /&gt;
 targets:&lt;br /&gt;
    at89c51snd1c       at89c51snd2c       at89c5130          '''at89c5131'''&lt;br /&gt;
    at89c5132          at90usb1287        at90usb1286        at90usb1287-4k&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Connect the sync box to the computer over USB.  From [http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf  the manual]: &amp;quot;To reprogram BLJB or to get the bootloader to restart so that you can download new code, the&lt;br /&gt;
PSEN and RESET switches must be held down while the USB connector is inserted. Reset is&lt;br /&gt;
then released followed by PSEN. &amp;quot;&lt;br /&gt;
&lt;br /&gt;
When the device is properly detected it will show up in &amp;lt;tt&amp;gt;lsusb&amp;lt;/tt&amp;gt; as something like:&lt;br /&gt;
 act@wilson:~$ lsusb&lt;br /&gt;
 Bus 002 Device 049: ID 03eb:2ffd Atmel Corp. at89c5130/c5131 DFU bootloader&lt;br /&gt;
&lt;br /&gt;
To prove things are working, dump the contents of the device into a file:&lt;br /&gt;
&lt;br /&gt;
 act@wilson:~$ sudo dfu-programmer at89c5131:2,49 dump &amp;gt; part_dump.bin&lt;br /&gt;
&lt;br /&gt;
Note that we read the address '''2,49''' from the lsusb output.  The contents of part_dump.bin can then be inspected with &amp;lt;tt&amp;gt;hexdump -C&amp;lt;/tt&amp;gt; to confirm it's the sync box code and not some other nonsense.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_firmware&amp;diff=6096</id>
		<title>Sync Box firmware</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_firmware&amp;diff=6096"/>
		<updated>2015-11-04T20:13:27Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Firmware Upgrade Instructions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
There is an Altera CPLD (EPM570T144C3) and an Atmel micro-controller (AT89C51) on the Sync board. &lt;br /&gt;
* SyncBox CPLD Firmware Description [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/SyncBox/SyncBox_FwDescr_S589_201.pdf PDF]] (SC2-ELE-S589-201)&lt;br /&gt;
* SyncBox Microcontroller Software Description [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/SyncBox/SyncBox_SWDescr_S589_202.pdf PDF]] (SC2-ELE-S589-202)&lt;br /&gt;
&lt;br /&gt;
Consequently, there are two sets of firmware:&lt;br /&gt;
*firmware for the CPLD part (*.pof file)&lt;br /&gt;
*firmware for the microcontroller (*.hex file)&lt;br /&gt;
&lt;br /&gt;
= Firmware Upgrade Instructions =&lt;br /&gt;
To upgrade the Sync Box firmware,''most times'' both the microcontroller and the CPLD firmware need to be reprogrammed.&lt;br /&gt;
&lt;br /&gt;
The CPLD firmware can be loaded using the Altera USB-Blaster that connects to the on-board P23 JTAG header, and Quartus Programmer software. A *.pof file needs to be loaded.&lt;br /&gt;
&lt;br /&gt;
The micro-controller firmware can be loaded using a USB cable that connects to the on-board J1 connector, and [http://www.atmel.com/tools/FLIP.aspx Flip] Programmer software available from Atmel website. A *.hex file needs to be loaded.  Alternately, see if you can use free software dfu-programmer on linux: [[Sync Box Firmware Upgrade using dfu-programmer]].&lt;br /&gt;
&lt;br /&gt;
For more details, see section 9 in: [http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf Sync Box User's Guide]&lt;br /&gt;
&lt;br /&gt;
''Note: I had to install Flip on 3 computers before I could get the USB driver to work!''&lt;br /&gt;
&lt;br /&gt;
[http://e-mode.phas.ubc.ca/mce_firmware/ Firmware .hex &amp;amp; .pof Downloads]&lt;br /&gt;
&lt;br /&gt;
= Revisions =&lt;br /&gt;
== '''Firmware set Rev. 22''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v22_26sep2014.hex&lt;br /&gt;
: no change to cpld code&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: Sync Box default values are set for ACT values: fr=38, num_rows=33, row_len=50&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 21''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v21_02sep2014.pof&lt;br /&gt;
: no change to microcontroller code or *.hex file&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: DV_FTS and DV_POL are now duplicate copies of DV_SPARE1 and DV_SPARE2, respectively. See [http://e-mode.phas.ubc.ca/mcewiki/index.php/Sync_Box_AC-in_Rack_Mount_io IO for rackmount AC-in Sync Box]&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 20''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v20_22aug2013.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: hard-coded Spider values of fr=120, num_rows=33, row_len=53 (which translates to row_len=106 on mce front)&lt;br /&gt;
: firmware revision on rs232 interface now shows 20&lt;br /&gt;
== '''Firmware set Rev. 1f''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v1f_25feb2010.pof&lt;br /&gt;
: sync_box_v1f_25feb2010.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: adds a ckd command to the rs232 interface to adjust the frequency of DV_Spare1 and DV_Spare2 by setting a 50MHz divisor through the command.&lt;br /&gt;
: when you turn on the sync box, the firmware revision 1f appears on the rs232 terminal&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 1e (6e?)''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v6e_11aug2008.pof&lt;br /&gt;
: sync_box_v1c_17nov2006.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: added a 50MHz clock on SMA output of the Sync box&lt;br /&gt;
&lt;br /&gt;
; Note&lt;br /&gt;
: Since the microcontroller code is still 1c and that is what is reported in rs232 terminal, there is no way to identify this set from a 1c set.&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 1c''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v6c_19oct2006.pof&lt;br /&gt;
: sync_box_v1c_17nov2006.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
original firmware&lt;br /&gt;
&lt;br /&gt;
= Source code =&lt;br /&gt;
The sync box source (both CPLD and Atmel code) is available in the &amp;lt;tt&amp;gt;sync_box&amp;lt;/tt&amp;gt; project in the [[UBC SVN repository]].  So, something like this might work:&lt;br /&gt;
&lt;br /&gt;
 svn checkout --username=mceanon svn://e-mode.phas.ubc.ca/sync_box/trunk sync_box&lt;br /&gt;
&lt;br /&gt;
[[Category:Firmware]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_firmware&amp;diff=6075</id>
		<title>Sync Box firmware</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Sync_Box_firmware&amp;diff=6075"/>
		<updated>2015-10-21T19:18:29Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
There is an Altera CPLD (EPM570T144C3) and an Atmel micro-controller (AT89C51) on the Sync board. &lt;br /&gt;
* SyncBox CPLD Firmware Description [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/SyncBox/SyncBox_FwDescr_S589_201.pdf PDF]] (SC2-ELE-S589-201)&lt;br /&gt;
* SyncBox Microcontroller Software Description [[http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/SyncBox/SyncBox_SWDescr_S589_202.pdf PDF]] (SC2-ELE-S589-202)&lt;br /&gt;
&lt;br /&gt;
Consequently, there are two sets of firmware:&lt;br /&gt;
*firmware for the CPLD part (*.pof file)&lt;br /&gt;
*firmware for the microcontroller (*.hex file)&lt;br /&gt;
&lt;br /&gt;
= Firmware Upgrade Instructions =&lt;br /&gt;
To upgrade the Sync Box firmware,''most times'' both the microcontroller and the CPLD firmware need to be reprogrammed.&lt;br /&gt;
&lt;br /&gt;
The CPLD firmware can be loaded using the Altera USB-Blaster that connects to the on-board P23 JTAG header, and Quartus Programmer software. A *.pof file needs to be loaded.&lt;br /&gt;
&lt;br /&gt;
The micro-controller firmware can be loaded using a USB cable that connects to the on-board J1 connector, and [http://www.atmel.com/tools/FLIP.aspx Flip] Programmer software available from Atmel website. A *.hex file needs to be loaded.&lt;br /&gt;
&lt;br /&gt;
For more details, see section 9 in: [http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf Sync Box User's Guide]&lt;br /&gt;
&lt;br /&gt;
''Note: I had to install Flip on 3 computers before I could get the USB driver to work!''&lt;br /&gt;
&lt;br /&gt;
[http://e-mode.phas.ubc.ca/mce_firmware/ Firmware .hex &amp;amp; .pof Downloads]&lt;br /&gt;
= Revisions =&lt;br /&gt;
== '''Firmware set Rev. 22''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v22_26sep2014.hex&lt;br /&gt;
: no change to cpld code&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: Sync Box default values are set for ACT values: fr=38, num_rows=33, row_len=50&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 21''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v21_02sep2014.pof&lt;br /&gt;
: no change to microcontroller code or *.hex file&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: DV_FTS and DV_POL are now duplicate copies of DV_SPARE1 and DV_SPARE2, respectively. See [http://e-mode.phas.ubc.ca/mcewiki/index.php/Sync_Box_AC-in_Rack_Mount_io IO for rackmount AC-in Sync Box]&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 20''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v20_22aug2013.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: hard-coded Spider values of fr=120, num_rows=33, row_len=53 (which translates to row_len=106 on mce front)&lt;br /&gt;
: firmware revision on rs232 interface now shows 20&lt;br /&gt;
== '''Firmware set Rev. 1f''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v1f_25feb2010.pof&lt;br /&gt;
: sync_box_v1f_25feb2010.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: adds a ckd command to the rs232 interface to adjust the frequency of DV_Spare1 and DV_Spare2 by setting a 50MHz divisor through the command.&lt;br /&gt;
: when you turn on the sync box, the firmware revision 1f appears on the rs232 terminal&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 1e (6e?)''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v6e_11aug2008.pof&lt;br /&gt;
: sync_box_v1c_17nov2006.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
: added a 50MHz clock on SMA output of the Sync box&lt;br /&gt;
&lt;br /&gt;
; Note&lt;br /&gt;
: Since the microcontroller code is still 1c and that is what is reported in rs232 terminal, there is no way to identify this set from a 1c set.&lt;br /&gt;
&lt;br /&gt;
== '''Firmware set Rev. 1c''' ==&lt;br /&gt;
; Filename&lt;br /&gt;
: sync_box_v6c_19oct2006.pof&lt;br /&gt;
: sync_box_v1c_17nov2006.hex&lt;br /&gt;
&lt;br /&gt;
; Features&lt;br /&gt;
original firmware&lt;br /&gt;
&lt;br /&gt;
= Source code =&lt;br /&gt;
The source code for the sync box firmware is available.  Ask UBC for a copy.&lt;br /&gt;
&lt;br /&gt;
[[Category:Firmware]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=U0107_Series_Firmware&amp;diff=6021</id>
		<title>U0107 Series Firmware</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=U0107_Series_Firmware&amp;diff=6021"/>
		<updated>2015-03-17T21:10:24Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: Created page with &amp;quot;This page contains some notes specific to PCI card firmware version U0107 (and friends).  ===Software sources===  The main difference between U0106 and U0107 software is that the…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains some notes specific to PCI card firmware version U0107 (and friends).&lt;br /&gt;
&lt;br /&gt;
===Software sources===&lt;br /&gt;
&lt;br /&gt;
The main difference between U0106 and U0107 software is that the kernel device driver was completely rewritten to enable a new communication protocol and to get away from the dependence on bigphysarea.  This change is largely transparent to end users.&lt;br /&gt;
&lt;br /&gt;
However, the &amp;quot;right version&amp;quot; of MAS must be installed to use U0107.  Instead of &amp;lt;tt&amp;gt;trunk&amp;lt;/tt&amp;gt;, get &amp;lt;tt&amp;gt;branches/driver_hacking/&amp;lt;/tt&amp;gt;.  Efforts are underway to merge this branch into trunk so that U0106 and U0107 can exist, more or less, side-by-side.&lt;br /&gt;
&lt;br /&gt;
There is no special version of mce_script for U0107; old code should work as before.&lt;br /&gt;
&lt;br /&gt;
===Locking the kernel version===&lt;br /&gt;
&lt;br /&gt;
Since U0107+ firmware does not require the bigphysarea patch, the driver must be rebuilt and reinstalled whenever a new Linux kernel is activated.  For now, the best way to avoid this is to avoid upgrading the kernel (note that this carries certain security risks).  To &amp;quot;lock the kernel version&amp;quot;, open the synaptic package manager:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install synaptic&lt;br /&gt;
 sudo syntaptic&lt;br /&gt;
&lt;br /&gt;
Then find &amp;quot;linux-generic&amp;quot; in the package list.  Select that entry, and then go the &amp;quot;Package&amp;quot; menu and select &amp;quot;Lock Version&amp;quot;.  That should turn the entry red, or something.&lt;br /&gt;
&lt;br /&gt;
We may eventually implement DKMS [https://help.ubuntu.com/community/DKMS] to have the driver rebuilt automatically upon kernel upgrade.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=PCI_card_firmware&amp;diff=6020</id>
		<title>PCI card firmware</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=PCI_card_firmware&amp;diff=6020"/>
		<updated>2015-03-17T20:48:31Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* U0107 (pending): alpha */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
UBC-produced firmware for the ARC-64 [[PCI card]].  [[MAS]] provides a linux kernel driver for this firmware.&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
These S-record files should work with any reasonable EEPROM programmer:&lt;br /&gt;
* U0107 (new!) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0107_candidate_2014-05-01.s&lt;br /&gt;
* U0106 (recommended) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0106.s&lt;br /&gt;
** 8-bit checksum 6FCDCE&lt;br /&gt;
** Scrubber file - try writing all ones to your  this to your chip first if your programmer won't let you &amp;quot;erase&amp;quot; it:&lt;br /&gt;
** http://e-mode.phas.ubc.ca/mce/firmware/sdsu/scrubber_RevU0106.s&lt;br /&gt;
* U0105 (deprecated) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0105.s&lt;br /&gt;
* U0104 (deprecated) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0104.s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The full source code is available in these archives (it will not compile unless you get the correct assembler and stuff):&lt;br /&gt;
* U0106 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0106.tar.gz&lt;br /&gt;
* U0105 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0105.tar.gz&lt;br /&gt;
* U0104 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0104.tar.gz&lt;br /&gt;
&lt;br /&gt;
The subversion tree can be obtained like this (you may not have access to this repository; contact UBC);&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/arc_pci&lt;br /&gt;
&lt;br /&gt;
It is laid out roughly as follows:&lt;br /&gt;
 /trunk       main line of development&lt;br /&gt;
 /releases    tagged versions of code &lt;br /&gt;
 /tools       debugging tools&lt;br /&gt;
 /clash       stuff for making CLAS work with wine and linux&lt;br /&gt;
 /docs        useful (though maybe not to you) notes&lt;br /&gt;
&lt;br /&gt;
== Firmware version notes ==&lt;br /&gt;
&lt;br /&gt;
=== U0107 (pending): alpha ===&lt;br /&gt;
&lt;br /&gt;
* This firmware can operate in either of two modes:&lt;br /&gt;
** '''U0106 compatibility mode''': the firmware will work with classic MAS driver, just like U0106 (plus some bugfixes).&lt;br /&gt;
** '''New Master-only mode''': when activated, uses new set of protocols for communication with the MAS driver.  These have proven to be much more stable on some systems.  Also, bigphysarea is no longer needed.&lt;br /&gt;
* This firmware/driver are in limited release; do not attempt to use them without consulting with UBC.&lt;br /&gt;
* Downloads:&lt;br /&gt;
** S-rec for release candidates here: http://e-mode.phas.ubc.ca/mce/firmware/sdsu/&lt;br /&gt;
** Soft-patches for upgrading U0106 to pseudo-U0107 temporarily: http://e-mode.phas.ubc.ca/mce/firmware/sdsu/patches/&lt;br /&gt;
* Some additional notes specific to U0107: [[U0107 Series Firmware]]&lt;br /&gt;
&lt;br /&gt;
=== U0106 (2011-11-21): Recommended version ===&lt;br /&gt;
&lt;br /&gt;
* Backward compatible with U0104 and U0105.&lt;br /&gt;
* Fixes bug introduced in U0105 that prevented handling of some PCI bus errors.&lt;br /&gt;
* Introduction of command to update PCI burst size.&lt;br /&gt;
* Bugs:&lt;br /&gt;
** Versions U0104-6 all suffer from the following issues:&lt;br /&gt;
*** Host interrupts use bit-test instructions, which are not interrupt safe; consequence is a race condition that can upset ongoing tasks such as FO downloads and PCI bursts.  Patch for this issue, applicable to firmware versions U0104-6:&lt;br /&gt;
**** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
*** Multiple simultaneous PCI bus errors are not handled properly, leading to stale bits in the error register.  This is an unlikely error vector, but should be fixed.&lt;br /&gt;
&lt;br /&gt;
=== U0105 (2009-06-08) ===&lt;br /&gt;
&lt;br /&gt;
* Backward compatible with U0104.&lt;br /&gt;
* Support for MCE STOP commands and commands-on-the-fly.&lt;br /&gt;
* Accelerated MCE command code (along with Quiet-RP this increases commanding rate to ~6 kHz).&lt;br /&gt;
* Quiet-RP simplifies the protocol for MCE reply handling.&lt;br /&gt;
* Low-level improvements:&lt;br /&gt;
** CON is done as PCI burst&lt;br /&gt;
** Fibre-optic FIFO is emptied with timed read instead of polling.&lt;br /&gt;
** Hand-shaking for interrupts instead of host command to clear INTA and HC3.&lt;br /&gt;
** Non-interrupt context code disables interrupts when performing PCI transactions.&lt;br /&gt;
** Host vector interrupts are otherwise enabled, so PC doesn't have to force with HNMI bit.&lt;br /&gt;
* Bugs and fixes:&lt;br /&gt;
** Some PCI bus arbitration conditions are mis-handled.  This is fixed in U0106; alternately the commands below can be issued to patch active U0105 firmware.  (The patch will not survive a power cycle.):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0105_unignore_pci_errors.bash&lt;br /&gt;
** Also this (see description in U0106):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
&lt;br /&gt;
=== U0104: First version with non-realtime linux support ===&lt;br /&gt;
&lt;br /&gt;
* Implements quiet transfer mode!  Remains backwards compatible with A1.4.&lt;br /&gt;
* Fixes the 64k boundary crossing issue&lt;br /&gt;
* Moves parameters that enter via interrupt out of registers and into variables&lt;br /&gt;
* Version reporting tag-along to RDM command (sending 'VER' to RDM's vector address returns the code version).&lt;br /&gt;
* Maximum burst length is reduced to 64 bytes, and is configurable.&lt;br /&gt;
* Reset (RST) clears the fibre fifo&lt;br /&gt;
* Bugs:&lt;br /&gt;
** This (see description in U0106):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
&lt;br /&gt;
== U0103: Oldest UBC release ==&lt;br /&gt;
&lt;br /&gt;
* Minor modifications of SCUBA2's A1.4 firmware, to improve PCI stability.&lt;br /&gt;
* Not compatible with non-realtime systems.&lt;br /&gt;
&lt;br /&gt;
== Programming the ARC64 Flash memory ==&lt;br /&gt;
&lt;br /&gt;
To program or upgrade the PCI card's firmware, it is necessary to remove the flash memory chip from the card and program it using a standard EEPROM programmer.&lt;br /&gt;
&lt;br /&gt;
# Obviously you should turn off your computer and stuff first.&lt;br /&gt;
# The chip is a large DIP located at U5 on the PCI board.  To remove the chip you may use one of the following (in increasing order of risk, and decreasing order of barbarism):&lt;br /&gt;
## telekinesis&lt;br /&gt;
## a chip removal tool&lt;br /&gt;
## needle-nose pliers&lt;br /&gt;
## a screw-driver&lt;br /&gt;
## thumb and finger&lt;br /&gt;
## fingers only&lt;br /&gt;
# The chip is a standard 256 Kbit electrically erasable Flash ROM.  If you can't find the particular part in your EEPROM programmer software, try using one of these compatible parts:&lt;br /&gt;
## Fujitsu MBM28C256&lt;br /&gt;
## CSI (Catalyst) CAT28C256 L&lt;br /&gt;
## Anything else that has 28C256 in its name as long as it is a 28-pin DIP package and you are using the right socket for your programmer.&lt;br /&gt;
# Some programmers won't recognize this chip as erasable.  You can just try programming the chip with the new firmware, or pseudo-erasing it first using a &amp;quot;scrubber&amp;quot; file (available for U0106 in the links above).&lt;br /&gt;
# The firmware we provide is compiled into a [ http://en.wikipedia.org/wiki/SREC_%28file_format%29 Motorola S-record format ] hex file.  This is a standard format that your programmer software should be able to cope with.&lt;br /&gt;
# When placing the chip back in the board, the notch on the chip should be at the same end as the notch on the socket.&lt;br /&gt;
&lt;br /&gt;
== Other information ==&lt;br /&gt;
&lt;br /&gt;
* [[ PCI card bug list ]]&lt;br /&gt;
* [[ PCI card hacking ]]&lt;br /&gt;
* [[ PCI card code assembly on Linux ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Firmware]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MAS_user_setup&amp;diff=6019</id>
		<title>MAS user setup</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MAS_user_setup&amp;diff=6019"/>
		<updated>2015-03-12T16:59:46Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Using mas_var */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Care must be taken when adding new users in order that&lt;br /&gt;
&lt;br /&gt;
* the new user can access the MAS binaries, scripts, and IDL projects&lt;br /&gt;
* the new user's actions do not interfere with other users of the system&lt;br /&gt;
&lt;br /&gt;
= Adding a user =&lt;br /&gt;
&lt;br /&gt;
This can be done from the graphical manager, but since you're here you might as well use these commands:&lt;br /&gt;
 MCE_USER=mce&lt;br /&gt;
 sudo useradd -m -g $MCE_USER -s /bin/bash new_user&lt;br /&gt;
 sudo passwd new_user&lt;br /&gt;
&lt;br /&gt;
Note that the primary group of the user should be the &amp;quot;mce&amp;quot; group.  This is so that temporary files can be overwritten by other users.  If you want to use another username as the main MCE user, that should be fine.  Adjust MCE_USER as necessary.&lt;br /&gt;
&lt;br /&gt;
= Setting up the user's environment =&lt;br /&gt;
&lt;br /&gt;
== Using mas_var ==&lt;br /&gt;
&lt;br /&gt;
[[mas_var]] is good at figuring out what your paths should be.  Assuming that MAS has been installed into /usr/mce, add the following to .bashrc:&lt;br /&gt;
&lt;br /&gt;
 # MCE/MAS&lt;br /&gt;
 umask 002&lt;br /&gt;
 eval `/usr/mce/bin/mas_var -s`&lt;br /&gt;
&lt;br /&gt;
== The old way ==&lt;br /&gt;
&lt;br /&gt;
Before [[mas_var]], those paths were more or less hard-coded and you needed something like the following.&lt;br /&gt;
&lt;br /&gt;
Add the following lines at the end of the .bashrc file:&lt;br /&gt;
 # MAS!&lt;br /&gt;
 umask 002&lt;br /&gt;
 source /usr/mce/mce_script/template/mas_env.bash&lt;br /&gt;
&lt;br /&gt;
MAS/IDL users will need to add $MAS_IDL/mas to their path, e.g.&lt;br /&gt;
 IDL_PATH=&amp;quot;&amp;lt;IDL_DEFAULT&amp;gt;:$MAS_IDL/mas&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For additional command-line functionality, engineering users may also want to add&lt;br /&gt;
 source $MAS_SCRIPT/mas_library.bash&lt;br /&gt;
 source $MAS_TEMPLATE/mas_aliases.bash&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Up to [[ MAS ]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MAS_user_setup&amp;diff=6018</id>
		<title>MAS user setup</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MAS_user_setup&amp;diff=6018"/>
		<updated>2015-03-12T16:58:47Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Setting up the user's environment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Care must be taken when adding new users in order that&lt;br /&gt;
&lt;br /&gt;
* the new user can access the MAS binaries, scripts, and IDL projects&lt;br /&gt;
* the new user's actions do not interfere with other users of the system&lt;br /&gt;
&lt;br /&gt;
= Adding a user =&lt;br /&gt;
&lt;br /&gt;
This can be done from the graphical manager, but since you're here you might as well use these commands:&lt;br /&gt;
 MCE_USER=mce&lt;br /&gt;
 sudo useradd -m -g $MCE_USER -s /bin/bash new_user&lt;br /&gt;
 sudo passwd new_user&lt;br /&gt;
&lt;br /&gt;
Note that the primary group of the user should be the &amp;quot;mce&amp;quot; group.  This is so that temporary files can be overwritten by other users.  If you want to use another username as the main MCE user, that should be fine.  Adjust MCE_USER as necessary.&lt;br /&gt;
&lt;br /&gt;
= Setting up the user's environment =&lt;br /&gt;
&lt;br /&gt;
== Using mas_var ==&lt;br /&gt;
&lt;br /&gt;
[[mas_var]] is good at figuring out what your paths should be.  Assuming that MAS has been installed into /usr/mce, add the following to .bashrc:&lt;br /&gt;
&lt;br /&gt;
 # MCE/MAS&lt;br /&gt;
 eval `/usr/mce/bin/mas_var -s`&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The old way ==&lt;br /&gt;
&lt;br /&gt;
Before [[mas_var]], those paths were more or less hard-coded and you needed something like the following.&lt;br /&gt;
&lt;br /&gt;
Add the following lines at the end of the .bashrc file:&lt;br /&gt;
 # MAS!&lt;br /&gt;
 umask 002&lt;br /&gt;
 source /usr/mce/mce_script/template/mas_env.bash&lt;br /&gt;
&lt;br /&gt;
MAS/IDL users will need to add $MAS_IDL/mas to their path, e.g.&lt;br /&gt;
 IDL_PATH=&amp;quot;&amp;lt;IDL_DEFAULT&amp;gt;:$MAS_IDL/mas&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For additional command-line functionality, engineering users may also want to add&lt;br /&gt;
 source $MAS_SCRIPT/mas_library.bash&lt;br /&gt;
 source $MAS_TEMPLATE/mas_aliases.bash&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Up to [[ MAS ]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Mce_cmd&amp;diff=6007</id>
		<title>Mce cmd</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Mce_cmd&amp;diff=6007"/>
		<updated>2015-02-09T23:56:19Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Voluntary lock-out mechanism */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
'''mce_cmd''' provides an interface between a Linux shell and the MCE.  The application can run interactively (accepting commands from a user and issuing responses to stdout), or can be used to execute scripts containing mce_cmd instructions.&lt;br /&gt;
&lt;br /&gt;
= Running mce_cmd =&lt;br /&gt;
&lt;br /&gt;
== Usage summary ==&lt;br /&gt;
&lt;br /&gt;
 mce_cmd [options] [-x cmd...]&lt;br /&gt;
 &lt;br /&gt;
  -i                     interactive mode, don't exit on errors&lt;br /&gt;
  -q                     quiet mode, only print errors or output data&lt;br /&gt;
  -p                     prefix-supression, don't print line number&lt;br /&gt;
  -e                     echo mode, print each command as well as response&lt;br /&gt;
  -r                     don't use readline on stdin (faster input in scripts)&lt;br /&gt;
 &lt;br /&gt;
  -n &amp;lt;card number&amp;gt;       use the specified fibre card ([[Multicard MAS]] only)&lt;br /&gt;
  -c &amp;lt;file&amp;gt;              choose a particular mce config file (mce.cfg)&lt;br /&gt;
  -m &amp;lt;file&amp;gt;              choose a particular MAS config file (mas.cfg)&lt;br /&gt;
  -f &amp;lt;batch file&amp;gt;        run commands from file instead of stdin&lt;br /&gt;
  -X &amp;quot;cmd string&amp;quot;        execute this command and exit (these can be stacked)&lt;br /&gt;
  -o &amp;lt;directory&amp;gt;         data file path&lt;br /&gt;
 &lt;br /&gt;
  -x &amp;lt;command&amp;gt;           execute remainder of line as an mce_cmd command&lt;br /&gt;
                         The -X command may be more useful as it allows multiple&lt;br /&gt;
                         commands to be executed, e.g.&lt;br /&gt;
                              mce_cmd -X &amp;quot;acq_config test_1 rc1&amp;quot; -X &amp;quot;acq_go 100&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  -v                     print version string and exit&lt;br /&gt;
&lt;br /&gt;
== Interactive mode ==&lt;br /&gt;
&lt;br /&gt;
When invoked with the '-i' option, mce_cmd can be used interactively.  A session command history (similar to the one in bash) can be accessed with the up and down arrow keys, and line editing is possible using emacs-based key-mappings.&lt;br /&gt;
 mce_cmd -i&lt;br /&gt;
&lt;br /&gt;
After displaying a version message, mce_cmd will be ready to accept input.  There is no user prompt.&lt;br /&gt;
&lt;br /&gt;
== Single command execution ==&lt;br /&gt;
&lt;br /&gt;
A single command can be issued using the '-x' option:&lt;br /&gt;
 mce_cmd -x rb cc {{param||fw_rev}}&lt;br /&gt;
The application will execute the command, display any output, and exit.&lt;br /&gt;
&lt;br /&gt;
Multiple commands may be executed with the '-X' option.  The commands are executed in order, in the same context.  The command must be passed as a single shell argument (put it in quotes...):&lt;br /&gt;
 mce_cmd -X &amp;quot;wb rc1 {{param|rc|data_mode}} 4&amp;quot; -X &amp;quot;wb rca {{param|rc|servo_mode}} 1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Script execution ==&lt;br /&gt;
&lt;br /&gt;
The '-f' option tell mce_cmd to read lines from the specified file and attempt to execute them.  The '-q' option suppresses unnecessary output.&lt;br /&gt;
 mce_cmd -q -f my_script.scr&lt;br /&gt;
&lt;br /&gt;
When redirecting commands to mce_cmd, the '-r' option should be used to disable the command history/line editing features of mce_cmd and decrease the execution time.&lt;br /&gt;
 cat my_script.scr | mce_cmd -q -r&lt;br /&gt;
&lt;br /&gt;
If a script command fails, mce_cmd will exit.  To suppress that behaviour (and continue attempting commands even after one of them has failed), pass the '-i' option.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Commands =&lt;br /&gt;
&lt;br /&gt;
We can break the mce_cmd command set into three broad categories: MCE commands, data acquisition commands, and output formatting commands.  Commands are case insensitive.&lt;br /&gt;
&lt;br /&gt;
== Special hardware commands ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;MCE_RESET&amp;quot;&amp;gt;&lt;br /&gt;
=== MCE_RESET: reset the MCE firmware using special character override ===&lt;br /&gt;
&lt;br /&gt;
The '''mce_reset''' command causes the PCI card to transmit a special character (0x0b) over the fibre-optic connection to the MCE. This command was originally invented to clear the cmd/reply path when either of fibre or backplane communication is frozen.  A tiny sniffer block in clock-card of the MCE detects this special character and asserts the mce_bclr line, which subsequently resets (only) the firmware on each MCE card.&lt;br /&gt;
&lt;br /&gt;
Upon firmware reset, all state machines go to idle, register-based variables are reset to 0, but RAM-based variables stay unchanged. A firmware reset does '''not''' refresh the DAC outputs. Note that after an '''mce_reset''', not all of the DAC outputs are set to zero.&lt;br /&gt;
&lt;br /&gt;
'''mce_reset''' may lead to misleading information from [[mce_status]], and '''rb''' commands in general.  For example, &amp;lt;code&amp;gt;flux_fb&amp;lt;/code&amp;gt;s are stored in registers which are overwritten by zero upon '''mce_reset'''.  But '''mce_reset''' does not cause a rewrite of the DAC outputs.  So, after a reset, '''rb flux_fb''' will report zero even if the actual flux_fb being applied is not zero.  Other registers, such as &amp;lt;code&amp;gt;servo_mode&amp;lt;/code&amp;gt;, which get reset, ''do'' affect the operation of MCE.  Registers can only reinitialised by rewriting them (via a '''wb''' command).  In gerenal, a &amp;lt;code&amp;gt;mce_reconfig&amp;lt;/code&amp;gt; is recommended after '''mce_reset''' to ensure the system is properly configured.&lt;br /&gt;
&lt;br /&gt;
It is advisable to wait several microseconds following the '''mce_reset''' command before issuing other MCE commands. &lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 mce_reset&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;DSP_RESET&amp;quot;&amp;gt;&lt;br /&gt;
=== DSP_RESET: reset the PCI card DSP firmware ===&lt;br /&gt;
&lt;br /&gt;
The '''dsp_reset''' command causes the PCI card to reset.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 dsp_reset&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Special driver access commands ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;FAKESTOP&amp;quot;&amp;gt;&lt;br /&gt;
=== FAKESTOP: cause the driver to issue a stop-frame ===&lt;br /&gt;
&lt;br /&gt;
In some cases an acquisition can hang because it has not received as many frames as it expected, and did not see a frame with the STOP bit set.  The '''fakestop''' command triggers the driver to generate one or two data frames and place them in the output buffer.  The last such frame will have the STOP bit set.  An mce_cmd session that is acquiring data will receive the frame, see the STOP bit, and exit.&lt;br /&gt;
&lt;br /&gt;
Note that in the absence of a data consumer, this command will leave frames outstanding in the data buffer.  It is prudent to issue an '''empty''' command after issuing '''fakestop'''.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 fakestop&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;EMPTY&amp;quot;&amp;gt;&lt;br /&gt;
=== EMPTY: cause the driver to empty the output data buffer ===&lt;br /&gt;
&lt;br /&gt;
In some cases, following a failed acquisition, the output data buffer of the driver may contain residual data.  This can lead to the failure of subsequent acquisitions.  The '''empty''' command causes the driver to update its pointers such that no data is retained.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 empty&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;FRAME&amp;quot;&amp;gt;&lt;br /&gt;
=== FRAME: set driver and PCI card frame-data size ===&lt;br /&gt;
&lt;br /&gt;
To acquire data without an associated data handler (to write the data to disk), it is necessary to inform the driver and PCI card of the expected frame size.  This is accomplished by passing the frame size, in 32-bit words, to the command '''frame'''.  If data acquisition is triggered (with the low-level '''go''' command, for example), and the driver/PCI card have not been informed of the frame size, the PCI card will simply discard the data.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 frame &amp;lt;int&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Scripting and output formatting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;SLEEP&amp;quot;&amp;gt;&lt;br /&gt;
=== SLEEP: delay execution for some number of microseconds ===&lt;br /&gt;
&lt;br /&gt;
Note that the delays smaller than a few milliseconds cannot be commanded reliably.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 sleep &amp;lt;microseconds&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;DISPLAY&amp;quot;&amp;gt;&lt;br /&gt;
=== DISPLAY: change integer output base ===&lt;br /&gt;
&lt;br /&gt;
The output from MCE read commands is displayed in decimal or hex, depending on the mce.cfg configuration.  To override this, decimal ('''dec''') or hexadecimal ('''hex''') output can be forced with the '''display''' command.  Passing '''def''' will return mce_cmd to its default behaviour.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 display [ def | dec | hex ]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ECHO&amp;quot;&amp;gt;&lt;br /&gt;
=== ECHO: echo commands to the terminal ===&lt;br /&gt;
&lt;br /&gt;
In some scripting situations it may be useful to have commands echoed to the terminal along with their responses.  This can be turned on and off by passing 1 or 0 to the '''echo''' command.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 echo [ 0 | 1 ]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MCE data block commands ==&lt;br /&gt;
&lt;br /&gt;
MCE configuration data is stored in blocks at certain card and parameter addresses (which we will call &amp;quot;block locations&amp;quot;).  A typical block address is&lt;br /&gt;
 rc2 {{param|rc|flx_quanta0|flx_quanta4}}&lt;br /&gt;
This block consists of 41 32-bit words where the user writes the squid-1 flux quantum size for column 4 on readout card 2.&lt;br /&gt;
&lt;br /&gt;
The most basic data manipulation commands are RB (&amp;quot;read block&amp;quot;) and WB (&amp;quot;write block&amp;quot;).  These commands read from or write to the entire range of data at the block location, starting at the beginning of the block.&lt;br /&gt;
&lt;br /&gt;
The commands RRA (&amp;quot;read range&amp;quot;) and WRA (&amp;quot;write range&amp;quot;) can be used to read or write particular subranges of the data in a block location.&lt;br /&gt;
&lt;br /&gt;
All read and write commands take a card (or [[virtual card]]s) name and a parameter name as the first two arguments.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;RB&amp;quot;&amp;gt;&lt;br /&gt;
=== RB: read block ===&lt;br /&gt;
&lt;br /&gt;
The read block ('''rb''') command returns the entire contents of a block location.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rb  &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
 rb rc1 {{param|rc|adc_offset0}}&lt;br /&gt;
 Line   1 : ok : 10 11 9 8 12 13 14 15&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;WB&amp;quot;&amp;gt;&lt;br /&gt;
=== WB: write block ===&lt;br /&gt;
&lt;br /&gt;
The write block ('''wb''') command writes the given data to the specified block location.  If the number of data is smaller than block size, the remaining block elements will not be altered.  If the number of data is larger than the block size, the behaviour depends on the implementation of the block location.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 wb  &amp;lt;card&amp;gt; &amp;lt;param&amp;gt; [val0 val1 val2 ...]&lt;br /&gt;
Example:&lt;br /&gt;
 wb rc1 {{param|rc|adc_offset0}} 0 1 2&lt;br /&gt;
 Line   1 : ok&lt;br /&gt;
 rb rc1 {{param|rc|adc_offset0}}&lt;br /&gt;
 Line   2 : ok :  0 1 2 8 12 13 14 15&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;RRA&amp;quot;&amp;gt;&lt;br /&gt;
=== RRA: read range ===&lt;br /&gt;
&lt;br /&gt;
The read range ('''rra''') command returns &amp;lt;count&amp;gt; values from the block location, starting from the value at &amp;lt;start_index&amp;gt; (indexed from 0).&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rra &amp;lt;card&amp;gt; &amp;lt;param&amp;gt; &amp;lt;start_index&amp;gt; &amp;lt;count&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
 rra rc1 {{param|rc|adc_offset0}} 2 4&lt;br /&gt;
 Line   1 : ok : 2 8 12 13&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;WRA&amp;quot;&amp;gt;&lt;br /&gt;
=== WRA: write range ===&lt;br /&gt;
&lt;br /&gt;
The write range ('''wra''') command writes the given values into the block location, starting at &amp;lt;start_index&amp;gt; (indexed from 0).  Other block data (i.e. at indices lower than start_index) are not changed.  (This command is implemented as a read-update-write and will usually take twice as long to execute as a '''wb''' command.)&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 wra &amp;lt;card&amp;gt; &amp;lt;param&amp;gt; &amp;lt;start_index&amp;gt; [val0 val1 val2 ...]&lt;br /&gt;
Example:&lt;br /&gt;
 wra rc1 {{param|rc|adc_offset0}} 4 100 200&lt;br /&gt;
 Line   1 : ok&lt;br /&gt;
 rb rc1 {{param|rc|adc_offset0}}&lt;br /&gt;
 Line   2 : ok :  0 1 2 8 100 200 14 15&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MCE data acquisition commands ==&lt;br /&gt;
&lt;br /&gt;
The acquisition of frame data is achieved by first configuring an output system (by specifying an output format, filename, and the target readout cards), and then by issuing '''acq_go''' commands to acquire frames.&lt;br /&gt;
&lt;br /&gt;
This simplest example will acquire 1000 frames from rc2 into the file /data/cryo/current_data/test:&lt;br /&gt;
 acq_config /data/cryo/current_data/test rc2&lt;br /&gt;
 Line   1 : ok&lt;br /&gt;
 acq_go 1000&lt;br /&gt;
 Line   2 : ok&lt;br /&gt;
&lt;br /&gt;
The configuration commands have mnemonics that begin with '''acq_config'''.  They allow a small variety of output formats.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_CONFIG&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_CONFIG: configure simple MCE frame file ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_CONFIG''' command configures a single output file to receive MCE frames.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_config &amp;lt;filename&amp;gt; &amp;lt;readout_card&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_config test1.dat rc2&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_CONFIG_FS&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_CONFIG_FS: configure file-sequenced MCE frame file ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_CONFIG_FS''' command will result in the outputting of the frame data into a set of files whose filename contains an increasing index.  The output file is changed after &amp;lt;change_interval&amp;gt; frames.  The output files will be called &amp;lt;filename&amp;gt;.000, &amp;lt;filename&amp;gt;.001, etc.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_config_fs &amp;lt;filename&amp;gt; &amp;lt;readout_card&amp;gt; &amp;lt;change_interval&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_CONFIG_DIRFILE&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_CONFIG_DIRFILE and ACQ_CONFIG_DIRFILE_FS: dirfile-based acquisitions ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_CONFIG_DIRFILE''' and '''ACQ_CONFIG_DIRFILE_FS''' commands behave analogously to '''ACQ_CONFIG''' and '''ACQ_CONFIG_FS''' except they acquire data to a [http://getdata.sourceforge.net/dirfile.html Dirfile] instead of to a MCE frame file.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_config_dirfile &amp;lt;dirfilename&amp;gt; &amp;lt;readout_card&amp;gt;&lt;br /&gt;
and:&lt;br /&gt;
 acq_config_dirfile_fs &amp;lt;dirfilename&amp;gt; &amp;lt;readout_card&amp;gt; &amp;lt;change_interval&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_GO&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_GO: acquire frame data ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_GO''' command causes the MCE to begin acquiring data.  The frame data will be stored according to the most recent '''ACQ_CONFIG...''' command.  It is not usually necessary to reconfigure the output system (i.e. perform another '''ACQ_CONFIG''') between '''ACQ_GO''' commands.  The exception to this is that if the frame structure changes (i.e. &amp;quot;cc {{param|cc|num_rows_reported}}&amp;quot; is altered), then '''ACQ_CONFIG''' should be issued again so that the acquisition system can determine the frame size. &lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_go &amp;lt;frame_count&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_config tes_bias_ramp rc1&lt;br /&gt;
 wb tes bias 5 5 5&lt;br /&gt;
 acq_go 1&lt;br /&gt;
 wb tes bias 10 10 10&lt;br /&gt;
 acq_go 1&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_PATH&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_PATH: set the default path for data output ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_PATH''' command sets the default output directory for frame data.  This path is only applied if the filenames given in an '''ACQ_CONFIG...''' do not specify a relative path.  The given path can be absolute, or relative to the mce_cmd's run-time working directory.  The default output location can also be specified using the '-o' command line option.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_path &amp;lt;path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_path /data/cryo/current_data&lt;br /&gt;
 acq_config test1 rc1&lt;br /&gt;
 acq_go 10&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_LINK&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_LINK: turn on updating a symlink to the current acquisition ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_LINK''' command specifies the name of a symlink which will be created/retargeted to a current acquisition.  This command only schedules the creation/retargeting of the link.  The link is modified by an '''ACQ_CONFIG...'''.  As a result this command must be used before an '''ACQ_CONFIG...''' for it to do anything.  As with the filename specified in '''ACQ_CONFIG''' and friends, if the specified name is not an absolute path, the path specified by '''ACQ_PATH''' or the -o option will be prepended.  If doing a sequencing acquisition (either '''ACQ_CONFIG_FS''' or '''ACQ_CONFIG_DIRFILE_FS''') the link will be updated whenever a new file is started.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_link &amp;lt;name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_path /data/cryo/current_data&lt;br /&gt;
 acq_link mas.lnk&lt;br /&gt;
 acq_config test1 rc1&lt;br /&gt;
 acq_go 10&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_OPTION&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_OPTION: set various acquisition options ===&lt;br /&gt;
The '''ACQ_OPTION''' command allows you to modify various optional parameters for a particular acquisition.  Options are grouped by acquisition type (either &amp;quot;dirfile&amp;quot; or &amp;quot;flatfile&amp;quot;, ignoring sequencing), and vary between acquisition type.  They must be specified before configuration to take effect.  Options are not persistent: an '''ACQ_CONFIG'''-type command consumes and then resets all relevant options to their default value after configuration (so '''ACQ_CONFIG_DIRFILE''' and '''ACQ_CONFIG_DIRFILE_FS''' reset the dirfile options after applying them to the acquisition it is configuring, but '''ACQ_CONFIG''' will neither reset nor use them).&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_option &amp;lt;acq_type&amp;gt; &amp;lt;option_name&amp;gt; &amp;lt;option_value&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently, only &amp;lt;tt&amp;gt;acq_type&amp;lt;/tt&amp;gt; &amp;quot;dirfile&amp;quot; has any options.  These are:&lt;br /&gt;
* &amp;lt;tt&amp;gt;'''include''' &amp;lt;filename&amp;gt;&amp;lt;/tt&amp;gt;: copies contents of the specified file to the output dirfile metadata.  The file is copied verbatim, but the contents are not verified by MAS to see if it makes sense to use it as dirfile metadata.  Default is the empty string, indicating no inclusion.  If &amp;lt;filename&amp;gt; is a relative path, it will be to the current directory.  (ie. it ignores both the -o option and '''ACQ_PATH''')&lt;br /&gt;
* &amp;lt;tt&amp;gt;'''spf''' &amp;lt;number&amp;gt;&amp;lt;/tt&amp;gt;: sets the samples-per-frame of the fields in the dirfile to the specified value, which must be positive.  Default is one.&lt;br /&gt;
* &amp;lt;tt&amp;gt;'''version''' &amp;lt;number&amp;gt;&amp;lt;/tt&amp;gt;: sets the [http://getdata.sourceforge.net/dirfile.html Dirfile Standards Version] used to write the dirfile metadata.  This can be any integer greater than or equal to 3 (a smaller number results in the default, 7, being used), but only a few values are really of interest:&lt;br /&gt;
** Versions &amp;lt; 7 are unable to properly extract signed bitfields from the packed MCE data.  This affects [[data mode]]s 4, 5, 7, and 10.&lt;br /&gt;
** Versions &amp;gt; 4 can't be read by default builds of kst-1.x. (It is possible to build kst-1.x against a modern GetData library, making newer Dirfiles readable, although I don't think any distro shipping kst-1 has done this.)&lt;br /&gt;
:Setting this to 4 should recover the behaviour of older versions of MAS.  Also note: the dirfile formatted runfile metadata output by &amp;quot;&amp;lt;tt&amp;gt;[[mce_status]] -d&amp;lt;/tt&amp;gt;&amp;quot; requires at least Version 8 to parse, but does not depend on, nor is affected by, the Version number specified here.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_option dirfile include /path/to/extra/format_metadata&lt;br /&gt;
 acq_option dirfile version 4&lt;br /&gt;
 acq_link mas.lnk&lt;br /&gt;
 acq_config_dirfile test1 rc1&lt;br /&gt;
 acq_go 10&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_MULTI_BEGIN&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_MULTI_BEGIN and ACQ_MULTI_END: manage multiple output syncs ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to output to multiple files at the same time (e.g. to record a dirfile and a flatfile simultaneously).  This is achieved my putting mce_cmd into &amp;quot;multisync&amp;quot; mode, creating a few different output configurations with an '''ACQ_CONFIG...''', and then issuing '''ACQ_GO'''.  The '''ACQ_MULTI_BEGIN''' command clears the acquisition stack and puts mce_cmd into multisync mode.  The '''ACQ_MULTI_END''' command clears the acquisition stack and disables multisync mode.  An '''ACQ_MULTI_END''' command is implicitly executed when &amp;lt;tt&amp;gt;mce_cmd&amp;lt;/tt&amp;gt; exits, so it is not usually necessary to execute this command explicitly.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_multi_begin&lt;br /&gt;
 acq_multi_end&lt;br /&gt;
&lt;br /&gt;
Example (output to flatfile and dirfile simultaneously):&lt;br /&gt;
 acq_multi_begin&lt;br /&gt;
 acq_config 1234560000_flat rcs&lt;br /&gt;
 acq_config_dirfile 1234560000_dirfile rcs&lt;br /&gt;
 acq_go 164000&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Voluntary lock-out mechanism ==&lt;br /&gt;
&lt;br /&gt;
The driver supports a voluntary lock-out mechanism to help prevent two agents from accessing the MCE simultaneously.  The MAS driver, API, and mce_cmd provide convenient access to a locking mechanism, but the user must add the appropriate calls into their acquisition scripts.  The general idea is:&lt;br /&gt;
* An acquisition script should issue &amp;quot;LOCK_DOWN&amp;quot; to acquire The Lock for a given MCE.&lt;br /&gt;
* If the LOCK_DOWN fails, it is because some other process holds the lock.&lt;br /&gt;
* The script can release The Lock by issuing LOCK_UP.&lt;br /&gt;
* If mce_cmd exits while The Lock is held, The Lock will '''automatically''' be released (this is so that random crashes do not leave The Lock locked).&lt;br /&gt;
&lt;br /&gt;
=== LOCK_DOWN: acquire lock ===&lt;br /&gt;
&lt;br /&gt;
Issuing '''LOCK_DOWN''' causes the driver to check the lock for the target PCI card.  If the lock is available, it is acquired.  Subsequent attemps to LOCK_DOWN will fail, whether they come from other processes or the present process.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 lock_down&lt;br /&gt;
&lt;br /&gt;
=== LOCK_UP: release lock ===&lt;br /&gt;
&lt;br /&gt;
Issuing '''LOCK_UP''' causes the lock to be released.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 lock_up&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LOCK_QUERY: check state of lock ===&lt;br /&gt;
&lt;br /&gt;
The '''LOCK_QUERY''' command allows a script to inspect the state of the lock.  The output from the command is '''1''' if the lock is held, and '''0''' if the lock is free.  (We recognize that this conflicts with the usual counting strategy for semaphores.)&lt;br /&gt;
&lt;br /&gt;
Note that if LOCK_QUERY returns 1, that is not a guarantee that LOCK_DOWN will succeed.  But if you hurry, maybe it will.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 lock_query&lt;br /&gt;
&lt;br /&gt;
=== LOCK_RESET: reset state of lock ===&lt;br /&gt;
&lt;br /&gt;
The lock can be forcefully reset (to the unlocked state) with the LOCK_RESET command.  Note that using LOCK_RESET in a script is likely to defeat the point of the locking mechanism.  It is mostly for hacking.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 lock_reset&lt;br /&gt;
&lt;br /&gt;
== Low-level MCE commands ==&lt;br /&gt;
&lt;br /&gt;
=== GO ===&lt;br /&gt;
&lt;br /&gt;
Issuing '''GO''' sends a MCE command packet to the MCE, but with no associated additional processing.  That is, even though '''GO''' causes the MCE to produce frame data, the frames will not be stored to disk and they will either accumulate in the driver's buffer or be discarded by the PCI card if they are not of the expected size.  In general, the MAS acquisition system ('''[[#ACQ_GO|ACQ_GO]]''', &amp;amp;c.) should be used instead of sending this command directly.&lt;br /&gt;
&lt;br /&gt;
The only parameter which responds to '''GO''' is the readout card's {{param|rc|ret_dat}} parameter.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 go &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== STOP ===&lt;br /&gt;
:''See: [[The STOP Command]]''&lt;br /&gt;
The '''STOP''' command is intended for terminating MCE frame data acquisitions.  The only parameter which responds to '''STOP''' is the readout card's {{param|rc|ret_dat}} parameter.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 stop &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
 stop rcs {{param|rc|ret_dat}}&lt;br /&gt;
&lt;br /&gt;
=== RS ===&lt;br /&gt;
&lt;br /&gt;
The '''RS''' command is used to activate a few special command registers.   Registers which use '''RS''' have the type '''rs''' in the [[MCE commands]] list.  They are mostly commands which reset devices in the MCE ('''RS''' stands for ''reset''), which means they must reply to the request before executing the command, unlike a normal '''WB''' command, which replies after execution.&lt;br /&gt;
&lt;br /&gt;
Note: although the [[MCE commands|command list]] indicates that RS commands take a single parameter with a value of '''1''', this is not needed when calling the command from MAS.  MAS ignores parameters passed to a RS command and will always issue the command with the '''1''' datum.  So, don't pass any data to a RS command.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rs &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 rs cc {{param|cc|config_fac}}&lt;br /&gt;
&lt;br /&gt;
== Raw commands ==&lt;br /&gt;
&lt;br /&gt;
In addition to the formatted commanding discussed above, raw reads and writes can be issued to the MCE by specifying numeric register addresses (and, optionally, a numeric card address).  Raw commands can be used to access command registers which are not defined in the hardware description file ([[mce.cfg]]).&lt;br /&gt;
&lt;br /&gt;
The numeric address of a physical card is its {{param||slot_id}}.  The special card '''rcs''' has a numeric address of &amp;lt;tt&amp;gt;0x0B&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rb &amp;lt;card&amp;gt; &amp;lt;register&amp;gt; &amp;lt;count&amp;gt; [multiplier]&lt;br /&gt;
 wb &amp;lt;card&amp;gt; &amp;lt;register&amp;gt; &amp;lt;datum&amp;gt; [val0 val1 val2 ...]&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
 # read one sample from the clock card {{param||led}} register&lt;br /&gt;
 rb cc 0x99 1&lt;br /&gt;
 &lt;br /&gt;
 # the same, but by card address:&lt;br /&gt;
 rb 0x02 0x99 1&lt;br /&gt;
&lt;br /&gt;
Because these requests bypass the command definitions in the hardware description file, a count of data to be returned must be specified with a read (RB) request.  Raw commands cannot be issued to the virtual card mappings implemented by MAS ('''tes''', '''sq1''', '''sq2''', &amp;amp;c.), nor the multi-address physical cards '''rca''' and '''sys'''.&lt;br /&gt;
&lt;br /&gt;
= Output formatting =&lt;br /&gt;
&lt;br /&gt;
Normally, mce_cmd produces a line of output following each command. The output consists of two or three parts, separated by colons.  If in line prefix mode (which is the default) the output is:&lt;br /&gt;
 Line &amp;lt;line number&amp;gt;: &amp;lt;success&amp;gt; [: data ... ]&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;success&amp;gt; indicator will be &amp;quot;ok&amp;quot; if the command succeeded, or &amp;quot;error&amp;quot; otherwise.  Successful commands may return data (for example, an RB command).  Failed commands will always return an error message as the data.&lt;br /&gt;
&lt;br /&gt;
If mce_cmd is invoked with prefixes turned off ('-p'), the output format is&lt;br /&gt;
 &amp;lt;success&amp;gt; [: data]&lt;br /&gt;
&lt;br /&gt;
If mce_cmd is invoked in quiet mode ('q'), then all command responses that have no output data are suppressed.  In quiet mode, &amp;quot;Line 12: ok&amp;quot; will not be displayed.&lt;br /&gt;
&lt;br /&gt;
[[Category: Software]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Mce_cmd&amp;diff=6006</id>
		<title>Mce cmd</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Mce_cmd&amp;diff=6006"/>
		<updated>2015-02-09T23:28:23Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
'''mce_cmd''' provides an interface between a Linux shell and the MCE.  The application can run interactively (accepting commands from a user and issuing responses to stdout), or can be used to execute scripts containing mce_cmd instructions.&lt;br /&gt;
&lt;br /&gt;
= Running mce_cmd =&lt;br /&gt;
&lt;br /&gt;
== Usage summary ==&lt;br /&gt;
&lt;br /&gt;
 mce_cmd [options] [-x cmd...]&lt;br /&gt;
 &lt;br /&gt;
  -i                     interactive mode, don't exit on errors&lt;br /&gt;
  -q                     quiet mode, only print errors or output data&lt;br /&gt;
  -p                     prefix-supression, don't print line number&lt;br /&gt;
  -e                     echo mode, print each command as well as response&lt;br /&gt;
  -r                     don't use readline on stdin (faster input in scripts)&lt;br /&gt;
 &lt;br /&gt;
  -n &amp;lt;card number&amp;gt;       use the specified fibre card ([[Multicard MAS]] only)&lt;br /&gt;
  -c &amp;lt;file&amp;gt;              choose a particular mce config file (mce.cfg)&lt;br /&gt;
  -m &amp;lt;file&amp;gt;              choose a particular MAS config file (mas.cfg)&lt;br /&gt;
  -f &amp;lt;batch file&amp;gt;        run commands from file instead of stdin&lt;br /&gt;
  -X &amp;quot;cmd string&amp;quot;        execute this command and exit (these can be stacked)&lt;br /&gt;
  -o &amp;lt;directory&amp;gt;         data file path&lt;br /&gt;
 &lt;br /&gt;
  -x &amp;lt;command&amp;gt;           execute remainder of line as an mce_cmd command&lt;br /&gt;
                         The -X command may be more useful as it allows multiple&lt;br /&gt;
                         commands to be executed, e.g.&lt;br /&gt;
                              mce_cmd -X &amp;quot;acq_config test_1 rc1&amp;quot; -X &amp;quot;acq_go 100&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  -v                     print version string and exit&lt;br /&gt;
&lt;br /&gt;
== Interactive mode ==&lt;br /&gt;
&lt;br /&gt;
When invoked with the '-i' option, mce_cmd can be used interactively.  A session command history (similar to the one in bash) can be accessed with the up and down arrow keys, and line editing is possible using emacs-based key-mappings.&lt;br /&gt;
 mce_cmd -i&lt;br /&gt;
&lt;br /&gt;
After displaying a version message, mce_cmd will be ready to accept input.  There is no user prompt.&lt;br /&gt;
&lt;br /&gt;
== Single command execution ==&lt;br /&gt;
&lt;br /&gt;
A single command can be issued using the '-x' option:&lt;br /&gt;
 mce_cmd -x rb cc {{param||fw_rev}}&lt;br /&gt;
The application will execute the command, display any output, and exit.&lt;br /&gt;
&lt;br /&gt;
Multiple commands may be executed with the '-X' option.  The commands are executed in order, in the same context.  The command must be passed as a single shell argument (put it in quotes...):&lt;br /&gt;
 mce_cmd -X &amp;quot;wb rc1 {{param|rc|data_mode}} 4&amp;quot; -X &amp;quot;wb rca {{param|rc|servo_mode}} 1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Script execution ==&lt;br /&gt;
&lt;br /&gt;
The '-f' option tell mce_cmd to read lines from the specified file and attempt to execute them.  The '-q' option suppresses unnecessary output.&lt;br /&gt;
 mce_cmd -q -f my_script.scr&lt;br /&gt;
&lt;br /&gt;
When redirecting commands to mce_cmd, the '-r' option should be used to disable the command history/line editing features of mce_cmd and decrease the execution time.&lt;br /&gt;
 cat my_script.scr | mce_cmd -q -r&lt;br /&gt;
&lt;br /&gt;
If a script command fails, mce_cmd will exit.  To suppress that behaviour (and continue attempting commands even after one of them has failed), pass the '-i' option.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Commands =&lt;br /&gt;
&lt;br /&gt;
We can break the mce_cmd command set into three broad categories: MCE commands, data acquisition commands, and output formatting commands.  Commands are case insensitive.&lt;br /&gt;
&lt;br /&gt;
== Special hardware commands ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;MCE_RESET&amp;quot;&amp;gt;&lt;br /&gt;
=== MCE_RESET: reset the MCE firmware using special character override ===&lt;br /&gt;
&lt;br /&gt;
The '''mce_reset''' command causes the PCI card to transmit a special character (0x0b) over the fibre-optic connection to the MCE. This command was originally invented to clear the cmd/reply path when either of fibre or backplane communication is frozen.  A tiny sniffer block in clock-card of the MCE detects this special character and asserts the mce_bclr line, which subsequently resets (only) the firmware on each MCE card.&lt;br /&gt;
&lt;br /&gt;
Upon firmware reset, all state machines go to idle, register-based variables are reset to 0, but RAM-based variables stay unchanged. A firmware reset does '''not''' refresh the DAC outputs. Note that after an '''mce_reset''', not all of the DAC outputs are set to zero.&lt;br /&gt;
&lt;br /&gt;
'''mce_reset''' may lead to misleading information from [[mce_status]], and '''rb''' commands in general.  For example, &amp;lt;code&amp;gt;flux_fb&amp;lt;/code&amp;gt;s are stored in registers which are overwritten by zero upon '''mce_reset'''.  But '''mce_reset''' does not cause a rewrite of the DAC outputs.  So, after a reset, '''rb flux_fb''' will report zero even if the actual flux_fb being applied is not zero.  Other registers, such as &amp;lt;code&amp;gt;servo_mode&amp;lt;/code&amp;gt;, which get reset, ''do'' affect the operation of MCE.  Registers can only reinitialised by rewriting them (via a '''wb''' command).  In gerenal, a &amp;lt;code&amp;gt;mce_reconfig&amp;lt;/code&amp;gt; is recommended after '''mce_reset''' to ensure the system is properly configured.&lt;br /&gt;
&lt;br /&gt;
It is advisable to wait several microseconds following the '''mce_reset''' command before issuing other MCE commands. &lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 mce_reset&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;DSP_RESET&amp;quot;&amp;gt;&lt;br /&gt;
=== DSP_RESET: reset the PCI card DSP firmware ===&lt;br /&gt;
&lt;br /&gt;
The '''dsp_reset''' command causes the PCI card to reset.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 dsp_reset&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Special driver access commands ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;FAKESTOP&amp;quot;&amp;gt;&lt;br /&gt;
=== FAKESTOP: cause the driver to issue a stop-frame ===&lt;br /&gt;
&lt;br /&gt;
In some cases an acquisition can hang because it has not received as many frames as it expected, and did not see a frame with the STOP bit set.  The '''fakestop''' command triggers the driver to generate one or two data frames and place them in the output buffer.  The last such frame will have the STOP bit set.  An mce_cmd session that is acquiring data will receive the frame, see the STOP bit, and exit.&lt;br /&gt;
&lt;br /&gt;
Note that in the absence of a data consumer, this command will leave frames outstanding in the data buffer.  It is prudent to issue an '''empty''' command after issuing '''fakestop'''.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 fakestop&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;EMPTY&amp;quot;&amp;gt;&lt;br /&gt;
=== EMPTY: cause the driver to empty the output data buffer ===&lt;br /&gt;
&lt;br /&gt;
In some cases, following a failed acquisition, the output data buffer of the driver may contain residual data.  This can lead to the failure of subsequent acquisitions.  The '''empty''' command causes the driver to update its pointers such that no data is retained.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 empty&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;FRAME&amp;quot;&amp;gt;&lt;br /&gt;
=== FRAME: set driver and PCI card frame-data size ===&lt;br /&gt;
&lt;br /&gt;
To acquire data without an associated data handler (to write the data to disk), it is necessary to inform the driver and PCI card of the expected frame size.  This is accomplished by passing the frame size, in 32-bit words, to the command '''frame'''.  If data acquisition is triggered (with the low-level '''go''' command, for example), and the driver/PCI card have not been informed of the frame size, the PCI card will simply discard the data.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 frame &amp;lt;int&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Scripting and output formatting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;SLEEP&amp;quot;&amp;gt;&lt;br /&gt;
=== SLEEP: delay execution for some number of microseconds ===&lt;br /&gt;
&lt;br /&gt;
Note that the delays smaller than a few milliseconds cannot be commanded reliably.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 sleep &amp;lt;microseconds&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;DISPLAY&amp;quot;&amp;gt;&lt;br /&gt;
=== DISPLAY: change integer output base ===&lt;br /&gt;
&lt;br /&gt;
The output from MCE read commands is displayed in decimal or hex, depending on the mce.cfg configuration.  To override this, decimal ('''dec''') or hexadecimal ('''hex''') output can be forced with the '''display''' command.  Passing '''def''' will return mce_cmd to its default behaviour.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 display [ def | dec | hex ]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ECHO&amp;quot;&amp;gt;&lt;br /&gt;
=== ECHO: echo commands to the terminal ===&lt;br /&gt;
&lt;br /&gt;
In some scripting situations it may be useful to have commands echoed to the terminal along with their responses.  This can be turned on and off by passing 1 or 0 to the '''echo''' command.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 echo [ 0 | 1 ]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MCE data block commands ==&lt;br /&gt;
&lt;br /&gt;
MCE configuration data is stored in blocks at certain card and parameter addresses (which we will call &amp;quot;block locations&amp;quot;).  A typical block address is&lt;br /&gt;
 rc2 {{param|rc|flx_quanta0|flx_quanta4}}&lt;br /&gt;
This block consists of 41 32-bit words where the user writes the squid-1 flux quantum size for column 4 on readout card 2.&lt;br /&gt;
&lt;br /&gt;
The most basic data manipulation commands are RB (&amp;quot;read block&amp;quot;) and WB (&amp;quot;write block&amp;quot;).  These commands read from or write to the entire range of data at the block location, starting at the beginning of the block.&lt;br /&gt;
&lt;br /&gt;
The commands RRA (&amp;quot;read range&amp;quot;) and WRA (&amp;quot;write range&amp;quot;) can be used to read or write particular subranges of the data in a block location.&lt;br /&gt;
&lt;br /&gt;
All read and write commands take a card (or [[virtual card]]s) name and a parameter name as the first two arguments.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;RB&amp;quot;&amp;gt;&lt;br /&gt;
=== RB: read block ===&lt;br /&gt;
&lt;br /&gt;
The read block ('''rb''') command returns the entire contents of a block location.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rb  &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
 rb rc1 {{param|rc|adc_offset0}}&lt;br /&gt;
 Line   1 : ok : 10 11 9 8 12 13 14 15&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;WB&amp;quot;&amp;gt;&lt;br /&gt;
=== WB: write block ===&lt;br /&gt;
&lt;br /&gt;
The write block ('''wb''') command writes the given data to the specified block location.  If the number of data is smaller than block size, the remaining block elements will not be altered.  If the number of data is larger than the block size, the behaviour depends on the implementation of the block location.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 wb  &amp;lt;card&amp;gt; &amp;lt;param&amp;gt; [val0 val1 val2 ...]&lt;br /&gt;
Example:&lt;br /&gt;
 wb rc1 {{param|rc|adc_offset0}} 0 1 2&lt;br /&gt;
 Line   1 : ok&lt;br /&gt;
 rb rc1 {{param|rc|adc_offset0}}&lt;br /&gt;
 Line   2 : ok :  0 1 2 8 12 13 14 15&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;RRA&amp;quot;&amp;gt;&lt;br /&gt;
=== RRA: read range ===&lt;br /&gt;
&lt;br /&gt;
The read range ('''rra''') command returns &amp;lt;count&amp;gt; values from the block location, starting from the value at &amp;lt;start_index&amp;gt; (indexed from 0).&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rra &amp;lt;card&amp;gt; &amp;lt;param&amp;gt; &amp;lt;start_index&amp;gt; &amp;lt;count&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
 rra rc1 {{param|rc|adc_offset0}} 2 4&lt;br /&gt;
 Line   1 : ok : 2 8 12 13&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;WRA&amp;quot;&amp;gt;&lt;br /&gt;
=== WRA: write range ===&lt;br /&gt;
&lt;br /&gt;
The write range ('''wra''') command writes the given values into the block location, starting at &amp;lt;start_index&amp;gt; (indexed from 0).  Other block data (i.e. at indices lower than start_index) are not changed.  (This command is implemented as a read-update-write and will usually take twice as long to execute as a '''wb''' command.)&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 wra &amp;lt;card&amp;gt; &amp;lt;param&amp;gt; &amp;lt;start_index&amp;gt; [val0 val1 val2 ...]&lt;br /&gt;
Example:&lt;br /&gt;
 wra rc1 {{param|rc|adc_offset0}} 4 100 200&lt;br /&gt;
 Line   1 : ok&lt;br /&gt;
 rb rc1 {{param|rc|adc_offset0}}&lt;br /&gt;
 Line   2 : ok :  0 1 2 8 100 200 14 15&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MCE data acquisition commands ==&lt;br /&gt;
&lt;br /&gt;
The acquisition of frame data is achieved by first configuring an output system (by specifying an output format, filename, and the target readout cards), and then by issuing '''acq_go''' commands to acquire frames.&lt;br /&gt;
&lt;br /&gt;
This simplest example will acquire 1000 frames from rc2 into the file /data/cryo/current_data/test:&lt;br /&gt;
 acq_config /data/cryo/current_data/test rc2&lt;br /&gt;
 Line   1 : ok&lt;br /&gt;
 acq_go 1000&lt;br /&gt;
 Line   2 : ok&lt;br /&gt;
&lt;br /&gt;
The configuration commands have mnemonics that begin with '''acq_config'''.  They allow a small variety of output formats.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_CONFIG&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_CONFIG: configure simple MCE frame file ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_CONFIG''' command configures a single output file to receive MCE frames.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_config &amp;lt;filename&amp;gt; &amp;lt;readout_card&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_config test1.dat rc2&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_CONFIG_FS&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_CONFIG_FS: configure file-sequenced MCE frame file ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_CONFIG_FS''' command will result in the outputting of the frame data into a set of files whose filename contains an increasing index.  The output file is changed after &amp;lt;change_interval&amp;gt; frames.  The output files will be called &amp;lt;filename&amp;gt;.000, &amp;lt;filename&amp;gt;.001, etc.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_config_fs &amp;lt;filename&amp;gt; &amp;lt;readout_card&amp;gt; &amp;lt;change_interval&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_CONFIG_DIRFILE&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_CONFIG_DIRFILE and ACQ_CONFIG_DIRFILE_FS: dirfile-based acquisitions ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_CONFIG_DIRFILE''' and '''ACQ_CONFIG_DIRFILE_FS''' commands behave analogously to '''ACQ_CONFIG''' and '''ACQ_CONFIG_FS''' except they acquire data to a [http://getdata.sourceforge.net/dirfile.html Dirfile] instead of to a MCE frame file.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_config_dirfile &amp;lt;dirfilename&amp;gt; &amp;lt;readout_card&amp;gt;&lt;br /&gt;
and:&lt;br /&gt;
 acq_config_dirfile_fs &amp;lt;dirfilename&amp;gt; &amp;lt;readout_card&amp;gt; &amp;lt;change_interval&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_GO&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_GO: acquire frame data ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_GO''' command causes the MCE to begin acquiring data.  The frame data will be stored according to the most recent '''ACQ_CONFIG...''' command.  It is not usually necessary to reconfigure the output system (i.e. perform another '''ACQ_CONFIG''') between '''ACQ_GO''' commands.  The exception to this is that if the frame structure changes (i.e. &amp;quot;cc {{param|cc|num_rows_reported}}&amp;quot; is altered), then '''ACQ_CONFIG''' should be issued again so that the acquisition system can determine the frame size. &lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_go &amp;lt;frame_count&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_config tes_bias_ramp rc1&lt;br /&gt;
 wb tes bias 5 5 5&lt;br /&gt;
 acq_go 1&lt;br /&gt;
 wb tes bias 10 10 10&lt;br /&gt;
 acq_go 1&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_PATH&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_PATH: set the default path for data output ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_PATH''' command sets the default output directory for frame data.  This path is only applied if the filenames given in an '''ACQ_CONFIG...''' do not specify a relative path.  The given path can be absolute, or relative to the mce_cmd's run-time working directory.  The default output location can also be specified using the '-o' command line option.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_path &amp;lt;path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_path /data/cryo/current_data&lt;br /&gt;
 acq_config test1 rc1&lt;br /&gt;
 acq_go 10&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_LINK&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_LINK: turn on updating a symlink to the current acquisition ===&lt;br /&gt;
&lt;br /&gt;
The '''ACQ_LINK''' command specifies the name of a symlink which will be created/retargeted to a current acquisition.  This command only schedules the creation/retargeting of the link.  The link is modified by an '''ACQ_CONFIG...'''.  As a result this command must be used before an '''ACQ_CONFIG...''' for it to do anything.  As with the filename specified in '''ACQ_CONFIG''' and friends, if the specified name is not an absolute path, the path specified by '''ACQ_PATH''' or the -o option will be prepended.  If doing a sequencing acquisition (either '''ACQ_CONFIG_FS''' or '''ACQ_CONFIG_DIRFILE_FS''') the link will be updated whenever a new file is started.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_link &amp;lt;name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_path /data/cryo/current_data&lt;br /&gt;
 acq_link mas.lnk&lt;br /&gt;
 acq_config test1 rc1&lt;br /&gt;
 acq_go 10&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_OPTION&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_OPTION: set various acquisition options ===&lt;br /&gt;
The '''ACQ_OPTION''' command allows you to modify various optional parameters for a particular acquisition.  Options are grouped by acquisition type (either &amp;quot;dirfile&amp;quot; or &amp;quot;flatfile&amp;quot;, ignoring sequencing), and vary between acquisition type.  They must be specified before configuration to take effect.  Options are not persistent: an '''ACQ_CONFIG'''-type command consumes and then resets all relevant options to their default value after configuration (so '''ACQ_CONFIG_DIRFILE''' and '''ACQ_CONFIG_DIRFILE_FS''' reset the dirfile options after applying them to the acquisition it is configuring, but '''ACQ_CONFIG''' will neither reset nor use them).&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_option &amp;lt;acq_type&amp;gt; &amp;lt;option_name&amp;gt; &amp;lt;option_value&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently, only &amp;lt;tt&amp;gt;acq_type&amp;lt;/tt&amp;gt; &amp;quot;dirfile&amp;quot; has any options.  These are:&lt;br /&gt;
* &amp;lt;tt&amp;gt;'''include''' &amp;lt;filename&amp;gt;&amp;lt;/tt&amp;gt;: copies contents of the specified file to the output dirfile metadata.  The file is copied verbatim, but the contents are not verified by MAS to see if it makes sense to use it as dirfile metadata.  Default is the empty string, indicating no inclusion.  If &amp;lt;filename&amp;gt; is a relative path, it will be to the current directory.  (ie. it ignores both the -o option and '''ACQ_PATH''')&lt;br /&gt;
* &amp;lt;tt&amp;gt;'''spf''' &amp;lt;number&amp;gt;&amp;lt;/tt&amp;gt;: sets the samples-per-frame of the fields in the dirfile to the specified value, which must be positive.  Default is one.&lt;br /&gt;
* &amp;lt;tt&amp;gt;'''version''' &amp;lt;number&amp;gt;&amp;lt;/tt&amp;gt;: sets the [http://getdata.sourceforge.net/dirfile.html Dirfile Standards Version] used to write the dirfile metadata.  This can be any integer greater than or equal to 3 (a smaller number results in the default, 7, being used), but only a few values are really of interest:&lt;br /&gt;
** Versions &amp;lt; 7 are unable to properly extract signed bitfields from the packed MCE data.  This affects [[data mode]]s 4, 5, 7, and 10.&lt;br /&gt;
** Versions &amp;gt; 4 can't be read by default builds of kst-1.x. (It is possible to build kst-1.x against a modern GetData library, making newer Dirfiles readable, although I don't think any distro shipping kst-1 has done this.)&lt;br /&gt;
:Setting this to 4 should recover the behaviour of older versions of MAS.  Also note: the dirfile formatted runfile metadata output by &amp;quot;&amp;lt;tt&amp;gt;[[mce_status]] -d&amp;lt;/tt&amp;gt;&amp;quot; requires at least Version 8 to parse, but does not depend on, nor is affected by, the Version number specified here.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 acq_option dirfile include /path/to/extra/format_metadata&lt;br /&gt;
 acq_option dirfile version 4&lt;br /&gt;
 acq_link mas.lnk&lt;br /&gt;
 acq_config_dirfile test1 rc1&lt;br /&gt;
 acq_go 10&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;ACQ_MULTI_BEGIN&amp;quot;&amp;gt;&lt;br /&gt;
=== ACQ_MULTI_BEGIN and ACQ_MULTI_END: manage multiple output syncs ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to output to multiple files at the same time (e.g. to record a dirfile and a flatfile simultaneously).  This is achieved my putting mce_cmd into &amp;quot;multisync&amp;quot; mode, creating a few different output configurations with an '''ACQ_CONFIG...''', and then issuing '''ACQ_GO'''.  The '''ACQ_MULTI_BEGIN''' command clears the acquisition stack and puts mce_cmd into multisync mode.  The '''ACQ_MULTI_END''' command clears the acquisition stack and disables multisync mode.  An '''ACQ_MULTI_END''' command is implicitly executed when &amp;lt;tt&amp;gt;mce_cmd&amp;lt;/tt&amp;gt; exits, so it is not usually necessary to execute this command explicitly.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 acq_multi_begin&lt;br /&gt;
 acq_multi_end&lt;br /&gt;
&lt;br /&gt;
Example (output to flatfile and dirfile simultaneously):&lt;br /&gt;
 acq_multi_begin&lt;br /&gt;
 acq_config 1234560000_flat rcs&lt;br /&gt;
 acq_config_dirfile 1234560000_dirfile rcs&lt;br /&gt;
 acq_go 164000&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Voluntary lock-out mechanism ==&lt;br /&gt;
&lt;br /&gt;
== Low-level MCE commands ==&lt;br /&gt;
&lt;br /&gt;
=== GO ===&lt;br /&gt;
&lt;br /&gt;
Issuing '''GO''' sends a MCE command packet to the MCE, but with no associated additional processing.  That is, even though '''GO''' causes the MCE to produce frame data, the frames will not be stored to disk and they will either accumulate in the driver's buffer or be discarded by the PCI card if they are not of the expected size.  In general, the MAS acquisition system ('''[[#ACQ_GO|ACQ_GO]]''', &amp;amp;c.) should be used instead of sending this command directly.&lt;br /&gt;
&lt;br /&gt;
The only parameter which responds to '''GO''' is the readout card's {{param|rc|ret_dat}} parameter.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 go &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== STOP ===&lt;br /&gt;
:''See: [[The STOP Command]]''&lt;br /&gt;
The '''STOP''' command is intended for terminating MCE frame data acquisitions.  The only parameter which responds to '''STOP''' is the readout card's {{param|rc|ret_dat}} parameter.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 stop &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
 stop rcs {{param|rc|ret_dat}}&lt;br /&gt;
&lt;br /&gt;
=== RS ===&lt;br /&gt;
&lt;br /&gt;
The '''RS''' command is used to activate a few special command registers.   Registers which use '''RS''' have the type '''rs''' in the [[MCE commands]] list.  They are mostly commands which reset devices in the MCE ('''RS''' stands for ''reset''), which means they must reply to the request before executing the command, unlike a normal '''WB''' command, which replies after execution.&lt;br /&gt;
&lt;br /&gt;
Note: although the [[MCE commands|command list]] indicates that RS commands take a single parameter with a value of '''1''', this is not needed when calling the command from MAS.  MAS ignores parameters passed to a RS command and will always issue the command with the '''1''' datum.  So, don't pass any data to a RS command.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rs &amp;lt;card&amp;gt; &amp;lt;param&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 rs cc {{param|cc|config_fac}}&lt;br /&gt;
&lt;br /&gt;
== Raw commands ==&lt;br /&gt;
&lt;br /&gt;
In addition to the formatted commanding discussed above, raw reads and writes can be issued to the MCE by specifying numeric register addresses (and, optionally, a numeric card address).  Raw commands can be used to access command registers which are not defined in the hardware description file ([[mce.cfg]]).&lt;br /&gt;
&lt;br /&gt;
The numeric address of a physical card is its {{param||slot_id}}.  The special card '''rcs''' has a numeric address of &amp;lt;tt&amp;gt;0x0B&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 rb &amp;lt;card&amp;gt; &amp;lt;register&amp;gt; &amp;lt;count&amp;gt; [multiplier]&lt;br /&gt;
 wb &amp;lt;card&amp;gt; &amp;lt;register&amp;gt; &amp;lt;datum&amp;gt; [val0 val1 val2 ...]&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
 # read one sample from the clock card {{param||led}} register&lt;br /&gt;
 rb cc 0x99 1&lt;br /&gt;
 &lt;br /&gt;
 # the same, but by card address:&lt;br /&gt;
 rb 0x02 0x99 1&lt;br /&gt;
&lt;br /&gt;
Because these requests bypass the command definitions in the hardware description file, a count of data to be returned must be specified with a read (RB) request.  Raw commands cannot be issued to the virtual card mappings implemented by MAS ('''tes''', '''sq1''', '''sq2''', &amp;amp;c.), nor the multi-address physical cards '''rca''' and '''sys'''.&lt;br /&gt;
&lt;br /&gt;
= Output formatting =&lt;br /&gt;
&lt;br /&gt;
Normally, mce_cmd produces a line of output following each command. The output consists of two or three parts, separated by colons.  If in line prefix mode (which is the default) the output is:&lt;br /&gt;
 Line &amp;lt;line number&amp;gt;: &amp;lt;success&amp;gt; [: data ... ]&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;success&amp;gt; indicator will be &amp;quot;ok&amp;quot; if the command succeeded, or &amp;quot;error&amp;quot; otherwise.  Successful commands may return data (for example, an RB command).  Failed commands will always return an error message as the data.&lt;br /&gt;
&lt;br /&gt;
If mce_cmd is invoked with prefixes turned off ('-p'), the output format is&lt;br /&gt;
 &amp;lt;success&amp;gt; [: data]&lt;br /&gt;
&lt;br /&gt;
If mce_cmd is invoked in quiet mode ('q'), then all command responses that have no output data are suppressed.  In quiet mode, &amp;quot;Line 12: ok&amp;quot; will not be displayed.&lt;br /&gt;
&lt;br /&gt;
[[Category: Software]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=6000</id>
		<title>Hybrid row select for mux11d</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=6000"/>
		<updated>2015-01-09T22:07:48Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This document is under active development.'''&lt;br /&gt;
&lt;br /&gt;
In standard mux11d, the S1 selection signals (row_select) are provided by the Adress Card (AC).  &amp;quot;Hybrid row select&amp;quot; refers to the use of Bias Card (BC) flux_fb DAC lines to augment the number of addressable S1.&lt;br /&gt;
* Without any firmware modifications, it should be possible to multiplex any combination of AC and BC DACs, with num_rows up to 64.  However, without some firmware modification, one can configure at most 58 of those channels for servo and readout.&lt;br /&gt;
* With some communication protocol modification, it should be possible to configure and readout any subset of 64 rows.&lt;br /&gt;
&lt;br /&gt;
===Software modifications===&lt;br /&gt;
&lt;br /&gt;
The software components affected by hybrid row select are:&lt;br /&gt;
* MAS low-level and mce_script -- internal code often assumes num_rows &amp;lt;= 41.  These instances shouldn't be too hard to find and remove.&lt;br /&gt;
* mux_lock -- rs_servo must be able to ramp the row_select DACs.&lt;br /&gt;
* config script system -- must be able to map selected row_select values to correct MCE registers.&lt;br /&gt;
&lt;br /&gt;
===mce.cfg considerations===&lt;br /&gt;
&lt;br /&gt;
The AC and BC are set up differently for fast switching, and thus a low-level solution based on virtual card re-mappings is not feasible.  &lt;br /&gt;
* AC accepts lists of on_bias and off_bias values, and order of their application is set by the row_order register.&lt;br /&gt;
* BC allows a completely arbitrary matrix of flux_fb values, which is more general than the AC model.  There is no equivalent of row_order, since the matrix rows themseleves can be modified to produce the equivalent reordering of output values.&lt;br /&gt;
&lt;br /&gt;
The biggest obstacle here is that the manipulation of &amp;quot;row_order&amp;quot; has very different implementations for the AC and BC.  The path to a transparent low-level solution is not clear.&lt;br /&gt;
&lt;br /&gt;
Otherwise, the changes to mce.cfg are straight-forward.  Switches should be added to increase the effective maximum num_rows to 57/58 or 64/66.  The &amp;quot;row select&amp;quot; and &amp;quot;row deselect&amp;quot; virtual targets will be eliminated in favour of a mapping described in experiment.cfg.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;br /&gt;
&lt;br /&gt;
The config script system must be able to take care of translating values in experiment.cfg to the appropriate MCE registers.  In order for that to take place, experiment.cfg must also encode a map from &amp;quot;row select&amp;quot; index into physical address lines.  We define the system by example:&lt;br /&gt;
&lt;br /&gt;
 # Activate hybrid mode.  With great power comes great complexity.&lt;br /&gt;
 mux11d_hybrid_row_select = 1;&lt;br /&gt;
 &lt;br /&gt;
 # Row select lines will be drawn from AC and from BC2.&lt;br /&gt;
 mux11d_row_select_cards = [&amp;quot;ac&amp;quot;, &amp;quot;bc2&amp;quot;];&lt;br /&gt;
 &lt;br /&gt;
 # For the purposes of mux_order, AC lines are indexed by [0,...,40] and BC lines are indexed by [50,...,81].&lt;br /&gt;
 mux11d_row_select_cards_row0 = [0, 50];&lt;br /&gt;
 &lt;br /&gt;
 # For mux cycles where the AC is not active, use ac on_bias[39] as a DAC to idle on.&lt;br /&gt;
 mux11d_ac_idle_row = 39;&lt;br /&gt;
 &lt;br /&gt;
 # The muxing order will be: 32 rows from AC (corresponding to on_bias[0] through on_bias[31],&lt;br /&gt;
 #  followed by 16 rows from BC (fb_col0 to fb_col15), followed by a single AC row (on_bias[40]).&lt;br /&gt;
 mux11d_mux_order = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,&lt;br /&gt;
                     10,11,12,13,14,15,16,17,18,19,&lt;br /&gt;
                     20,21,22,23,24,25,26,27,28,29,&lt;br /&gt;
                     30,31,&lt;br /&gt;
                     50,51,52,53,54,55,56,57,58,59,&lt;br /&gt;
                     60,61,62,63,64,65,&lt;br /&gt;
                     40 ];&lt;br /&gt;
&lt;br /&gt;
The values for row_select and row_deselect will then be stored in MUX order (rather than physical line order), in experiment.cfg settings:&lt;br /&gt;
 row_select   = [ 999,999,999,999,999,999... ]#(49 values total)&lt;br /&gt;
 row_deselect = [ 999,999,999,999,999,999... ]#(49 values total)&lt;br /&gt;
&lt;br /&gt;
We may as well allow the user to rescale row_select and row_deselect values prior to application to the DACs.  While it is more powerful to specify this on a per DAC or per MUX cycle basis, it is probably enough to specify the multiplier on a per-card basis.&lt;br /&gt;
 # Multiplier for row_select -&amp;gt; MCE values.&lt;br /&gt;
 mux11d_row_select_multipliers = [1, 0.5];&lt;br /&gt;
&lt;br /&gt;
These experiment.cfg settings will produce the following MCE configuration:&lt;br /&gt;
* '''ac row_order''' is like:&lt;br /&gt;
 wb ac row_order  0  1  2  3  4  5  6  7  8  9 \ &lt;br /&gt;
                 10 11 12 13 14 15 16 17 18 19 \&lt;br /&gt;
                 20 21 22 23 24 25 26 27 28 29 \&lt;br /&gt;
                 30 31 39 39 39 39 39 39 39 39 \&lt;br /&gt;
                 39 39 39 39 39 39 39 39 40&lt;br /&gt;
* row_select and row_deselect 999 and 0, except for row 39 which is 0 and 0.&lt;br /&gt;
 wb ac on_bias 999 999 999 .... 999 0 999&lt;br /&gt;
 wb ac off_bias 0 0 0 ... 0 0 0&lt;br /&gt;
* The '''bc2 col*''' registers are set to row_deselect values (probably 0) except for:&lt;br /&gt;
 wra bc2 col0  32 498&lt;br /&gt;
 wra bc2 col1  33 498&lt;br /&gt;
 wra bc2 col2  34 498&lt;br /&gt;
 wra bc2 col3  35 498&lt;br /&gt;
 ...&lt;br /&gt;
 wra bc2 col14 46 498&lt;br /&gt;
 wra bc2 col15 47 498&lt;br /&gt;
&lt;br /&gt;
=== mux_lock ===&lt;br /&gt;
&lt;br /&gt;
The rs_servo program has to ramp the '''row select''' DACs.  It will need to parse experiment.cfg to know how to do this.  It should only ramp the DACs listed in mux11d_mux_order.  It should properly decode mux_order and multipliers.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=5999</id>
		<title>Hybrid row select for mux11d</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=5999"/>
		<updated>2015-01-09T21:55:30Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This document is under active development.'''&lt;br /&gt;
&lt;br /&gt;
In standard mux11d, the S1 selection signals (row_select) are provided by the Adress Card (AC).  &amp;quot;Hybrid row select&amp;quot; refers to the use of Bias Card (BC) flux_fb DAC lines to augment the number of addressable S1.&lt;br /&gt;
* Without any firmware modifications, it should be possible to multiplex any combination of AC and BC DACs, with num_rows up to 64.  However, without some firmware modification, one can configure at most 58 of those channels for servo and readout.&lt;br /&gt;
* With some communication protocol modification, it should be possible to configure and readout any subset of 64 rows.&lt;br /&gt;
&lt;br /&gt;
===Software modifications===&lt;br /&gt;
&lt;br /&gt;
The software components affected by hybrid row select are:&lt;br /&gt;
* MAS low-level and mce_script -- internal code often assumes num_rows &amp;lt;= 41.  These instances shouldn't be too hard to find and remove.&lt;br /&gt;
* mux_lock -- rs_servo must be able to ramp the row_select DACs.&lt;br /&gt;
* config script system -- must be able to map selected row_select values to correct MCE registers.&lt;br /&gt;
&lt;br /&gt;
===mce.cfg considerations===&lt;br /&gt;
&lt;br /&gt;
The AC and BC are set up differently for fast switching, and thus a low-level solution based on virtual card re-mappings is not feasible.  &lt;br /&gt;
* AC accepts lists of on_bias and off_bias values, and order of their application is set by the row_order register.&lt;br /&gt;
* BC allows a completely arbitrary matrix of flux_fb values, which is more general than the AC model.  There is no equivalent of row_order, since the matrix rows themseleves can be modified to produce the equivalent reordering of output values.&lt;br /&gt;
&lt;br /&gt;
The biggest obstacle here is that the manipulation of &amp;quot;row_order&amp;quot; has very different implementations for the AC and BC.  The path to a transparent low-level solution is not clear.&lt;br /&gt;
&lt;br /&gt;
Otherwise, the changes to mce.cfg are straight-forward.  Switches should be added to increase the effective maximum num_rows to 57/58 or 64/66.  The &amp;quot;row select&amp;quot; and &amp;quot;row deselect&amp;quot; virtual targets will be eliminated in favour of a mapping described in experiment.cfg.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;br /&gt;
&lt;br /&gt;
The config script system must be able to take care of translating values in experiment.cfg to the appropriate MCE registers.  In order for that to take place, experiment.cfg must also encode a map from &amp;quot;row select&amp;quot; index into physical address lines.  We define the system by example:&lt;br /&gt;
&lt;br /&gt;
 # Activate hybrid mode.  With great power comes great complexity.&lt;br /&gt;
 mux11d_hybrid_row_select = 1;&lt;br /&gt;
 &lt;br /&gt;
 # Row select lines will be drawn from AC and from BC2.&lt;br /&gt;
 mux11d_row_select_cards = [&amp;quot;ac&amp;quot;, &amp;quot;bc2&amp;quot;];&lt;br /&gt;
 &lt;br /&gt;
 # For the purposes of mux_order, AC lines are indexed by [0,...,40] and BC lines are indexed by [50,...,81].&lt;br /&gt;
 mux11d_row_select_cards_row0 = [0, 50];&lt;br /&gt;
 &lt;br /&gt;
 # For mux cycles where the AC is not active, use ac on_bias[39] as a DAC to idle on.&lt;br /&gt;
 mux11d_ac_idle_row = 39;&lt;br /&gt;
 &lt;br /&gt;
 # The muxing order will be: 32 rows from AC (corresponding to on_bias[0] through on_bias[31],&lt;br /&gt;
 #  followed by 16 rows from BC (fb_col0 to fb_col15), followed by a single AC row (on_bias[40]).&lt;br /&gt;
 mux11d_mux_order = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,&lt;br /&gt;
                     10,11,12,13,14,15,16,17,18,19,&lt;br /&gt;
                     20,21,22,23,24,25,26,27,28,29,&lt;br /&gt;
                     30,31,&lt;br /&gt;
                     50,51,52,53,54,55,56,57,58,59,&lt;br /&gt;
                     60,61,62,63,64,65,&lt;br /&gt;
                     40 ];&lt;br /&gt;
&lt;br /&gt;
These experiment.cfg settings will produce the following MCE configuration:&lt;br /&gt;
* '''ac row_order''' is like:&lt;br /&gt;
 wb ac row_order  0  1  2  3  4  5  6  7  8  9 \ &lt;br /&gt;
                 10 11 12 13 14 15 16 17 18 19 \&lt;br /&gt;
                 20 21 22 23 24 25 26 27 28 29 \&lt;br /&gt;
                 30 31 39 39 39 39 39 39 39 39 \&lt;br /&gt;
                 39 39 39 39 39 39 39 39 40&lt;br /&gt;
* The '''bc2 col*''' registers are set to row_deselect values (probably 0) except for (using 999 as a dummy row select value):&lt;br /&gt;
 wra bc2 col0  32 999&lt;br /&gt;
 wra bc2 col1  33 999&lt;br /&gt;
 wra bc2 col2  34 999&lt;br /&gt;
 wra bc2 col3  35 999&lt;br /&gt;
 ...&lt;br /&gt;
 wra bc2 col14 46 999&lt;br /&gt;
 wra bc2 col15 47 999&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=5998</id>
		<title>Hybrid row select for mux11d</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=5998"/>
		<updated>2015-01-09T21:54:31Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* experiment.cfg */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This document is under active development.'''&lt;br /&gt;
&lt;br /&gt;
In standard mux11d, the S1 selection signals (row_select) are provided by the Adress Card (AC).  &amp;quot;Hybrid row select&amp;quot; refers to the use of Bias Card (BC) flux_fb DAC lines to augment the number of addressable S1.&lt;br /&gt;
* Without any firmware modifications, it should be possible to multiplex any combination of AC and BC DACs, with num_rows up to 64.  However, without some firmware modification, one can configure at most 58 of those channels for servo and readout.&lt;br /&gt;
* With some communication protocol modification, it should be possible to configure and readout any subset of 64 rows.&lt;br /&gt;
&lt;br /&gt;
===Software modifications===&lt;br /&gt;
&lt;br /&gt;
The software components affected by hybrid row select are:&lt;br /&gt;
* MAS low-level and mce_script -- internal code often assumes num_rows &amp;lt;= 41.  These instances shouldn't be too hard to find and remove.&lt;br /&gt;
* mux_lock -- rs_servo must be able to ramp the row_select DACs.&lt;br /&gt;
* config script system -- must be able to map selected row_select values to correct MCE registers.&lt;br /&gt;
&lt;br /&gt;
===mce.cfg considerations===&lt;br /&gt;
&lt;br /&gt;
The AC and BC are set up differently for fast switching, and thus a low-level solution based on virtual card re-mappings is not feasible.  &lt;br /&gt;
* AC accepts lists of on_bias and off_bias values, and order of their application is set by the row_order register.&lt;br /&gt;
* BC allows a completely arbitrary matrix of flux_fb values, which is more general than the AC model.  There is no equivalent of row_order, since the matrix rows themseleves can be modified to produce the equivalent reordering of output values.&lt;br /&gt;
&lt;br /&gt;
The biggest obstacle here is that the manipulation of &amp;quot;row_order&amp;quot; has very different implementations for the AC and BC.  The path to a transparent low-level solution is not clear.&lt;br /&gt;
&lt;br /&gt;
Otherwise, the changes to mce.cfg are straight-forward.  Switches should be added to increase the effective maximum num_rows to 57/58 or 64/66.  The &amp;quot;row select&amp;quot; and &amp;quot;row deselect&amp;quot; virtual targets will be eliminated in favour of a mapping described in experiment.cfg.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;br /&gt;
&lt;br /&gt;
The config script system must be able to take care of translating values in experiment.cfg to the appropriate MCE registers.  In order for that to take place, experiment.cfg must also encode a map from &amp;quot;row select&amp;quot; index into physical address lines.  We define the system by example:&lt;br /&gt;
&lt;br /&gt;
 # Activate hybrid mode.  With great power comes great complexity.&lt;br /&gt;
 mux11d_hybrid_row_select = 1;&lt;br /&gt;
 &lt;br /&gt;
 # Row select lines will be drawn from AC and from BC2.&lt;br /&gt;
 mux11d_row_select_cards = [&amp;quot;ac&amp;quot;, &amp;quot;bc2&amp;quot;];&lt;br /&gt;
 &lt;br /&gt;
 # For the purposes of mux_order, AC lines are indexed by [0,...,40] and BC lines are indexed by [50,...,81].&lt;br /&gt;
 mux11d_row_select_cards_row0 = [0, 50];&lt;br /&gt;
 &lt;br /&gt;
 # For mux cycles where the AC is not active, use ac on_bias[39] as a DAC to idle on.&lt;br /&gt;
 mux11d_ac_idle_row = 39;&lt;br /&gt;
 &lt;br /&gt;
 # The muxing order will be: 32 rows from AC (corresponding to on_bias[0] through on_bias[31],&lt;br /&gt;
 #  followed by 16 rows from BC (fb_col0 to fb_col15), followed by a single AC row (on_bias[40]).&lt;br /&gt;
 mux11d_mux_order = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,&lt;br /&gt;
                     10,11,12,13,14,15,16,17,18,19,&lt;br /&gt;
                     20,21,22,23,24,25,26,27,28,29,&lt;br /&gt;
                     30,31,&lt;br /&gt;
                     50,51,52,53,54,55,56,57,58,59,&lt;br /&gt;
                     60,61,62,63,64,65,&lt;br /&gt;
                     40 ];&lt;br /&gt;
&lt;br /&gt;
These experiment.cfg settings will produce the following MCE configuration:&lt;br /&gt;
* '''ac row_order''' is like:&lt;br /&gt;
 wb ac row_order  0  1  2  3  4  5  6  7  8  9 \ &lt;br /&gt;
                 10 11 12 13 14 15 16 17 18 19 \&lt;br /&gt;
                 20 21 22 23 24 25 26 27 28 29 \&lt;br /&gt;
                 30 31 39 39 39 39 39 39 39 39 \&lt;br /&gt;
                 39 39 39 39 39 39 39 39 40&lt;br /&gt;
* The '''bc2 col*''' registers are set to row_deselect values (probably 0) except for (using 999 as a dummy row select value):&lt;br /&gt;
 wra bc2 col0  32 999&lt;br /&gt;
 wra bc2 col2  33 999&lt;br /&gt;
 wra bc2 col3  34 999&lt;br /&gt;
 wra bc2 col4  35 999&lt;br /&gt;
 ...&lt;br /&gt;
 wra bc2 col14 45 999&lt;br /&gt;
 wra bc2 col15 46 999&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=5997</id>
		<title>Hybrid row select for mux11d</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=5997"/>
		<updated>2015-01-09T16:46:43Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* mce.cfg considerations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This document is under active development.'''&lt;br /&gt;
&lt;br /&gt;
In standard mux11d, the S1 selection signals (row_select) are provided by the Adress Card (AC).  &amp;quot;Hybrid row select&amp;quot; refers to the use of Bias Card (BC) flux_fb DAC lines to augment the number of addressable S1.&lt;br /&gt;
* Without any firmware modifications, it should be possible to multiplex any combination of AC and BC DACs, with num_rows up to 64.  However, without some firmware modification, one can configure at most 58 of those channels for servo and readout.&lt;br /&gt;
* With some communication protocol modification, it should be possible to configure and readout any subset of 64 rows.&lt;br /&gt;
&lt;br /&gt;
===Software modifications===&lt;br /&gt;
&lt;br /&gt;
The software components affected by hybrid row select are:&lt;br /&gt;
* MAS low-level and mce_script -- internal code often assumes num_rows &amp;lt;= 41.  These instances shouldn't be too hard to find and remove.&lt;br /&gt;
* mux_lock -- rs_servo must be able to ramp the row_select DACs.&lt;br /&gt;
* config script system -- must be able to map selected row_select values to correct MCE registers.&lt;br /&gt;
&lt;br /&gt;
===mce.cfg considerations===&lt;br /&gt;
&lt;br /&gt;
The AC and BC are set up differently for fast switching, and thus a low-level solution based on virtual card re-mappings is not feasible.  &lt;br /&gt;
* AC accepts lists of on_bias and off_bias values, and order of their application is set by the row_order register.&lt;br /&gt;
* BC allows a completely arbitrary matrix of flux_fb values, which is more general than the AC model.  There is no equivalent of row_order, since the matrix rows themseleves can be modified to produce the equivalent reordering of output values.&lt;br /&gt;
&lt;br /&gt;
The biggest obstacle here is that the manipulation of &amp;quot;row_order&amp;quot; has very different implementations for the AC and BC.  The path to a transparent low-level solution is not clear.&lt;br /&gt;
&lt;br /&gt;
Otherwise, the changes to mce.cfg are straight-forward.  Switches should be added to increase the effective maximum num_rows to 57/58 or 64/66.  The &amp;quot;row select&amp;quot; and &amp;quot;row deselect&amp;quot; virtual targets will be eliminated in favour of a mapping described in experiment.cfg.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=5996</id>
		<title>Hybrid row select for mux11d</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=5996"/>
		<updated>2015-01-09T16:44:15Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* mce.cfg considerations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This document is under active development.'''&lt;br /&gt;
&lt;br /&gt;
In standard mux11d, the S1 selection signals (row_select) are provided by the Adress Card (AC).  &amp;quot;Hybrid row select&amp;quot; refers to the use of Bias Card (BC) flux_fb DAC lines to augment the number of addressable S1.&lt;br /&gt;
* Without any firmware modifications, it should be possible to multiplex any combination of AC and BC DACs, with num_rows up to 64.  However, without some firmware modification, one can configure at most 58 of those channels for servo and readout.&lt;br /&gt;
* With some communication protocol modification, it should be possible to configure and readout any subset of 64 rows.&lt;br /&gt;
&lt;br /&gt;
===Software modifications===&lt;br /&gt;
&lt;br /&gt;
The software components affected by hybrid row select are:&lt;br /&gt;
* MAS low-level and mce_script -- internal code often assumes num_rows &amp;lt;= 41.  These instances shouldn't be too hard to find and remove.&lt;br /&gt;
* mux_lock -- rs_servo must be able to ramp the row_select DACs.&lt;br /&gt;
* config script system -- must be able to map selected row_select values to correct MCE registers.&lt;br /&gt;
&lt;br /&gt;
===mce.cfg considerations===&lt;br /&gt;
&lt;br /&gt;
The AC and BC are set up differently for fast switching, and thus a low-level solution based on virtual card re-mappings is not feasible.  &lt;br /&gt;
* AC accepts lists of on_bias and off_bias values, and order of their application is set by the row_order register.&lt;br /&gt;
* BC allows a completely arbitrary matrix of flux_fb values, which is more general than the AC model.  There is no equivalent of row_order, since the matrix rows themseleves can be modified to produce the equivalent reordering of output values.&lt;br /&gt;
&lt;br /&gt;
The biggest obstacle here is that the manipulation of &amp;quot;row_order&amp;quot; has very different implementations for the AC and BC.  The path to a transparent low-level solution is not clear.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=5994</id>
		<title>Hybrid row select for mux11d</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Hybrid_row_select_for_mux11d&amp;diff=5994"/>
		<updated>2015-01-07T17:18:26Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: Created page with &amp;quot;'''This document is under active development.'''  In standard mux11d, the S1 selection signals (row_select) are provided by the Adress Card (AC).  &amp;quot;Hybrid row select&amp;quot; refers to t…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This document is under active development.'''&lt;br /&gt;
&lt;br /&gt;
In standard mux11d, the S1 selection signals (row_select) are provided by the Adress Card (AC).  &amp;quot;Hybrid row select&amp;quot; refers to the use of Bias Card (BC) flux_fb DAC lines to augment the number of addressable S1.&lt;br /&gt;
* Without any firmware modifications, it should be possible to multiplex any combination of AC and BC DACs, with num_rows up to 64.  However, without some firmware modification, one can configure at most 58 of those channels for servo and readout.&lt;br /&gt;
* With some communication protocol modification, it should be possible to configure and readout any subset of 64 rows.&lt;br /&gt;
&lt;br /&gt;
===Software modifications===&lt;br /&gt;
&lt;br /&gt;
The software components affected by hybrid row select are:&lt;br /&gt;
* MAS low-level and mce_script -- internal code often assumes num_rows &amp;lt;= 41.  These instances shouldn't be too hard to find and remove.&lt;br /&gt;
* mux_lock -- rs_servo must be able to ramp the row_select DACs.&lt;br /&gt;
* config script system -- must be able to map selected row_select values to correct MCE registers.&lt;br /&gt;
&lt;br /&gt;
===mce.cfg considerations===&lt;br /&gt;
&lt;br /&gt;
The AC and BC are set up differently for fast switching, and thus a low-level solution based on virtual card remappings is not feasible.  &lt;br /&gt;
* AC accepts lists of on_bias and off_bias values, and order of their application is set by the row_order register.&lt;br /&gt;
* BC allows a completely arbitrary matrix of flux_fb values, which is more general than the AC model.  There is no equivalent of row_order, since the matrix rows themseleves can be modified to produce the equivalent reordering of output values.&lt;br /&gt;
&lt;br /&gt;
The biggest obstacle here is that supporting a &amp;quot;row_order&amp;quot; behaviour transparently would require a persistent dummy register for the BC row_order... and that's not a thing.&lt;br /&gt;
&lt;br /&gt;
Alternately one could change the way &amp;quot;row select&amp;quot; and &amp;quot;row deselect&amp;quot; are mapped into the AC, so that the values written are always applied at the corresponding MUX cycle, rather than being associated with a particular bias line.  This should be considered further.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MCE_usage&amp;diff=5993</id>
		<title>MCE usage</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MCE_usage&amp;diff=5993"/>
		<updated>2015-01-07T16:37:54Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Application Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
== MCE commanding ==&lt;br /&gt;
&lt;br /&gt;
* [[mce_cmd]] - application for commanding the MCE.&lt;br /&gt;
* [[ MCE Commands ]] - especially those commands supported directly by hardware/firmware&lt;br /&gt;
* [[Virtual cards]]&lt;br /&gt;
* [[Using Python to Automate MAS |Python commanding library ]]&lt;br /&gt;
&lt;br /&gt;
== Application Notes ==&lt;br /&gt;
* [[MCE Timing Diagram]]&lt;br /&gt;
* SQUID array setup&lt;br /&gt;
** [[Array setup programs]] - software&lt;br /&gt;
** Characterization and Locking SQUIDs with Multi-Channel Electronics [[http://www.phas.ubc.ca/%7Emce/mcedocs/software/locking_squids.pdf PDF]] (Jun. 07, 2005)&lt;br /&gt;
** &amp;quot;Functional Description of Read-out Electronics for Time-Domain Multiplexed Bolometers for Millimeter and Sub-millimeter Astronomy&amp;quot; [[http://www.springerlink.com/content/m66114j06511uw68/ PDF]] (vol. 151, no. 3-4, J. Low-Temp Phys, May 2008)&lt;br /&gt;
** &amp;quot;Automated SQUID tuning procedure for kilo-pixel arrays of TES bolometers on the Atacama Cosmology Telescope&amp;quot; [[http://www.phas.ubc.ca/%7Emce/mcedocs/auto_tune_results/ACT_tuning_spie2008.pdf PDF]] (SPIE Astronomical Instrumentation Conf, Jun. 2008)&lt;br /&gt;
** Tuning Algorithm for ACT SQUIDs - poster [[http://www.phas.ubc.ca/%7Emce/mcedocs/auto_tune_results/auto_tuning_block_diagram.pdf PDF]]&lt;br /&gt;
** MCE-Cryostat Diagram - cartoons of squid chain setup, servo loop calculations, and word-sizes [[http://www.phas.ubc.ca/~mce/mcedocs/system/Cryo_MCE%20Block%20Diagram.pdf PDF]]&lt;br /&gt;
&lt;br /&gt;
* Data acquisition&lt;br /&gt;
** [[ Data mode | Data Modes ]]&lt;br /&gt;
** [[ Digital 4-pole Butterworth Low-pass filter | Filtered Data &amp;amp; the Digital 4-pole Butterworth Low-pass Filter]]&lt;br /&gt;
** [[ Raw-mode readout | Raw 50 MHz Data ]]&lt;br /&gt;
** [[ Rectangle Mode Data ]] - recommended mode for high-rate acquisition&lt;br /&gt;
** [[ High rate acquisition | Fast Data Acquisition ]] - high-rate acquisition without rectangle mode (deprecated)&lt;br /&gt;
** [[ Open loop data acquisition ]] - for noise measurements of the SQUID chain.&lt;br /&gt;
** [[ The STOP Command ]]&lt;br /&gt;
** [[ Dirfile support ]] - set up MAS to write dirfiles directly&lt;br /&gt;
** [[Data accumulation rate]] - how much data does the MCE produce?&lt;br /&gt;
&lt;br /&gt;
* Data files&lt;br /&gt;
** [[ Python data and runfile modules ]] - mce_data.py)&lt;br /&gt;
** IDL [[ mas_data.pro | data ]] and [[ mas_runfile.pro and mas_runparam.pro | runfile]] scripts&lt;br /&gt;
** [[ MCE flat-file format ]]&lt;br /&gt;
** [[ Runfile format v2 ]]&lt;br /&gt;
&lt;br /&gt;
* Internal commanding&lt;br /&gt;
** [[ Internal Commands ]] - notes on internal command implementation.&lt;br /&gt;
** [[ Ramp Generator ]]&lt;br /&gt;
** [[ Arbitrary Waveform Generator ]] -- for maximum length sequences and complex impedance measurements (CC v5.0.3+)&lt;br /&gt;
&lt;br /&gt;
* Fast switching of the SQ2 feedback&lt;br /&gt;
** [[ Row-specific SQ2FB (fast switching)]]&lt;br /&gt;
** [[ Fast SQ2 Feedback and TES Biasing with an Address Card ]]&lt;br /&gt;
&lt;br /&gt;
* mux11d support&lt;br /&gt;
** [[ Configuration for mux11d operation ]]&lt;br /&gt;
** [[ MCE Signal assignment for mux11d operation ]]&lt;br /&gt;
** [[ Hybrid row select for mux11d ]] (to combine AC and BC for multiplexing &amp;gt; 41 rows)&lt;br /&gt;
&lt;br /&gt;
* MCE servo control&lt;br /&gt;
** [[ Flux jumping | Flux Jumping]]&lt;br /&gt;
** [[ FSFB Clamping Commands ]] -- to prevent unlocked detectors from ramping&lt;br /&gt;
** [[ Flux-loop reset per detector ]]&lt;br /&gt;
&lt;br /&gt;
* Misc.&lt;br /&gt;
** [[ Noise Calculations]]&lt;br /&gt;
** [[ Special SQ1 Bias Commands ]]&lt;br /&gt;
** [[ MCE temperature ]]&lt;br /&gt;
[[Category:Usage]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Main_Page&amp;diff=5984</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Main_Page&amp;diff=5984"/>
		<updated>2014-11-12T17:29:33Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Contact Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This Wiki is for users of UBC's '''Multi-Channel Electronics''' (MCE), including the '''MCE Acquisition Software''' (MAS).&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== MCE Overview ==&lt;br /&gt;
The MCE described here borrows heavily from the designs used at [http://www.nist.gov/pml/ NIST]. Changes have been made to upgrade components, achieve higher integration, and match to the specific experimental configurations.&lt;br /&gt;
&lt;br /&gt;
In basic operation, one MCE [[subrack]] controls the SQUID amplifiers and multiplexer, and reads signals from one 32×41 pixel or 16×41 pixel sub-array. The system hardware is completely modular at the sub-array level. Each sub-array is connected via woven cryogenic cables to a single MCE subrack through 3 or 5 MDM connectors. Each MCE subrack is, in turn, connected by an optical fibre to a single data-acquisition PC running Linux and data-acquisition software ([[MAS]]) developed at UBC.&lt;br /&gt;
 &lt;br /&gt;
Each MCE consists of hybrid analog/digital hardware and firmware developed for Altera Stratix FPGAs. A subrack has up to nine cards: including 2 or 4 [[Readout card]]s each of which reads 8 output columns through 14-bit 50MHz ADCs; 1 [[address card]] to multiplex the first-stage SQUIDs biases at around 20kHz; 1 [[clock card]] to interpret commands and to synchronize all the cards using a 25MHz clock; 2 or 3 [[bias card]]s to control the SQUID series-array feedback, the second-stage SQUID bias and feedback as well as the bolometer bias and heater. During [[auto_setup|detector setup]], the MCE is used to calculate the optimal operating points for the bolometers and the SQUID amplifiers by measuring their characteristics using open and closed feedback loops. During observation, MCE uses a running PID-calculation to determine the first-stage SQUID feedback necessary to keep the whole amplification chain in a linear regime.&lt;br /&gt;
&lt;br /&gt;
In conjunction with the MCEs, a [[Sync Box]] supplies data-valid pulses with serial numbers to all MCE subracks and to the telescope pointing system. This allows synchronization between the data acquisition, the pointing system, and the telescope housekeeping.&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
&lt;br /&gt;
* [[ MCE hardware | MCE Hardware ]] - information on MCE hardware (and accessories)&lt;br /&gt;
* [[ MCE firmware | MCE Firmware ]] - firmware versions, features, and tools (including sync box and PCI card firmware)&lt;br /&gt;
* [[ MAS ]] - the MCE Acquisition Software - kernel driver and low-level tools&lt;br /&gt;
* [[ MCE script ]] - SQUID array setup programs&lt;br /&gt;
* [[ MCE usage ]] - practical usage and reference documents&lt;br /&gt;
&lt;br /&gt;
== Contact Info ==&lt;br /&gt;
&lt;br /&gt;
The '''&amp;lt;code&amp;gt;mce-announce&amp;lt;/code&amp;gt;''' e-mail list is used to communicate important firmware and software updates to the MCE user community.  You can subscribe to it by visiting:&lt;br /&gt;
:https://listserver.phas.ubc.ca/mailman/listinfo/mce-announce&lt;br /&gt;
&lt;br /&gt;
 MCE Lab:                   604-822-2585&lt;br /&gt;
 Halpern's Lab:             604-822-6709&lt;br /&gt;
 &lt;br /&gt;
 Hardware/firmware:         mandana at phas.ubc.ca&lt;br /&gt;
 Software:                  mhasse at astro.princeton.edu, dvw at phas.ubc.ca&lt;br /&gt;
  &lt;br /&gt;
 Department of Physics &amp;amp; Astronomy &lt;br /&gt;
 University of British Columbia&lt;br /&gt;
 Hennings 204, 6224 Agricultural Rd.&lt;br /&gt;
 Vancouver, BC V6T 1Z1 &lt;br /&gt;
 Canada&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Configuration_for_mux11d_operation&amp;diff=5807</id>
		<title>Configuration for mux11d operation</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Configuration_for_mux11d_operation&amp;diff=5807"/>
		<updated>2014-08-18T17:15:24Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:'''This topic is undergoing active development; information on this page is more subject to change than usual!'''&lt;br /&gt;
&lt;br /&gt;
== Hardware configuration ==&lt;br /&gt;
The following diagram shows a conceptual schematic of using the MCE hardware with mux11d SQUID chips [http://www.phas.ubc.ca/~mce/mcedocs/system/mux11d_and_mce.pdf mux11d_with_mce.pdf] (prepared by Jimmy Grayson at Stanford) &lt;br /&gt;
&lt;br /&gt;
For the reference: [[File:Mux11d_bias_simple_diagram.pdf]]&lt;br /&gt;
&lt;br /&gt;
Here is the proposed MCE signal assignment scheme: [http://www.phas.ubc.ca/~mce/mcedocs/system/mce_mdm_signal_names_and_pinouts.pdf [PDF]] [http://www.phas.ubc.ca/~mce/mcedocs/system/mce_mdm_signal_names_and_pinouts.xls [XLS]]&lt;br /&gt;
&lt;br /&gt;
Note that the signals the MCE must provide to the mux11d SQUID system are:&lt;br /&gt;
* SA BIAS per column, constant&lt;br /&gt;
* SA FB per column, fast-switching&lt;br /&gt;
* SQ1 BIAS per column, fast-switching&lt;br /&gt;
* &amp;quot;Rowsel&amp;quot; feedback per row, multiplexing (one value when active, another value when not active)&lt;br /&gt;
&lt;br /&gt;
== Software requirements ==&lt;br /&gt;
&lt;br /&gt;
=== MAS ===&lt;br /&gt;
&lt;br /&gt;
The mux11d support in MAS has been merged back into trunk and the former mux11d branch deleted.  You can check out a new tree:&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/mas/trunk mas&lt;br /&gt;
or &amp;quot;switch&amp;quot; an existing checked-out mux11d branch to use trunk&lt;br /&gt;
 cd ~/code/mas&lt;br /&gt;
 svn switch svn://e-mode.phas.ubc.ca/mas/trunk .&lt;br /&gt;
&lt;br /&gt;
Then rebuild and reinstall.  The only mux11d-specific features are in the &amp;quot;mux_lock&amp;quot; applications (2 new programs) and in the config2 system (mce.cfg).&lt;br /&gt;
&lt;br /&gt;
=== mce_script ===&lt;br /&gt;
&lt;br /&gt;
Updates for mux11d have been put right into mce_script, starting with r914.  Just run &amp;quot;svn update&amp;quot; on your checked out copy.  The major changes so far are:&lt;br /&gt;
* [[ experiment.cfg ]] has extra parameters to configure and enable fast SA feedback and fast SQ1 bias switching, and to guide the new servo applications.&lt;br /&gt;
* the config script generation code (script/bits) will set up the MCE for mux11d operation depending on variables in experiment.cfg&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== mce.cfg ===&lt;br /&gt;
&lt;br /&gt;
When constructing [[ mce.cfg ]], start from templates/mce_v1_mux11d.cin or templates/mce_v2_mux11d.cin.  These will map SQ1 bias as a per-column register, and properly expose fast switching of the SA FB and SQ1 bias.  Since there is no &amp;quot;SQ2&amp;quot; in mux11d, this register is not defined.&lt;br /&gt;
&lt;br /&gt;
The default mux11d configuration maps:&lt;br /&gt;
* SA FB to BC1 FLUX_FB&lt;br /&gt;
* SQ1 BIAS to BC2 FLUX_FB&lt;br /&gt;
&lt;br /&gt;
There are other ways one might choose to do this mapping.  The SQ1 bias card and offset, can be overridden in mce.cin by changing these variables:&lt;br /&gt;
 /* These are only used if hw_mux11d != 0; they specify the bias card&lt;br /&gt;
  * and offset of the flux_fb register used for the SQ1 bias. */&lt;br /&gt;
 $mux11d_sq1_bc = &amp;quot;bc2&amp;quot;;&lt;br /&gt;
 $mux11d_sq1_offset = 0;&lt;br /&gt;
&lt;br /&gt;
At the MCE command level, fast-switching on the SA FB and SQ1 BIAS is accomplished with the same bias card registers used for Fast SQ2 switching (see [[Row-specific SQ2FB (fast switching)#Firmware_requirements|firmware requirements]]).  As an example, to load per-row values into the SA FB on column 5, and then enable muxing on that column, you could do the following:&lt;br /&gt;
 wb sa fb_col5  123 432 514 451 434 653 123 ...&lt;br /&gt;
 wra sa enbl_mux 5 1&lt;br /&gt;
Then to set a constant value on column 5, and disable muxing:&lt;br /&gt;
 wra sa fb 5 400&lt;br /&gt;
 wra sa enbl_mux 5 0&lt;br /&gt;
&lt;br /&gt;
The SQ1 BIAS is exposed in a similar way.  For example, the column 5 biases are exposed through:&lt;br /&gt;
 wb sq1 bias_col5  123 432 514 451 434 653 123 ...&lt;br /&gt;
 wra sq1 enbl_mux 5 1&lt;br /&gt;
&lt;br /&gt;
In practice users don't write these MCE commands directly, and instead use the slightly higher-level of support provided by the experiment.cfg / config script system.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;br /&gt;
&lt;br /&gt;
A number of parameters have been added to experiment.cfg to allow the config script system to set up fast-switching on the SA FB and SQ1 BIAS.  These are:&lt;br /&gt;
&lt;br /&gt;
* Enable:&lt;br /&gt;
**'''hardware_mux11d = 1;''': triggers handling of all the other mux11d specific settings.&lt;br /&gt;
* Row Select DAC control; these are arrays of up to 41 integers representing values for the &amp;quot;row select&amp;quot; (AC ON_BIAS) and &amp;quot;row deselect&amp;quot; (AC OFF_BIAS) DACs.&lt;br /&gt;
**'''row_select = [...];''': will be written to &amp;quot;row select&amp;quot; by the config script.&lt;br /&gt;
**'''row_deselect = [...];''': will be written to &amp;quot;row deselect&amp;quot; by the config script.&lt;br /&gt;
**'''default_row_select, default_row_deselect''': Eventually these will be used by the tuning to select default row_select and row_deselect values if the tuning has been instructed not to try to choose them.&lt;br /&gt;
* SA FB control:&lt;br /&gt;
** '''config_fast_sa_fb = 0;''': When set to 0, MCE will be set up for constant SA FB output, with values obtained from the setting &amp;quot;sa_fb&amp;quot;.  When set to 1, MCE will be set up for fast-switching of SA FB output, with values obtained from '''sa_fb_set'''.&lt;br /&gt;
** '''sa_fb_set = [...];''':  A 1d array encoding SA FB values for each row and column.  (As usual the values are arranged as the 41 values for column 0, followed by the 41 values for column 1, etc.)&lt;br /&gt;
* SQ1 BIAS control - these work exactly like SA FB above.&lt;br /&gt;
** '''config_fast_sq1_bias = 1;'''&lt;br /&gt;
** '''sq1_bias_set = [...];'''&lt;br /&gt;
&lt;br /&gt;
For the purposes of array tuning the '''sq1_servo_*''' parameters will be used by the new '''sq1servo_sa''' program, which ramps the SQ1 FB and servos with the fast-switching SA FB (on each row independently).  This may optionally be done for a series of SQ1 bias values.&lt;br /&gt;
&lt;br /&gt;
A new set of servo control parameters, '''rowsel_servo_*''' (taking the same suffixes as the sq1_servo_* variables) has been introduced to control the new '''rs_servo''' program, which ramps the &amp;quot;row select&amp;quot; DACs and servos with the fast-switching SA FB (optionally at a series of SQ1 biases).  In particular these parameters are:&lt;br /&gt;
;; rowsel_servo_gain, rowsel_servo_flux_start, rowsel_servo_flux_count, rowsel_servo_flux_step, rowsel_servo_bias_ramp, rowsel_servo_bias_start, rowsel_servo_bias_count, rowsel_servo_bias_step&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== auto_setup, mux11d edition ===&lt;br /&gt;
&lt;br /&gt;
The auto_setup code has been updated to support mux11d.  I am uncertain as to how well-tested this code is, however.&lt;br /&gt;
&lt;br /&gt;
The steps in tuning a mux11d system are:&lt;br /&gt;
* '''sa_ramp''' -- same as classic tuning; select SA FB (and possibly also SA BIAS).&lt;br /&gt;
* '''rs_servo''' -- trace out the &amp;quot;Row Select&amp;quot; V-phi curves (all rows), probably at several different S1 bias values; pick a reasonable S1 BIAS (one value per row, column) and ROWSEL/ROWDESEL feedbacks (one value per row).  The algorithm for selecting ROWSEL/ROWDESEL feedback values is:&lt;br /&gt;
** All (row select) V-phi curves are analyzed to identify the first minimum and next maximum in the V-phi response.  Each V-phi curve (bias,row,column) is flagged as valid, or not.  Only valid curves are used when determining optimal biases and feedbacks for each column/row.&lt;br /&gt;
** '''SQ1 bias choice:''' If the SQ1 bias was ramped, an optimal SQ1 bias is chosen for each column and row by finding the bias at which the maximum peak-to-peak response is seen.&lt;br /&gt;
** '''ROWSEL/ROWDESEL choice''':  For a given row select V-phi curve, the ROWDESEL point is the first minimum (probably near FB=0) and the ROWSEL point is the first maximum to the right of the ROWDESEL point.  For each row, the ROWSEL and ROWDESEL feedback values are taken as the median of those values over all columns in the row.  Only the values corresponding to the optimal SQ1 bias are considered.&lt;br /&gt;
* '''sq1_servo_sa''' -- trace out the S1 V-phi curves (all rows), probably at several different S1 bias values; pick final fast-switching S1 BIAS values and fast-switching SA FB set-points.&lt;br /&gt;
** This is probably not fully implemented.&lt;br /&gt;
*  '''sq1_ramp''', '''sq1_ramp_check''', '''sq1_ramp_tes''' -- as in classic tuning; check your open loop response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Using the new servo programs ===&lt;br /&gt;
&lt;br /&gt;
This is only relevant if you're trying to run the servo programs yourself on the command line.  The auto_setup should already know how to do all of this stuff correctly.&lt;br /&gt;
&lt;br /&gt;
The servo programs make a lot of assumptions about the state of the MCE before beginning their job.  Preparation is usually handled by the tuning code.  To run these programs manually, the biggest thing to be careful of is that you have enabled (or disabled) fast-switching on the relevant stages.  Here's a sequence of terminal commands which should work:&lt;br /&gt;
&lt;br /&gt;
 # Disable fast switching&lt;br /&gt;
 mas_param set config_fast_sa_fb 0&lt;br /&gt;
 mas_param set config_fast_sq1_bias 0&lt;br /&gt;
 # Basic MCE setup and SA tuning&lt;br /&gt;
 auto_setup --last-stage sa_ramp&lt;br /&gt;
 mas_param set config_fast_sa_fb 1&lt;br /&gt;
 # Recreate config script and run it to program the MCE.&lt;br /&gt;
 mce_make_config -x&lt;br /&gt;
 # Run the servos on RC2&lt;br /&gt;
 sq1servo_sa 2 myservo1&lt;br /&gt;
 rs_servo 2 myservo2&lt;br /&gt;
&lt;br /&gt;
Later, once you have set up the &amp;quot;sq1_bias_set&amp;quot; values:&lt;br /&gt;
 mas_param set config_fast_sq1_bias 1&lt;br /&gt;
 mce_make_config -x&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Configuration_for_mux11d_operation&amp;diff=5806</id>
		<title>Configuration for mux11d operation</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Configuration_for_mux11d_operation&amp;diff=5806"/>
		<updated>2014-08-15T21:46:42Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Using the new servo programs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:'''This topic is undergoing active development; information on this page is more subject to change than usual!'''&lt;br /&gt;
&lt;br /&gt;
== Hardware configuration ==&lt;br /&gt;
The following diagram shows a conceptual schematic of using the MCE hardware with mux11d SQUID chips [http://www.phas.ubc.ca/~mce/mcedocs/system/mux11d_and_mce.pdf mux11d_with_mce.pdf] (prepared by Jimmy Grayson at Stanford) &lt;br /&gt;
&lt;br /&gt;
For the reference: [[File:Mux11d_bias_simple_diagram.pdf]]&lt;br /&gt;
&lt;br /&gt;
Here is the proposed MCE signal assignment scheme: [http://www.phas.ubc.ca/~mce/mcedocs/system/mce_mdm_signal_names_and_pinouts.pdf [PDF]] [http://www.phas.ubc.ca/~mce/mcedocs/system/mce_mdm_signal_names_and_pinouts.xls [XLS]]&lt;br /&gt;
&lt;br /&gt;
Note that the signals the MCE must provide to the mux11d SQUID system are:&lt;br /&gt;
* SA BIAS per column, constant&lt;br /&gt;
* SA FB per column, fast-switching&lt;br /&gt;
* SQ1 BIAS per column, fast-switching&lt;br /&gt;
* &amp;quot;Rowsel&amp;quot; feedback per row, multiplexing (one value when active, another value when not active)&lt;br /&gt;
&lt;br /&gt;
== Software requirements ==&lt;br /&gt;
&lt;br /&gt;
=== MAS ===&lt;br /&gt;
&lt;br /&gt;
The mux11d support in MAS has been merged back into trunk and the former mux11d branch deleted.  You can check out a new tree:&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/mas/trunk mas&lt;br /&gt;
or &amp;quot;switch&amp;quot; an existing checked-out mux11d branch to use trunk&lt;br /&gt;
 cd ~/code/mas&lt;br /&gt;
 svn switch svn://e-mode.phas.ubc.ca/mas/trunk .&lt;br /&gt;
&lt;br /&gt;
Then rebuild and reinstall.  The only mux11d-specific features are in the &amp;quot;mux_lock&amp;quot; applications (2 new programs) and in the config2 system (mce.cfg).&lt;br /&gt;
&lt;br /&gt;
=== mce_script ===&lt;br /&gt;
&lt;br /&gt;
Updates for mux11d have been put right into mce_script, starting with r914.  Just run &amp;quot;svn update&amp;quot; on your checked out copy.  The major changes so far are:&lt;br /&gt;
* [[ experiment.cfg ]] has extra parameters to configure and enable fast SA feedback and fast SQ1 bias switching, and to guide the new servo applications.&lt;br /&gt;
* the config script generation code (script/bits) will set up the MCE for mux11d operation depending on variables in experiment.cfg&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== mce.cfg ===&lt;br /&gt;
&lt;br /&gt;
When constructing [[ mce.cfg ]], start from templates/mce_v1_mux11d.cin or templates/mce_v2_mux11d.cin.  These will map SQ1 bias as a per-column register, and properly expose fast switching of the SA FB and SQ1 bias.  Since there is no &amp;quot;SQ2&amp;quot; in mux11d, this register is not defined.&lt;br /&gt;
&lt;br /&gt;
The default mux11d configuration maps:&lt;br /&gt;
* SA FB to BC1 FLUX_FB&lt;br /&gt;
* SQ1 BIAS to BC2 FLUX_FB&lt;br /&gt;
&lt;br /&gt;
There are other ways one might choose to do this mapping.  The SQ1 bias card and offset, can be overridden in mce.cin by changing these variables:&lt;br /&gt;
 /* These are only used if hw_mux11d != 0; they specify the bias card&lt;br /&gt;
  * and offset of the flux_fb register used for the SQ1 bias. */&lt;br /&gt;
 $mux11d_sq1_bc = &amp;quot;bc2&amp;quot;;&lt;br /&gt;
 $mux11d_sq1_offset = 0;&lt;br /&gt;
&lt;br /&gt;
At the MCE command level, fast-switching on the SA FB and SQ1 BIAS is accomplished with the same bias card registers used for Fast SQ2 switching (see [[Row-specific SQ2FB (fast switching)#Firmware_requirements|firmware requirements]]).  As an example, to load per-row values into the SA FB on column 5, and then enable muxing on that column, you could do the following:&lt;br /&gt;
 wb sa fb_col5  123 432 514 451 434 653 123 ...&lt;br /&gt;
 wra sa enbl_mux 5 1&lt;br /&gt;
Then to set a constant value on column 5, and disable muxing:&lt;br /&gt;
 wra sa fb 5 400&lt;br /&gt;
 wra sa enbl_mux 5 0&lt;br /&gt;
&lt;br /&gt;
The SQ1 BIAS is exposed in a similar way.  For example, the column 5 biases are exposed through:&lt;br /&gt;
 wb sq1 bias_col5  123 432 514 451 434 653 123 ...&lt;br /&gt;
 wra sq1 enbl_mux 5 1&lt;br /&gt;
&lt;br /&gt;
In practice users don't write these MCE commands directly, and instead use the slightly higher-level of support provided by the experiment.cfg / config script system.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;br /&gt;
&lt;br /&gt;
A number of parameters have been added to experiment.cfg to allow the config script system to set up fast-switching on the SA FB and SQ1 BIAS.  These are:&lt;br /&gt;
&lt;br /&gt;
* Enable:&lt;br /&gt;
**'''hardware_mux11d = 1;''': triggers handling of all the other mux11d specific settings.&lt;br /&gt;
* Row Select DAC control; these are arrays of up to 41 integers representing values for the &amp;quot;row select&amp;quot; (AC ON_BIAS) and &amp;quot;row deselect&amp;quot; (AC OFF_BIAS) DACs.&lt;br /&gt;
**'''row_select = [...];''': will be written to &amp;quot;row select&amp;quot; by the config script.&lt;br /&gt;
**'''row_deselect = [...];''': will be written to &amp;quot;row deselect&amp;quot; by the config script.&lt;br /&gt;
**'''default_row_select, default_row_deselect''': Eventually these will be used by the tuning to select default row_select and row_deselect values if the tuning has been instructed not to try to choose them.&lt;br /&gt;
* SA FB control:&lt;br /&gt;
** '''config_fast_sa_fb = 0;''': When set to 0, MCE will be set up for constant SA FB output, with values obtained from the setting &amp;quot;sa_fb&amp;quot;.  When set to 1, MCE will be set up for fast-switching of SA FB output, with values obtained from '''sa_fb_set'''.&lt;br /&gt;
** '''sa_fb_set = [...];''':  A 1d array encoding SA FB values for each row and column.  (As usual the values are arranged as the 41 values for column 0, followed by the 41 values for column 1, etc.)&lt;br /&gt;
* SQ1 BIAS control - these work exactly like SA FB above.&lt;br /&gt;
** '''config_fast_sq1_bias = 1;'''&lt;br /&gt;
** '''sq1_bias_set = [...];'''&lt;br /&gt;
&lt;br /&gt;
For the purposes of array tuning the '''sq1_servo_*''' parameters will be used by the new '''sq1servo_sa''' program, which ramps the SQ1 FB and servos with the fast-switching SA FB (on each row independently).  This may optionally be done for a series of SQ1 bias values.&lt;br /&gt;
&lt;br /&gt;
A new set of servo control parameters, '''rowsel_servo_*''' (taking the same suffixes as the sq1_servo_* variables) has been introduced to control the new '''rs_servo''' program, which ramps the &amp;quot;row select&amp;quot; DACs and servos with the fast-switching SA FB (optionally at a series of SQ1 biases).  In particular these parameters are:&lt;br /&gt;
;; rowsel_servo_gain, rowsel_servo_flux_start, rowsel_servo_flux_count, rowsel_servo_flux_step, rowsel_servo_bias_ramp, rowsel_servo_bias_start, rowsel_servo_bias_count, rowsel_servo_bias_step&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== auto_setup, mux11d edition ===&lt;br /&gt;
&lt;br /&gt;
The auto_setup code has been updated to support mux11d.  I am uncertain as to how well-tested this code is, however.&lt;br /&gt;
&lt;br /&gt;
The steps in tuning a mux11d system are:&lt;br /&gt;
* '''sa_ramp''' -- same as classic tuning; select SA FB (and possibly also SA BIAS).&lt;br /&gt;
* '''rs_servo''' -- trace out the Rowsel V-phi curves (all rows), probably at several different S1 bias values; pick a reasonable S1 BIAS (one value per row, column) and ROWSEL/ROWDESEL (one value per row) values.&lt;br /&gt;
* '''sq1_servo_sa''' -- trace out the S1 V-phi curves (all rows), probably at several different S1 bias values; pick final fast-switching S1 BIAS values and fast-switching SA FB set-points.&lt;br /&gt;
*  '''sq1_ramp''', '''sq1_ramp_check''', '''sq1_ramp_tes''' -- as in classic tuning; check your open loop response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Using the new servo programs ===&lt;br /&gt;
&lt;br /&gt;
This is only relevant if you're trying to run the servo programs yourself on the command line.  The auto_setup should already know how to do all of this stuff correctly.&lt;br /&gt;
&lt;br /&gt;
The servo programs make a lot of assumptions about the state of the MCE before beginning their job.  Preparation is usually handled by the tuning code.  To run these programs manually, the biggest thing to be careful of is that you have enabled (or disabled) fast-switching on the relevant stages.  Here's a sequence of terminal commands which should work:&lt;br /&gt;
&lt;br /&gt;
 # Disable fast switching&lt;br /&gt;
 mas_param set config_fast_sa_fb 0&lt;br /&gt;
 mas_param set config_fast_sq1_bias 0&lt;br /&gt;
 # Basic MCE setup and SA tuning&lt;br /&gt;
 auto_setup --last-stage sa_ramp&lt;br /&gt;
 mas_param set config_fast_sa_fb 1&lt;br /&gt;
 # Recreate config script and run it to program the MCE.&lt;br /&gt;
 mce_make_config -x&lt;br /&gt;
 # Run the servos on RC2&lt;br /&gt;
 sq1servo_sa 2 myservo1&lt;br /&gt;
 rs_servo 2 myservo2&lt;br /&gt;
&lt;br /&gt;
Later, once you have set up the &amp;quot;sq1_bias_set&amp;quot; values:&lt;br /&gt;
 mas_param set config_fast_sq1_bias 1&lt;br /&gt;
 mce_make_config -x&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Configuration_for_mux11d_operation&amp;diff=5805</id>
		<title>Configuration for mux11d operation</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Configuration_for_mux11d_operation&amp;diff=5805"/>
		<updated>2014-08-15T21:45:52Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:'''This topic is undergoing active development; information on this page is more subject to change than usual!'''&lt;br /&gt;
&lt;br /&gt;
== Hardware configuration ==&lt;br /&gt;
The following diagram shows a conceptual schematic of using the MCE hardware with mux11d SQUID chips [http://www.phas.ubc.ca/~mce/mcedocs/system/mux11d_and_mce.pdf mux11d_with_mce.pdf] (prepared by Jimmy Grayson at Stanford) &lt;br /&gt;
&lt;br /&gt;
For the reference: [[File:Mux11d_bias_simple_diagram.pdf]]&lt;br /&gt;
&lt;br /&gt;
Here is the proposed MCE signal assignment scheme: [http://www.phas.ubc.ca/~mce/mcedocs/system/mce_mdm_signal_names_and_pinouts.pdf [PDF]] [http://www.phas.ubc.ca/~mce/mcedocs/system/mce_mdm_signal_names_and_pinouts.xls [XLS]]&lt;br /&gt;
&lt;br /&gt;
Note that the signals the MCE must provide to the mux11d SQUID system are:&lt;br /&gt;
* SA BIAS per column, constant&lt;br /&gt;
* SA FB per column, fast-switching&lt;br /&gt;
* SQ1 BIAS per column, fast-switching&lt;br /&gt;
* &amp;quot;Rowsel&amp;quot; feedback per row, multiplexing (one value when active, another value when not active)&lt;br /&gt;
&lt;br /&gt;
== Software requirements ==&lt;br /&gt;
&lt;br /&gt;
=== MAS ===&lt;br /&gt;
&lt;br /&gt;
The mux11d support in MAS has been merged back into trunk and the former mux11d branch deleted.  You can check out a new tree:&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/mas/trunk mas&lt;br /&gt;
or &amp;quot;switch&amp;quot; an existing checked-out mux11d branch to use trunk&lt;br /&gt;
 cd ~/code/mas&lt;br /&gt;
 svn switch svn://e-mode.phas.ubc.ca/mas/trunk .&lt;br /&gt;
&lt;br /&gt;
Then rebuild and reinstall.  The only mux11d-specific features are in the &amp;quot;mux_lock&amp;quot; applications (2 new programs) and in the config2 system (mce.cfg).&lt;br /&gt;
&lt;br /&gt;
=== mce_script ===&lt;br /&gt;
&lt;br /&gt;
Updates for mux11d have been put right into mce_script, starting with r914.  Just run &amp;quot;svn update&amp;quot; on your checked out copy.  The major changes so far are:&lt;br /&gt;
* [[ experiment.cfg ]] has extra parameters to configure and enable fast SA feedback and fast SQ1 bias switching, and to guide the new servo applications.&lt;br /&gt;
* the config script generation code (script/bits) will set up the MCE for mux11d operation depending on variables in experiment.cfg&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== mce.cfg ===&lt;br /&gt;
&lt;br /&gt;
When constructing [[ mce.cfg ]], start from templates/mce_v1_mux11d.cin or templates/mce_v2_mux11d.cin.  These will map SQ1 bias as a per-column register, and properly expose fast switching of the SA FB and SQ1 bias.  Since there is no &amp;quot;SQ2&amp;quot; in mux11d, this register is not defined.&lt;br /&gt;
&lt;br /&gt;
The default mux11d configuration maps:&lt;br /&gt;
* SA FB to BC1 FLUX_FB&lt;br /&gt;
* SQ1 BIAS to BC2 FLUX_FB&lt;br /&gt;
&lt;br /&gt;
There are other ways one might choose to do this mapping.  The SQ1 bias card and offset, can be overridden in mce.cin by changing these variables:&lt;br /&gt;
 /* These are only used if hw_mux11d != 0; they specify the bias card&lt;br /&gt;
  * and offset of the flux_fb register used for the SQ1 bias. */&lt;br /&gt;
 $mux11d_sq1_bc = &amp;quot;bc2&amp;quot;;&lt;br /&gt;
 $mux11d_sq1_offset = 0;&lt;br /&gt;
&lt;br /&gt;
At the MCE command level, fast-switching on the SA FB and SQ1 BIAS is accomplished with the same bias card registers used for Fast SQ2 switching (see [[Row-specific SQ2FB (fast switching)#Firmware_requirements|firmware requirements]]).  As an example, to load per-row values into the SA FB on column 5, and then enable muxing on that column, you could do the following:&lt;br /&gt;
 wb sa fb_col5  123 432 514 451 434 653 123 ...&lt;br /&gt;
 wra sa enbl_mux 5 1&lt;br /&gt;
Then to set a constant value on column 5, and disable muxing:&lt;br /&gt;
 wra sa fb 5 400&lt;br /&gt;
 wra sa enbl_mux 5 0&lt;br /&gt;
&lt;br /&gt;
The SQ1 BIAS is exposed in a similar way.  For example, the column 5 biases are exposed through:&lt;br /&gt;
 wb sq1 bias_col5  123 432 514 451 434 653 123 ...&lt;br /&gt;
 wra sq1 enbl_mux 5 1&lt;br /&gt;
&lt;br /&gt;
In practice users don't write these MCE commands directly, and instead use the slightly higher-level of support provided by the experiment.cfg / config script system.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;br /&gt;
&lt;br /&gt;
A number of parameters have been added to experiment.cfg to allow the config script system to set up fast-switching on the SA FB and SQ1 BIAS.  These are:&lt;br /&gt;
&lt;br /&gt;
* Enable:&lt;br /&gt;
**'''hardware_mux11d = 1;''': triggers handling of all the other mux11d specific settings.&lt;br /&gt;
* Row Select DAC control; these are arrays of up to 41 integers representing values for the &amp;quot;row select&amp;quot; (AC ON_BIAS) and &amp;quot;row deselect&amp;quot; (AC OFF_BIAS) DACs.&lt;br /&gt;
**'''row_select = [...];''': will be written to &amp;quot;row select&amp;quot; by the config script.&lt;br /&gt;
**'''row_deselect = [...];''': will be written to &amp;quot;row deselect&amp;quot; by the config script.&lt;br /&gt;
**'''default_row_select, default_row_deselect''': Eventually these will be used by the tuning to select default row_select and row_deselect values if the tuning has been instructed not to try to choose them.&lt;br /&gt;
* SA FB control:&lt;br /&gt;
** '''config_fast_sa_fb = 0;''': When set to 0, MCE will be set up for constant SA FB output, with values obtained from the setting &amp;quot;sa_fb&amp;quot;.  When set to 1, MCE will be set up for fast-switching of SA FB output, with values obtained from '''sa_fb_set'''.&lt;br /&gt;
** '''sa_fb_set = [...];''':  A 1d array encoding SA FB values for each row and column.  (As usual the values are arranged as the 41 values for column 0, followed by the 41 values for column 1, etc.)&lt;br /&gt;
* SQ1 BIAS control - these work exactly like SA FB above.&lt;br /&gt;
** '''config_fast_sq1_bias = 1;'''&lt;br /&gt;
** '''sq1_bias_set = [...];'''&lt;br /&gt;
&lt;br /&gt;
For the purposes of array tuning the '''sq1_servo_*''' parameters will be used by the new '''sq1servo_sa''' program, which ramps the SQ1 FB and servos with the fast-switching SA FB (on each row independently).  This may optionally be done for a series of SQ1 bias values.&lt;br /&gt;
&lt;br /&gt;
A new set of servo control parameters, '''rowsel_servo_*''' (taking the same suffixes as the sq1_servo_* variables) has been introduced to control the new '''rs_servo''' program, which ramps the &amp;quot;row select&amp;quot; DACs and servos with the fast-switching SA FB (optionally at a series of SQ1 biases).  In particular these parameters are:&lt;br /&gt;
;; rowsel_servo_gain, rowsel_servo_flux_start, rowsel_servo_flux_count, rowsel_servo_flux_step, rowsel_servo_bias_ramp, rowsel_servo_bias_start, rowsel_servo_bias_count, rowsel_servo_bias_step&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== auto_setup, mux11d edition ===&lt;br /&gt;
&lt;br /&gt;
The auto_setup code has been updated to support mux11d.  I am uncertain as to how well-tested this code is, however.&lt;br /&gt;
&lt;br /&gt;
The steps in tuning a mux11d system are:&lt;br /&gt;
* '''sa_ramp''' -- same as classic tuning; select SA FB (and possibly also SA BIAS).&lt;br /&gt;
* '''rs_servo''' -- trace out the Rowsel V-phi curves (all rows), probably at several different S1 bias values; pick a reasonable S1 BIAS (one value per row, column) and ROWSEL/ROWDESEL (one value per row) values.&lt;br /&gt;
* '''sq1_servo_sa''' -- trace out the S1 V-phi curves (all rows), probably at several different S1 bias values; pick final fast-switching S1 BIAS values and fast-switching SA FB set-points.&lt;br /&gt;
*  '''sq1_ramp''', '''sq1_ramp_check''', '''sq1_ramp_tes''' -- as in classic tuning; check your open loop response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Using the new servo programs ===&lt;br /&gt;
&lt;br /&gt;
The servo programs make a lot of assumptions about the state of the MCE before beginning their job.  Preparation is usually handled by the tuning code.  To run these programs manually, the biggest thing to be careful of is that you have enabled (or disabled) fast-switching on the relevant stages.  Here's a sequence of terminal commands which should work:&lt;br /&gt;
&lt;br /&gt;
 # Disable fast switching&lt;br /&gt;
 mas_param set config_fast_sa_fb 0&lt;br /&gt;
 mas_param set config_fast_sq1_bias 0&lt;br /&gt;
 # Basic MCE setup and SA tuning&lt;br /&gt;
 auto_setup --last-stage sa_ramp&lt;br /&gt;
 mas_param set config_fast_sa_fb 1&lt;br /&gt;
 # Recreate config script and run it to program the MCE.&lt;br /&gt;
 mce_make_config -x&lt;br /&gt;
 # Run the servos on RC2&lt;br /&gt;
 sq1servo_sa 2 myservo1&lt;br /&gt;
 rs_servo 2 myservo2&lt;br /&gt;
&lt;br /&gt;
Later, once you have set up the &amp;quot;sq1_bias_set&amp;quot; values:&lt;br /&gt;
 mas_param set config_fast_sq1_bias 1&lt;br /&gt;
 mce_make_config -x&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Configuration_for_mux11d_operation&amp;diff=5804</id>
		<title>Configuration for mux11d operation</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Configuration_for_mux11d_operation&amp;diff=5804"/>
		<updated>2014-08-15T21:36:33Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:'''This topic is undergoing active development; information on this page is more subject to change than usual!'''&lt;br /&gt;
&lt;br /&gt;
== Hardware configuration ==&lt;br /&gt;
The following diagram shows a conceptual schematic of using the MCE hardware with mux11d SQUID chips [http://www.phas.ubc.ca/~mce/mcedocs/system/mux11d_and_mce.pdf mux11d_with_mce.pdf] (prepared by Jimmy Grayson at Stanford) &lt;br /&gt;
&lt;br /&gt;
For the reference: [[File:Mux11d_bias_simple_diagram.pdf]]&lt;br /&gt;
&lt;br /&gt;
Here is the proposed MCE signal assignment scheme: [http://www.phas.ubc.ca/~mce/mcedocs/system/mce_mdm_signal_names_and_pinouts.pdf [PDF]] [http://www.phas.ubc.ca/~mce/mcedocs/system/mce_mdm_signal_names_and_pinouts.xls [XLS]]&lt;br /&gt;
&lt;br /&gt;
Note that the signals the MCE must provide to the mux11d SQUID system are:&lt;br /&gt;
* SA BIAS per column, constant&lt;br /&gt;
* SA FB per column, fast-switching&lt;br /&gt;
* SQ1 BIAS per column, fast-switching&lt;br /&gt;
* &amp;quot;Rowsel&amp;quot; feedback per row, multiplexing (one value when active, another value when not active)&lt;br /&gt;
&lt;br /&gt;
== Software requirements ==&lt;br /&gt;
&lt;br /&gt;
=== MAS ===&lt;br /&gt;
&lt;br /&gt;
The mux11d support in MAS has been merged back into trunk and the former mux11d branch deleted.  You can check out a new tree:&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/mas/trunk mas&lt;br /&gt;
or &amp;quot;switch&amp;quot; an existing checked-out mux11d branch to use trunk&lt;br /&gt;
 cd ~/code/mas&lt;br /&gt;
 svn switch svn://e-mode.phas.ubc.ca/mas/trunk .&lt;br /&gt;
&lt;br /&gt;
Then rebuild and reinstall.  The only mux11d-specific features are in the &amp;quot;mux_lock&amp;quot; applications (2 new programs) and in the config2 system (mce.cfg).&lt;br /&gt;
&lt;br /&gt;
=== mce_script ===&lt;br /&gt;
&lt;br /&gt;
Updates for mux11d have been put right into mce_script, starting with r914.  Just run &amp;quot;svn update&amp;quot; on your checked out copy.  The major changes so far are:&lt;br /&gt;
* [[ experiment.cfg ]] has extra parameters to configure and enable fast SA feedback and fast SQ1 bias switching, and to guide the new servo applications.&lt;br /&gt;
* the config script generation code (script/bits) will set up the MCE for mux11d operation depending on variables in experiment.cfg&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== mce.cfg ===&lt;br /&gt;
&lt;br /&gt;
When constructing [[ mce.cfg ]], start from templates/mce_v1_mux11d.cin or templates/mce_v2_mux11d.cin.  These will map SQ1 bias as a per-column register, and properly expose fast switching of the SA FB and SQ1 bias.  Since there is no &amp;quot;SQ2&amp;quot; in mux11d, this register is not defined.&lt;br /&gt;
&lt;br /&gt;
The default mux11d configuration maps:&lt;br /&gt;
* SA FB to BC1 FLUX_FB&lt;br /&gt;
* SQ1 BIAS to BC2 FLUX_FB&lt;br /&gt;
&lt;br /&gt;
There are other ways one might choose to do this mapping.  The SQ1 bias card and offset, can be overridden in mce.cin by changing these variables:&lt;br /&gt;
 /* These are only used if hw_mux11d != 0; they specify the bias card&lt;br /&gt;
  * and offset of the flux_fb register used for the SQ1 bias. */&lt;br /&gt;
 $mux11d_sq1_bc = &amp;quot;bc2&amp;quot;;&lt;br /&gt;
 $mux11d_sq1_offset = 0;&lt;br /&gt;
&lt;br /&gt;
At the MCE command level, fast-switching on the SA FB and SQ1 BIAS is accomplished with the same bias card registers used for Fast SQ2 switching (see [[Row-specific SQ2FB (fast switching)#Firmware_requirements|firmware requirements]]).  As an example, to load per-row values into the SA FB on column 5, and then enable muxing on that column, you could do the following:&lt;br /&gt;
 wb sa fb_col5  123 432 514 451 434 653 123 ...&lt;br /&gt;
 wra sa enbl_mux 5 1&lt;br /&gt;
Then to set a constant value on column 5, and disable muxing:&lt;br /&gt;
 wra sa fb 5 400&lt;br /&gt;
 wra sa enbl_mux 5 0&lt;br /&gt;
&lt;br /&gt;
The SQ1 BIAS is exposed in a similar way.  For example, the column 5 biases are exposed through:&lt;br /&gt;
 wb sq1 bias_col5  123 432 514 451 434 653 123 ...&lt;br /&gt;
 wra sq1 enbl_mux 5 1&lt;br /&gt;
&lt;br /&gt;
In practice users don't write these MCE commands directly, and instead use the slightly higher-level of support provided by the experiment.cfg / config script system.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;br /&gt;
&lt;br /&gt;
A number of parameters have been added to experiment.cfg to allow the config script system to set up fast-switching on the SA FB and SQ1 BIAS.  These are:&lt;br /&gt;
&lt;br /&gt;
* Enable:&lt;br /&gt;
**'''hardware_mux11d = 1;''': triggers handling of all the other mux11d specific settings.&lt;br /&gt;
* Row Select DAC control; these are arrays of up to 41 integers representing values for the &amp;quot;row select&amp;quot; (AC ON_BIAS) and &amp;quot;row deselect&amp;quot; (AC OFF_BIAS) DACs.&lt;br /&gt;
**'''row_select = [...];''': will be written to &amp;quot;row select&amp;quot; by the config script.&lt;br /&gt;
**'''row_deselect = [...];''': will be written to &amp;quot;row deselect&amp;quot; by the config script.&lt;br /&gt;
**'''default_row_select, default_row_deselect''': Eventually these will be used by the tuning to select default row_select and row_deselect values if the tuning has been instructed not to try to choose them.&lt;br /&gt;
* SA FB control:&lt;br /&gt;
** '''config_fast_sa_fb = 0;''': When set to 0, MCE will be set up for constant SA FB output, with values obtained from the setting &amp;quot;sa_fb&amp;quot;.  When set to 1, MCE will be set up for fast-switching of SA FB output, with values obtained from '''sa_fb_set'''.&lt;br /&gt;
** '''sa_fb_set = [...];''':  A 1d array encoding SA FB values for each row and column.  (As usual the values are arranged as the 41 values for column 0, followed by the 41 values for column 1, etc.)&lt;br /&gt;
* SQ1 BIAS control - these work exactly like SA FB above.&lt;br /&gt;
** '''config_fast_sq1_bias = 1;'''&lt;br /&gt;
** '''sq1_bias_set = [...];'''&lt;br /&gt;
&lt;br /&gt;
For the purposes of array tuning the '''sq1_servo_*''' parameters will be used by the new '''sq1servo_sa''' program, which ramps the SQ1 FB and servos with the fast-switching SA FB (on each row independently).  This may optionally be done for a series of SQ1 bias values.&lt;br /&gt;
&lt;br /&gt;
A new set of servo control parameters, '''rowsel_servo_*''' (taking the same suffixes as the sq1_servo_* variables) has been introduced to control the new '''rs_servo''' program, which ramps the &amp;quot;row select&amp;quot; DACs and servos with the fast-switching SA FB (optionally at a series of SQ1 biases).  In particular these parameters are:&lt;br /&gt;
;; rowsel_servo_gain, rowsel_servo_flux_start, rowsel_servo_flux_count, rowsel_servo_flux_step, rowsel_servo_bias_ramp, rowsel_servo_bias_start, rowsel_servo_bias_count, rowsel_servo_bias_step&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== Using the new servo programs ===&lt;br /&gt;
&lt;br /&gt;
The servo programs make a lot of assumptions about the state of the MCE before beginning their job.  Preparation is usually handled by the tuning code.  To run these programs manually, the biggest thing to be careful of is that you have enabled (or disabled) fast-switching on the relevant stages.  Here's a sequence of terminal commands which should work:&lt;br /&gt;
&lt;br /&gt;
 # Disable fast switching&lt;br /&gt;
 mas_param set config_fast_sa_fb 0&lt;br /&gt;
 mas_param set config_fast_sq1_bias 0&lt;br /&gt;
 # Basic MCE setup and SA tuning&lt;br /&gt;
 auto_setup --last-stage sa_ramp&lt;br /&gt;
 mas_param set config_fast_sa_fb 1&lt;br /&gt;
 # Recreate config script and run it to program the MCE.&lt;br /&gt;
 mce_make_config -x&lt;br /&gt;
 # Run the servos on RC2&lt;br /&gt;
 sq1servo_sa 2 myservo1&lt;br /&gt;
 rs_servo 2 myservo2&lt;br /&gt;
&lt;br /&gt;
Later, once you have set up the &amp;quot;sq1_bias_set&amp;quot; values:&lt;br /&gt;
 mas_param set config_fast_sq1_bias 1&lt;br /&gt;
 mce_make_config -x&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Configuration_for_mux11d_operation&amp;diff=5803</id>
		<title>Configuration for mux11d operation</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Configuration_for_mux11d_operation&amp;diff=5803"/>
		<updated>2014-08-15T21:33:12Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* mce.cfg */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:'''This topic is undergoing active development; information on this page is more subject to change than usual!'''&lt;br /&gt;
== Hardware configuration ==&lt;br /&gt;
The following diagram shows a conceptual schematic of using the MCE hardware with mux11d SQUID chips [http://www.phas.ubc.ca/~mce/mcedocs/system/mux11d_and_mce.pdf mux11d_with_mce.pdf] (prepared by Jimmy Grayson at Stanford) &lt;br /&gt;
&lt;br /&gt;
For the reference: [[File:Mux11d_bias_simple_diagram.pdf]]&lt;br /&gt;
&lt;br /&gt;
Here is the proposed MCE signal assignment scheme: [http://www.phas.ubc.ca/~mce/mcedocs/system/mce_mdm_signal_names_and_pinouts.pdf [PDF]] [http://www.phas.ubc.ca/~mce/mcedocs/system/mce_mdm_signal_names_and_pinouts.xls [XLS]]&lt;br /&gt;
&lt;br /&gt;
== Software requirements ==&lt;br /&gt;
&lt;br /&gt;
=== MAS ===&lt;br /&gt;
&lt;br /&gt;
The mux11d support in MAS has been merged back into trunk and the former mux11d branch deleted.  You can check out a new tree:&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/mas/trunk mas&lt;br /&gt;
or &amp;quot;switch&amp;quot; an existing checked-out mux11d branch to use trunk&lt;br /&gt;
 cd ~/code/mas&lt;br /&gt;
 svn switch svn://e-mode.phas.ubc.ca/mas/trunk .&lt;br /&gt;
&lt;br /&gt;
Then rebuild and reinstall.  The only mux11d-specific features are in the &amp;quot;mux_lock&amp;quot; applications (2 new programs) and in the config2 system (mce.cfg).&lt;br /&gt;
&lt;br /&gt;
=== mce_script ===&lt;br /&gt;
&lt;br /&gt;
Updates for mux11d have been put right into mce_script, starting with r914.  Just run &amp;quot;svn update&amp;quot; on your checked out copy.  The major changes so far are:&lt;br /&gt;
* [[ experiment.cfg ]] has extra parameters to configure and enable fast SA feedback and fast SQ1 bias switching, and to guide the new servo applications.&lt;br /&gt;
* the config script generation code (script/bits) will set up the MCE for mux11d operation depending on variables in experiment.cfg&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== mce.cfg ===&lt;br /&gt;
&lt;br /&gt;
When constructing [[ mce.cfg ]], start from templates/mce_v1_mux11d.cin or templates/mce_v2_mux11d.cin.  These will map SQ1 bias as a per-column register, and properly expose fast switching of the SA FB and SQ1 bias.  Since there is no &amp;quot;SQ2&amp;quot; in mux11d, this register is not defined.&lt;br /&gt;
&lt;br /&gt;
The default mux11d configuration maps:&lt;br /&gt;
* SA FB to BC1 FLUX_FB&lt;br /&gt;
* SQ1 BIAS to BC2 FLUX_FB&lt;br /&gt;
&lt;br /&gt;
There are other ways one might choose to do this mapping.  The SQ1 bias card and offset, can be overridden in mce.cin by changing these variables:&lt;br /&gt;
 /* These are only used if hw_mux11d != 0; they specify the bias card&lt;br /&gt;
  * and offset of the flux_fb register used for the SQ1 bias. */&lt;br /&gt;
 $mux11d_sq1_bc = &amp;quot;bc2&amp;quot;;&lt;br /&gt;
 $mux11d_sq1_offset = 0;&lt;br /&gt;
&lt;br /&gt;
At the MCE command level, fast-switching on the SA FB and SQ1 BIAS is accomplished with the same bias card registers used for Fast SQ2 switching (see [[Row-specific SQ2FB (fast switching)#Firmware_requirements|firmware requirements]]).  As an example, to load per-row values into the SA FB on column 5, and then enable muxing on that column, you could do the following:&lt;br /&gt;
 wb sa fb_col5  123 432 514 451 434 653 123 ...&lt;br /&gt;
 wra sa enbl_mux 5 1&lt;br /&gt;
Then to set a constant value on column 5, and disable muxing:&lt;br /&gt;
 wra sa fb 5 400&lt;br /&gt;
 wra sa enbl_mux 5 0&lt;br /&gt;
&lt;br /&gt;
The SQ1 BIAS is exposed in a similar way.  For example, the column 5 biases are exposed through:&lt;br /&gt;
 wb sq1 bias_col5  123 432 514 451 434 653 123 ...&lt;br /&gt;
 wra sq1 enbl_mux 5 1&lt;br /&gt;
&lt;br /&gt;
In practice users don't write these MCE commands directly, and instead use the slightly higher-level of support provided by the experiment.cfg / config script system.&lt;br /&gt;
&lt;br /&gt;
=== experiment.cfg ===&lt;br /&gt;
&lt;br /&gt;
A number of parameters have been added to experiment.cfg to allow the config script system to set up fast-switching on the SA FB and SQ1 BIAS.  These are:&lt;br /&gt;
&lt;br /&gt;
* Enable:&lt;br /&gt;
**'''hardware_mux11d = 1;''': triggers handling of all the other mux11d specific settings.&lt;br /&gt;
* Row Select DAC control; these are arrays of up to 41 integers representing values for the &amp;quot;row select&amp;quot; (AC ON_BIAS) and &amp;quot;row deselect&amp;quot; (AC OFF_BIAS) DACs.&lt;br /&gt;
**'''row_select = [...];''': will be written to &amp;quot;row select&amp;quot; by the config script.&lt;br /&gt;
**'''row_deselect = [...];''': will be written to &amp;quot;row deselect&amp;quot; by the config script.&lt;br /&gt;
**'''default_row_select, default_row_deselect''': Eventually these will be used by the tuning to select default row_select and row_deselect values if the tuning has been instructed not to try to choose them.&lt;br /&gt;
* SA FB control:&lt;br /&gt;
** '''config_fast_sa_fb = 0;''': When set to 0, MCE will be set up for constant SA FB output, with values obtained from the setting &amp;quot;sa_fb&amp;quot;.  When set to 1, MCE will be set up for fast-switching of SA FB output, with values obtained from '''sa_fb_set'''.&lt;br /&gt;
** '''sa_fb_set = [...];''':  A 1d array encoding SA FB values for each row and column.  (As usual the values are arranged as the 41 values for column 0, followed by the 41 values for column 1, etc.)&lt;br /&gt;
* SQ1 BIAS control - these work exactly like SA FB above.&lt;br /&gt;
** '''config_fast_sq1_bias = 1;'''&lt;br /&gt;
** '''sq1_bias_set = [...];'''&lt;br /&gt;
&lt;br /&gt;
For the purposes of array tuning the '''sq1_servo_*''' parameters will be used by the new '''sq1servo_sa''' program, which ramps the SQ1 FB and servos with the fast-switching SA FB (on each row independently).  This may optionally be done for a series of SQ1 bias values.&lt;br /&gt;
&lt;br /&gt;
A new set of servo control parameters, '''rowsel_servo_*''' (taking the same suffixes as the sq1_servo_* variables) has been introduced to control the new '''rs_servo''' program, which ramps the &amp;quot;row select&amp;quot; DACs and servos with the fast-switching SA FB (optionally at a series of SQ1 biases).  In particular these parameters are:&lt;br /&gt;
;; rowsel_servo_gain, rowsel_servo_flux_start, rowsel_servo_flux_count, rowsel_servo_flux_step, rowsel_servo_bias_ramp, rowsel_servo_bias_start, rowsel_servo_bias_count, rowsel_servo_bias_step&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== Using the new servo programs ===&lt;br /&gt;
&lt;br /&gt;
The servo programs make a lot of assumptions about the state of the MCE before beginning their job.  Preparation is usually handled by the tuning code.  To run these programs manually, the biggest thing to be careful of is that you have enabled (or disabled) fast-switching on the relevant stages.  Here's a sequence of terminal commands which should work:&lt;br /&gt;
&lt;br /&gt;
 # Disable fast switching&lt;br /&gt;
 mas_param set config_fast_sa_fb 0&lt;br /&gt;
 mas_param set config_fast_sq1_bias 0&lt;br /&gt;
 # Basic MCE setup and SA tuning&lt;br /&gt;
 auto_setup --last-stage sa_ramp&lt;br /&gt;
 mas_param set config_fast_sa_fb 1&lt;br /&gt;
 # Recreate config script and run it to program the MCE.&lt;br /&gt;
 mce_make_config -x&lt;br /&gt;
 # Run the servos on RC2&lt;br /&gt;
 sq1servo_sa 2 myservo1&lt;br /&gt;
 rs_servo 2 myservo2&lt;br /&gt;
&lt;br /&gt;
Later, once you have set up the &amp;quot;sq1_bias_set&amp;quot; values:&lt;br /&gt;
 mas_param set config_fast_sq1_bias 1&lt;br /&gt;
 mce_make_config -x&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MAS_OS_setup&amp;diff=5798</id>
		<title>MAS OS setup</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MAS_OS_setup&amp;diff=5798"/>
		<updated>2014-07-22T19:37:09Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Supported operating systems */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
= Supported operating systems =&lt;br /&gt;
&lt;br /&gt;
We use Ubuntu.&lt;br /&gt;
&lt;br /&gt;
* Supported versions:&lt;br /&gt;
** 14.04 (new, partial support)&lt;br /&gt;
** 12.04 or 10.04 (both are LTS releases)&lt;br /&gt;
* Formerly supported versions:&lt;br /&gt;
** 9.10, 9.04, 8.10, 8.04, 7.10, 6.06.&lt;br /&gt;
* In general, we're only willing to support LTS releases now.&lt;br /&gt;
&lt;br /&gt;
= Ubuntu 14.04 =&lt;br /&gt;
&lt;br /&gt;
Follow instructions for Ubuntu 12.04, but use install tools package:&lt;br /&gt;
&lt;br /&gt;
 wget http://e-mode.phas.ubc.ca/mce/pc_install/install_tools/mce_install_ubuntu_14.04.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Ubuntu 12.04 =&lt;br /&gt;
&lt;br /&gt;
The automated installation package is tested, but as Ubuntu tweaks its packages the install script may fall slightly out of sync.  It's worth a shot though.&lt;br /&gt;
&lt;br /&gt;
After installing Ubuntu 12.04, get the install tarball:&lt;br /&gt;
&lt;br /&gt;
 cd ~&lt;br /&gt;
 wget http://e-mode.phas.ubc.ca/mce/pc_install/install_tools/ubuntu_12.04_install.tar.gz&lt;br /&gt;
 tar -xzf ubuntu_12.04_install.tar.gz&lt;br /&gt;
 cd install/&lt;br /&gt;
&lt;br /&gt;
== Install additional ubuntu packages ==&lt;br /&gt;
&lt;br /&gt;
From that install folder, run&lt;br /&gt;
 bash install.bash&lt;br /&gt;
&lt;br /&gt;
== Bigphysarea kernel patch ==&lt;br /&gt;
&lt;br /&gt;
You can either download the compiled kernels or build them from scratch.&lt;br /&gt;
&lt;br /&gt;
From install folder, run EITHER&lt;br /&gt;
 bash kernel_download.bash&lt;br /&gt;
or&lt;br /&gt;
 bash kernel_build.bash&lt;br /&gt;
&lt;br /&gt;
Compiled kernels currently exist for the x64 architecture.&lt;br /&gt;
&lt;br /&gt;
Then when one or the other of those has succeeded, install them:&lt;br /&gt;
 bash kernel_install.bash&lt;br /&gt;
&lt;br /&gt;
You can now proceed to the section below titled &amp;quot;[[#Configure_the_system_for_MCE_users|Configure the system for MCE users]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
= Ubuntu 10.04 =&lt;br /&gt;
&lt;br /&gt;
The automated installation package is tested, but as Ubuntu tweaks its packages the install script may fall slightly out of sync.  It's worth a shot though.&lt;br /&gt;
&lt;br /&gt;
After installing Ubuntu 10.04 (desktop), get the install tarball:&lt;br /&gt;
&lt;br /&gt;
 cd ~&lt;br /&gt;
 wget http://e-mode.phas.ubc.ca/mce/pc_install/install_tools/ubuntu_10.04_install.tar.gz&lt;br /&gt;
 tar -xzf ubuntu_10.04_install.tar.gz&lt;br /&gt;
 cd install/&lt;br /&gt;
&lt;br /&gt;
== Install additional ubuntu packages ==&lt;br /&gt;
&lt;br /&gt;
From that install folder, run&lt;br /&gt;
 bash install.bash&lt;br /&gt;
&lt;br /&gt;
(Under 10.04, the vanilla kernel 2.6.38.8 is also supported.  To use it, copy ./alternatives/sources.2.6.38.8.bash to ./sources.bash before running install.bash and kernel_build.bash .)&lt;br /&gt;
&lt;br /&gt;
== Bigphysarea kernel patch ==&lt;br /&gt;
&lt;br /&gt;
You can either download the compiled kernels or build them from scratch.&lt;br /&gt;
&lt;br /&gt;
From install folder, run EITHER&lt;br /&gt;
 bash kernel_download.bash&lt;br /&gt;
or&lt;br /&gt;
 bash kernel_build.bash&lt;br /&gt;
&lt;br /&gt;
Then when one or the other of those has succeeded, install them:&lt;br /&gt;
 bash kernel_install.bash&lt;br /&gt;
&lt;br /&gt;
You can now proceed to the section below titled &amp;quot;[[#Configure_the_system_for_MCE_users|Configure the system for MCE users]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
= Ubuntu 9.10 and earlier =&lt;br /&gt;
&lt;br /&gt;
See [[MAS OS setup on obsolete systems]]&lt;br /&gt;
&lt;br /&gt;
= Configure the system for MCE users = &lt;br /&gt;
&lt;br /&gt;
== Setup environment for MCE user ==&lt;br /&gt;
&lt;br /&gt;
We tend to assume that a single user and group will have dominion over the MCE software, scripts, and data.  We often assume that this user will be called &amp;quot;mce&amp;quot;.  But it doesn't need to be.  Even if multiple users are running things through their own accounts it is likely useful to have a single group that can be used to manage access to the data.&lt;br /&gt;
&lt;br /&gt;
Anyway, to set up a reasonable MCE user, see [[MAS user setup]].&lt;br /&gt;
&lt;br /&gt;
All users using the MCE will need to define some environment variables to use the scripts.  See the above link for lines to add to your '''.bashrc'''.&lt;br /&gt;
&lt;br /&gt;
== System umask ==&lt;br /&gt;
&lt;br /&gt;
You may want to set the system umask to make for a system where it's easier to share &lt;br /&gt;
Set the umask for all users to give write access for their group by default.&lt;br /&gt;
&lt;br /&gt;
Edit /etc/profile and change the &amp;quot;umask 022&amp;quot; line to&lt;br /&gt;
 umask 002&lt;br /&gt;
&lt;br /&gt;
Edit /etc/login.defs and find the line that start &amp;quot;# UMASK&amp;quot; and change it to&lt;br /&gt;
 UMASK           002&lt;br /&gt;
&lt;br /&gt;
== Folders ==&lt;br /&gt;
&lt;br /&gt;
mce_script assumes that /data/cryo/ exists and can be manipulated.  To create something reasonable:&lt;br /&gt;
&lt;br /&gt;
 MCE_USER=mce&lt;br /&gt;
 MCE_GROUP=mce&lt;br /&gt;
 sudo mkdir /data&lt;br /&gt;
 sudo chown $MCE_USER:$MCE_GROUP /data&lt;br /&gt;
 sudo chmod g+ws /data&lt;br /&gt;
 mkdir /data/cryo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Download (checkout) MAS and mce_script =&lt;br /&gt;
&lt;br /&gt;
See [[MAS svn repository]].&lt;br /&gt;
&lt;br /&gt;
= Compile and install MAS =&lt;br /&gt;
&lt;br /&gt;
The following procedure outlines the default situation, where MAS is being installed on a computer containing only one fibre card.  For information on running MAS with multiple fibre cards in one computer, see [[Multicard MAS]].&lt;br /&gt;
&lt;br /&gt;
== Makefile.svn ==&lt;br /&gt;
&lt;br /&gt;
MAS uses autoconf for some basic configuration stuff.  After checking out MAS from the SVN repository the ''first'' time, you need to bootstrap the autoconf process.  To simplify this, the Makefile.svn file will automate the process.  From the MAS source folder run&lt;br /&gt;
&lt;br /&gt;
  make -f Makefile.svn&lt;br /&gt;
&lt;br /&gt;
If successful, this will create the &amp;quot;./configure&amp;quot; script.  This step is only required on fresh check-outs of the repository.  If you already have a ./configure script, even if it's out of date, you can skip this step.  (After having been bootstrapped the&lt;br /&gt;
first time, the build system is smart enough to know when it needs to regenerate itself.)&lt;br /&gt;
&lt;br /&gt;
Note: this procedure requires autoconf.  If it's not installed, install it with:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install autoconf&lt;br /&gt;
&lt;br /&gt;
== ./configure ==&lt;br /&gt;
&lt;br /&gt;
Once the configure script exists, run it to generate the build system (ie. the Makefiles).  The biggest thing you usually need to tell it is what the basic username and group should be for mce data.  Also, there are a few options for the driver and some stupid python stuff.&lt;br /&gt;
&lt;br /&gt;
From the MAS source folder, run&lt;br /&gt;
&lt;br /&gt;
 ./configure&lt;br /&gt;
&lt;br /&gt;
Some useful options:&lt;br /&gt;
  --disable-driver        suppress driver compilation/installation&lt;br /&gt;
  --disable-bigphysarea   compile driver without bigphysarea support&lt;br /&gt;
  --disable-config2       suppress mas.cfg and mce.cfg generation/installation&lt;br /&gt;
  --enable-multicard      build a version of MAS which can drive multiple fibre cards.  (See [[Multicard MAS]] for specifics.)&lt;br /&gt;
  --with-user=USER        set default MCE user&lt;br /&gt;
  --with-group=GROUP      set default MCE group&lt;br /&gt;
  --with-kernel-dir=DIR   set kernel build directory (typically automatically determined)&lt;br /&gt;
&lt;br /&gt;
Run&lt;br /&gt;
&lt;br /&gt;
 ./configure --help&lt;br /&gt;
&lt;br /&gt;
for a full list.  When running, configure will complain if it cannot find something, and even suggest what package you need to install.&lt;br /&gt;
&lt;br /&gt;
== mce.cfg ==&lt;br /&gt;
&lt;br /&gt;
After running configure, but before running make, you must specify a template file (mce.cin) which will be used to generate  the hardware configuration file (mce.cfg).  Full details of this procedure are given in the [[mce.cfg]] page, but briefly:&lt;br /&gt;
&lt;br /&gt;
# copy an appropriate template from &amp;lt;code&amp;gt;config2/templates&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;config2/mce.cin&amp;lt;/code&amp;gt;&lt;br /&gt;
# edit the &amp;lt;code&amp;gt;config2/mce.cin&amp;lt;/code&amp;gt; file to describe your MCE.&lt;br /&gt;
&lt;br /&gt;
The configuration file will be installed automatically when &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt; is run below.  This entire step can be skipped if you passed --disable-config2 to configure above, but note that MAS will not function without mce.cfg and mas.cfg installed.&lt;br /&gt;
&lt;br /&gt;
== make ==&lt;br /&gt;
&lt;br /&gt;
This often works.&lt;br /&gt;
&lt;br /&gt;
 make clean; make&lt;br /&gt;
&lt;br /&gt;
=== Troubleshooting ===&lt;br /&gt;
Sometimes after doing an SVN update &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; doesn't work but instead returns the cryptic message:&lt;br /&gt;
&lt;br /&gt;
 *** No rule to make target `defaults/masdefault.m4', needed by `aclocal.m4'.&lt;br /&gt;
&lt;br /&gt;
In this case, it's necessary to force a rebuild of the build system manually by running&lt;br /&gt;
&lt;br /&gt;
 make -f Makefile.svn&lt;br /&gt;
 ./configure&lt;br /&gt;
&lt;br /&gt;
See the [[#Makefile.svn|Makefile.svn section]] above for further details.&lt;br /&gt;
&lt;br /&gt;
== Test the driver ==&lt;br /&gt;
&lt;br /&gt;
It is wise to test that the driver does not kill your machine before installing it to load on boot.  After compiling do:&lt;br /&gt;
&lt;br /&gt;
 cd driver&lt;br /&gt;
 sudo ./reload&lt;br /&gt;
&lt;br /&gt;
This will load the driver, which should then try to talk to the SDSU PCI card if it is installed.  Note that since &amp;quot;reload&amp;quot; first unloads the driver if it is present, and then loads the driver from the current folder, it may report an &amp;quot;ERROR&amp;quot; message if the first step fails, even though the driver is successfully loaded.  The definitive way to check that the driver is loaded is&lt;br /&gt;
  cat [[/proc/mce_dsp]]&lt;br /&gt;
&lt;br /&gt;
If this file does not exist, the driver isn't loaded.  If the cat prints out a bunch of low-level driver information, you're in good shape.&lt;br /&gt;
&lt;br /&gt;
== sudo make install ==&lt;br /&gt;
&lt;br /&gt;
If you're satisfied that the driver works, install the whole thing.  Go back up to the MAS base folder and run&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
This will do the following:&lt;br /&gt;
&lt;br /&gt;
*install the kernel driver, &amp;lt;code&amp;gt;driver/mce_dsp.ko&amp;lt;/code&amp;gt;, into &amp;lt;code&amp;gt;/lib/modules/$(uname -r)/kernel/drivers/misc/&amp;lt;/code&amp;gt;, and re-scan the module dependencies.&lt;br /&gt;
*install the MAS binaries from &amp;lt;code&amp;gt;applications/&amp;lt;/code&amp;gt; and the scripts from &amp;lt;code&amp;gt;script/&amp;lt;/code&amp;gt; into &amp;lt;code&amp;gt;/usr/mce/bin&amp;lt;/code&amp;gt;&lt;br /&gt;
*install the MAS udev ruleset &amp;lt;code&amp;gt;scripts/91-mas.rules&amp;lt;/code&amp;gt; into &amp;lt;code&amp;gt;/etc/udev/rules.d/&amp;lt;/code&amp;gt;.  These udev rules will ensure that the mce_dsp module is loaded and the MAS device nodes are created at boot time.  You can get udev to run these rules immediately, which will result in /dev being populated with the mce devices, by running:&lt;br /&gt;
&lt;br /&gt;
  sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
:or, else, you can make the nodes yourself by running mas_mknodes.&lt;br /&gt;
*install the mas logging daemon script &amp;lt;code&amp;gt;/etc/init.d/mas&amp;lt;/code&amp;gt; init script.  The driver can then be started/restarted as desired through this script:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/mas restart&lt;br /&gt;
&lt;br /&gt;
:The driver will automatically be set to load on boot.  To disable this, remove the symbolic link &amp;quot;/etc/rc2.d/S99mas&amp;quot;.&lt;br /&gt;
*install the hardware configuration file, &amp;lt;code&amp;gt;config2/mce.cfg&amp;lt;/code&amp;gt;, and the MAS configuration file, &amp;lt;code&amp;gt;config2/mas.cfg&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/etc/mce/&amp;lt;/code&amp;gt;, assuming there aren't versions already there.&lt;br /&gt;
&lt;br /&gt;
= Install mce_script =&lt;br /&gt;
&lt;br /&gt;
Users have the option of running the MCE scripts from an svn working copy, or of running the MCE scripts from an &amp;quot;installed&amp;quot; copy.  Talk to your MAS technician about which option is best for you.&lt;br /&gt;
&lt;br /&gt;
== Running from an svn working copy ==&lt;br /&gt;
&lt;br /&gt;
Checkout the tree directly into /usr/mce:&lt;br /&gt;
&lt;br /&gt;
 cd /usr/mce&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/mce_script/trunk mce_script&lt;br /&gt;
&lt;br /&gt;
== Running from an installed copy ==&lt;br /&gt;
&lt;br /&gt;
Checkout the tree into your code folder; then make and install:&lt;br /&gt;
&lt;br /&gt;
 cd code&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/mce_script/trunk mce_script&lt;br /&gt;
 make&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== .bashrc ==&lt;br /&gt;
&lt;br /&gt;
Add a few lines to .bashrc to update your PATH, PYTHONPATH, and to define the MAS_* variables.  The new way, using [[mas_var]], is:&lt;br /&gt;
 eval `/usr/mce/bin/mas_var -e -s`&lt;br /&gt;
&lt;br /&gt;
The old way, which will probably still work for a while:&lt;br /&gt;
 &lt;br /&gt;
 export MAS_ROOT=/usr/mce/mce_script/&lt;br /&gt;
 source $MAS_ROOT/template/mas_env.bash&lt;br /&gt;
 export IDL_PATH=&amp;quot;&amp;lt;IDL_DEFAULT&amp;gt;:$MAS_IDL/mas&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Configuration data ==&lt;br /&gt;
&lt;br /&gt;
Example configuration files (especially [[experiment.cfg]]) are kept in mce_script/template.  MAS, by default, expects user configuration data to be in /usr/mce/config.  Users should copy the template/ files to /usr/mce/config/, and then make configuration adjustments.  From the svn working copy you can use the &amp;quot;export&amp;quot; command: &lt;br /&gt;
&lt;br /&gt;
 mce@ubuntu:~$ sudo mkdir /usr/mce/config&lt;br /&gt;
 mce@ubuntu:~$ sudo chown mce: /usr/mce/config&lt;br /&gt;
 mce@ubuntu:~$ svn export --force ~/code/mce_script/template/ /usr/mce/config&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MAS_OS_setup&amp;diff=5797</id>
		<title>MAS OS setup</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MAS_OS_setup&amp;diff=5797"/>
		<updated>2014-07-22T19:36:48Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Ubuntu 12.04 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
= Supported operating systems =&lt;br /&gt;
&lt;br /&gt;
We use Ubuntu.&lt;br /&gt;
&lt;br /&gt;
* Supported versions:&lt;br /&gt;
** 12.04 or 10.04 (both are LTS releases)&lt;br /&gt;
* Formerly supported versions:&lt;br /&gt;
** 9.10, 9.04, 8.10, 8.04, 7.10, 6.06.&lt;br /&gt;
* In general, we're only willing to support LTS releases now.&lt;br /&gt;
&lt;br /&gt;
= Ubuntu 14.04 =&lt;br /&gt;
&lt;br /&gt;
Follow instructions for Ubuntu 12.04, but use install tools package:&lt;br /&gt;
&lt;br /&gt;
 wget http://e-mode.phas.ubc.ca/mce/pc_install/install_tools/mce_install_ubuntu_14.04.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Ubuntu 12.04 =&lt;br /&gt;
&lt;br /&gt;
The automated installation package is tested, but as Ubuntu tweaks its packages the install script may fall slightly out of sync.  It's worth a shot though.&lt;br /&gt;
&lt;br /&gt;
After installing Ubuntu 12.04, get the install tarball:&lt;br /&gt;
&lt;br /&gt;
 cd ~&lt;br /&gt;
 wget http://e-mode.phas.ubc.ca/mce/pc_install/install_tools/ubuntu_12.04_install.tar.gz&lt;br /&gt;
 tar -xzf ubuntu_12.04_install.tar.gz&lt;br /&gt;
 cd install/&lt;br /&gt;
&lt;br /&gt;
== Install additional ubuntu packages ==&lt;br /&gt;
&lt;br /&gt;
From that install folder, run&lt;br /&gt;
 bash install.bash&lt;br /&gt;
&lt;br /&gt;
== Bigphysarea kernel patch ==&lt;br /&gt;
&lt;br /&gt;
You can either download the compiled kernels or build them from scratch.&lt;br /&gt;
&lt;br /&gt;
From install folder, run EITHER&lt;br /&gt;
 bash kernel_download.bash&lt;br /&gt;
or&lt;br /&gt;
 bash kernel_build.bash&lt;br /&gt;
&lt;br /&gt;
Compiled kernels currently exist for the x64 architecture.&lt;br /&gt;
&lt;br /&gt;
Then when one or the other of those has succeeded, install them:&lt;br /&gt;
 bash kernel_install.bash&lt;br /&gt;
&lt;br /&gt;
You can now proceed to the section below titled &amp;quot;[[#Configure_the_system_for_MCE_users|Configure the system for MCE users]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
= Ubuntu 10.04 =&lt;br /&gt;
&lt;br /&gt;
The automated installation package is tested, but as Ubuntu tweaks its packages the install script may fall slightly out of sync.  It's worth a shot though.&lt;br /&gt;
&lt;br /&gt;
After installing Ubuntu 10.04 (desktop), get the install tarball:&lt;br /&gt;
&lt;br /&gt;
 cd ~&lt;br /&gt;
 wget http://e-mode.phas.ubc.ca/mce/pc_install/install_tools/ubuntu_10.04_install.tar.gz&lt;br /&gt;
 tar -xzf ubuntu_10.04_install.tar.gz&lt;br /&gt;
 cd install/&lt;br /&gt;
&lt;br /&gt;
== Install additional ubuntu packages ==&lt;br /&gt;
&lt;br /&gt;
From that install folder, run&lt;br /&gt;
 bash install.bash&lt;br /&gt;
&lt;br /&gt;
(Under 10.04, the vanilla kernel 2.6.38.8 is also supported.  To use it, copy ./alternatives/sources.2.6.38.8.bash to ./sources.bash before running install.bash and kernel_build.bash .)&lt;br /&gt;
&lt;br /&gt;
== Bigphysarea kernel patch ==&lt;br /&gt;
&lt;br /&gt;
You can either download the compiled kernels or build them from scratch.&lt;br /&gt;
&lt;br /&gt;
From install folder, run EITHER&lt;br /&gt;
 bash kernel_download.bash&lt;br /&gt;
or&lt;br /&gt;
 bash kernel_build.bash&lt;br /&gt;
&lt;br /&gt;
Then when one or the other of those has succeeded, install them:&lt;br /&gt;
 bash kernel_install.bash&lt;br /&gt;
&lt;br /&gt;
You can now proceed to the section below titled &amp;quot;[[#Configure_the_system_for_MCE_users|Configure the system for MCE users]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
= Ubuntu 9.10 and earlier =&lt;br /&gt;
&lt;br /&gt;
See [[MAS OS setup on obsolete systems]]&lt;br /&gt;
&lt;br /&gt;
= Configure the system for MCE users = &lt;br /&gt;
&lt;br /&gt;
== Setup environment for MCE user ==&lt;br /&gt;
&lt;br /&gt;
We tend to assume that a single user and group will have dominion over the MCE software, scripts, and data.  We often assume that this user will be called &amp;quot;mce&amp;quot;.  But it doesn't need to be.  Even if multiple users are running things through their own accounts it is likely useful to have a single group that can be used to manage access to the data.&lt;br /&gt;
&lt;br /&gt;
Anyway, to set up a reasonable MCE user, see [[MAS user setup]].&lt;br /&gt;
&lt;br /&gt;
All users using the MCE will need to define some environment variables to use the scripts.  See the above link for lines to add to your '''.bashrc'''.&lt;br /&gt;
&lt;br /&gt;
== System umask ==&lt;br /&gt;
&lt;br /&gt;
You may want to set the system umask to make for a system where it's easier to share &lt;br /&gt;
Set the umask for all users to give write access for their group by default.&lt;br /&gt;
&lt;br /&gt;
Edit /etc/profile and change the &amp;quot;umask 022&amp;quot; line to&lt;br /&gt;
 umask 002&lt;br /&gt;
&lt;br /&gt;
Edit /etc/login.defs and find the line that start &amp;quot;# UMASK&amp;quot; and change it to&lt;br /&gt;
 UMASK           002&lt;br /&gt;
&lt;br /&gt;
== Folders ==&lt;br /&gt;
&lt;br /&gt;
mce_script assumes that /data/cryo/ exists and can be manipulated.  To create something reasonable:&lt;br /&gt;
&lt;br /&gt;
 MCE_USER=mce&lt;br /&gt;
 MCE_GROUP=mce&lt;br /&gt;
 sudo mkdir /data&lt;br /&gt;
 sudo chown $MCE_USER:$MCE_GROUP /data&lt;br /&gt;
 sudo chmod g+ws /data&lt;br /&gt;
 mkdir /data/cryo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Download (checkout) MAS and mce_script =&lt;br /&gt;
&lt;br /&gt;
See [[MAS svn repository]].&lt;br /&gt;
&lt;br /&gt;
= Compile and install MAS =&lt;br /&gt;
&lt;br /&gt;
The following procedure outlines the default situation, where MAS is being installed on a computer containing only one fibre card.  For information on running MAS with multiple fibre cards in one computer, see [[Multicard MAS]].&lt;br /&gt;
&lt;br /&gt;
== Makefile.svn ==&lt;br /&gt;
&lt;br /&gt;
MAS uses autoconf for some basic configuration stuff.  After checking out MAS from the SVN repository the ''first'' time, you need to bootstrap the autoconf process.  To simplify this, the Makefile.svn file will automate the process.  From the MAS source folder run&lt;br /&gt;
&lt;br /&gt;
  make -f Makefile.svn&lt;br /&gt;
&lt;br /&gt;
If successful, this will create the &amp;quot;./configure&amp;quot; script.  This step is only required on fresh check-outs of the repository.  If you already have a ./configure script, even if it's out of date, you can skip this step.  (After having been bootstrapped the&lt;br /&gt;
first time, the build system is smart enough to know when it needs to regenerate itself.)&lt;br /&gt;
&lt;br /&gt;
Note: this procedure requires autoconf.  If it's not installed, install it with:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install autoconf&lt;br /&gt;
&lt;br /&gt;
== ./configure ==&lt;br /&gt;
&lt;br /&gt;
Once the configure script exists, run it to generate the build system (ie. the Makefiles).  The biggest thing you usually need to tell it is what the basic username and group should be for mce data.  Also, there are a few options for the driver and some stupid python stuff.&lt;br /&gt;
&lt;br /&gt;
From the MAS source folder, run&lt;br /&gt;
&lt;br /&gt;
 ./configure&lt;br /&gt;
&lt;br /&gt;
Some useful options:&lt;br /&gt;
  --disable-driver        suppress driver compilation/installation&lt;br /&gt;
  --disable-bigphysarea   compile driver without bigphysarea support&lt;br /&gt;
  --disable-config2       suppress mas.cfg and mce.cfg generation/installation&lt;br /&gt;
  --enable-multicard      build a version of MAS which can drive multiple fibre cards.  (See [[Multicard MAS]] for specifics.)&lt;br /&gt;
  --with-user=USER        set default MCE user&lt;br /&gt;
  --with-group=GROUP      set default MCE group&lt;br /&gt;
  --with-kernel-dir=DIR   set kernel build directory (typically automatically determined)&lt;br /&gt;
&lt;br /&gt;
Run&lt;br /&gt;
&lt;br /&gt;
 ./configure --help&lt;br /&gt;
&lt;br /&gt;
for a full list.  When running, configure will complain if it cannot find something, and even suggest what package you need to install.&lt;br /&gt;
&lt;br /&gt;
== mce.cfg ==&lt;br /&gt;
&lt;br /&gt;
After running configure, but before running make, you must specify a template file (mce.cin) which will be used to generate  the hardware configuration file (mce.cfg).  Full details of this procedure are given in the [[mce.cfg]] page, but briefly:&lt;br /&gt;
&lt;br /&gt;
# copy an appropriate template from &amp;lt;code&amp;gt;config2/templates&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;config2/mce.cin&amp;lt;/code&amp;gt;&lt;br /&gt;
# edit the &amp;lt;code&amp;gt;config2/mce.cin&amp;lt;/code&amp;gt; file to describe your MCE.&lt;br /&gt;
&lt;br /&gt;
The configuration file will be installed automatically when &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt; is run below.  This entire step can be skipped if you passed --disable-config2 to configure above, but note that MAS will not function without mce.cfg and mas.cfg installed.&lt;br /&gt;
&lt;br /&gt;
== make ==&lt;br /&gt;
&lt;br /&gt;
This often works.&lt;br /&gt;
&lt;br /&gt;
 make clean; make&lt;br /&gt;
&lt;br /&gt;
=== Troubleshooting ===&lt;br /&gt;
Sometimes after doing an SVN update &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; doesn't work but instead returns the cryptic message:&lt;br /&gt;
&lt;br /&gt;
 *** No rule to make target `defaults/masdefault.m4', needed by `aclocal.m4'.&lt;br /&gt;
&lt;br /&gt;
In this case, it's necessary to force a rebuild of the build system manually by running&lt;br /&gt;
&lt;br /&gt;
 make -f Makefile.svn&lt;br /&gt;
 ./configure&lt;br /&gt;
&lt;br /&gt;
See the [[#Makefile.svn|Makefile.svn section]] above for further details.&lt;br /&gt;
&lt;br /&gt;
== Test the driver ==&lt;br /&gt;
&lt;br /&gt;
It is wise to test that the driver does not kill your machine before installing it to load on boot.  After compiling do:&lt;br /&gt;
&lt;br /&gt;
 cd driver&lt;br /&gt;
 sudo ./reload&lt;br /&gt;
&lt;br /&gt;
This will load the driver, which should then try to talk to the SDSU PCI card if it is installed.  Note that since &amp;quot;reload&amp;quot; first unloads the driver if it is present, and then loads the driver from the current folder, it may report an &amp;quot;ERROR&amp;quot; message if the first step fails, even though the driver is successfully loaded.  The definitive way to check that the driver is loaded is&lt;br /&gt;
  cat [[/proc/mce_dsp]]&lt;br /&gt;
&lt;br /&gt;
If this file does not exist, the driver isn't loaded.  If the cat prints out a bunch of low-level driver information, you're in good shape.&lt;br /&gt;
&lt;br /&gt;
== sudo make install ==&lt;br /&gt;
&lt;br /&gt;
If you're satisfied that the driver works, install the whole thing.  Go back up to the MAS base folder and run&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
This will do the following:&lt;br /&gt;
&lt;br /&gt;
*install the kernel driver, &amp;lt;code&amp;gt;driver/mce_dsp.ko&amp;lt;/code&amp;gt;, into &amp;lt;code&amp;gt;/lib/modules/$(uname -r)/kernel/drivers/misc/&amp;lt;/code&amp;gt;, and re-scan the module dependencies.&lt;br /&gt;
*install the MAS binaries from &amp;lt;code&amp;gt;applications/&amp;lt;/code&amp;gt; and the scripts from &amp;lt;code&amp;gt;script/&amp;lt;/code&amp;gt; into &amp;lt;code&amp;gt;/usr/mce/bin&amp;lt;/code&amp;gt;&lt;br /&gt;
*install the MAS udev ruleset &amp;lt;code&amp;gt;scripts/91-mas.rules&amp;lt;/code&amp;gt; into &amp;lt;code&amp;gt;/etc/udev/rules.d/&amp;lt;/code&amp;gt;.  These udev rules will ensure that the mce_dsp module is loaded and the MAS device nodes are created at boot time.  You can get udev to run these rules immediately, which will result in /dev being populated with the mce devices, by running:&lt;br /&gt;
&lt;br /&gt;
  sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
:or, else, you can make the nodes yourself by running mas_mknodes.&lt;br /&gt;
*install the mas logging daemon script &amp;lt;code&amp;gt;/etc/init.d/mas&amp;lt;/code&amp;gt; init script.  The driver can then be started/restarted as desired through this script:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/mas restart&lt;br /&gt;
&lt;br /&gt;
:The driver will automatically be set to load on boot.  To disable this, remove the symbolic link &amp;quot;/etc/rc2.d/S99mas&amp;quot;.&lt;br /&gt;
*install the hardware configuration file, &amp;lt;code&amp;gt;config2/mce.cfg&amp;lt;/code&amp;gt;, and the MAS configuration file, &amp;lt;code&amp;gt;config2/mas.cfg&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/etc/mce/&amp;lt;/code&amp;gt;, assuming there aren't versions already there.&lt;br /&gt;
&lt;br /&gt;
= Install mce_script =&lt;br /&gt;
&lt;br /&gt;
Users have the option of running the MCE scripts from an svn working copy, or of running the MCE scripts from an &amp;quot;installed&amp;quot; copy.  Talk to your MAS technician about which option is best for you.&lt;br /&gt;
&lt;br /&gt;
== Running from an svn working copy ==&lt;br /&gt;
&lt;br /&gt;
Checkout the tree directly into /usr/mce:&lt;br /&gt;
&lt;br /&gt;
 cd /usr/mce&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/mce_script/trunk mce_script&lt;br /&gt;
&lt;br /&gt;
== Running from an installed copy ==&lt;br /&gt;
&lt;br /&gt;
Checkout the tree into your code folder; then make and install:&lt;br /&gt;
&lt;br /&gt;
 cd code&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/mce_script/trunk mce_script&lt;br /&gt;
 make&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== .bashrc ==&lt;br /&gt;
&lt;br /&gt;
Add a few lines to .bashrc to update your PATH, PYTHONPATH, and to define the MAS_* variables.  The new way, using [[mas_var]], is:&lt;br /&gt;
 eval `/usr/mce/bin/mas_var -e -s`&lt;br /&gt;
&lt;br /&gt;
The old way, which will probably still work for a while:&lt;br /&gt;
 &lt;br /&gt;
 export MAS_ROOT=/usr/mce/mce_script/&lt;br /&gt;
 source $MAS_ROOT/template/mas_env.bash&lt;br /&gt;
 export IDL_PATH=&amp;quot;&amp;lt;IDL_DEFAULT&amp;gt;:$MAS_IDL/mas&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Configuration data ==&lt;br /&gt;
&lt;br /&gt;
Example configuration files (especially [[experiment.cfg]]) are kept in mce_script/template.  MAS, by default, expects user configuration data to be in /usr/mce/config.  Users should copy the template/ files to /usr/mce/config/, and then make configuration adjustments.  From the svn working copy you can use the &amp;quot;export&amp;quot; command: &lt;br /&gt;
&lt;br /&gt;
 mce@ubuntu:~$ sudo mkdir /usr/mce/config&lt;br /&gt;
 mce@ubuntu:~$ sudo chown mce: /usr/mce/config&lt;br /&gt;
 mce@ubuntu:~$ svn export --force ~/code/mce_script/template/ /usr/mce/config&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Digital_4-pole_Butterworth_Low-pass_filter&amp;diff=5796</id>
		<title>Digital 4-pole Butterworth Low-pass filter</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Digital_4-pole_Butterworth_Low-pass_filter&amp;diff=5796"/>
		<updated>2014-07-16T14:52:46Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Code for simulations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
A digital 4-pole Butterworth low-pass filter is implemented as 2 cascaded biquads (2-pole topology) in the '''Read-out card firmware''' of the MCE. The transfer function of the IIR filter is:&lt;br /&gt;
&amp;lt;math&amp;gt; H(z) = \frac {1+2 z^{-1}+z^{-2}}{1+b_{11} z^{-1}+b_{12} z^{-2}} . 2^{-k_2} . \frac {1+2z^{-1}+z^{-2}}{1+b_{21} z^{-1}+b_{22} z^{-2}} . {2^{-k_1}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Filter coefficients b&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt;, b&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;, b&amp;lt;sub&amp;gt;21&amp;lt;/sub&amp;gt; b&amp;lt;sub&amp;gt;22&amp;lt;/sub&amp;gt;, and truncation factors, k&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and k&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, are hard coded in older firmware and just recently ('''version 5.1.0+''') they can be programmed through software.&lt;br /&gt;
&lt;br /&gt;
  wb rca fltr_coeff b&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt; b&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt; b&amp;lt;sub&amp;gt;21&amp;lt;/sub&amp;gt; b&amp;lt;sub&amp;gt;22&amp;lt;/sub&amp;gt; k&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; k&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in order to accomodate the quantization effects, you have to follow the recipe prescribed [[Digital 4-pole Butterworth Low-pass filter#Filter Coefficients | here]] when specifying the coefficients and truncation factors.&lt;br /&gt;
&lt;br /&gt;
There are 3 filter-related MCE parameters/commands:&lt;br /&gt;
* fltr_type: to determine whether filter coefficients are hard-coded or configurable&lt;br /&gt;
* fltr_coeff: to specify filter coefficients&lt;br /&gt;
* fltr_rst: to reset the filter pipeline after changing coefficients&lt;br /&gt;
&lt;br /&gt;
== Filter Specification ==&lt;br /&gt;
Filter specification of the 4-pole Butterworth filter is determined by the filter coefficients b&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt;, b&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;, b&amp;lt;sub&amp;gt;21&amp;lt;/sub&amp;gt;, b&amp;lt;sub&amp;gt;22&amp;lt;/sub&amp;gt;, described earlier.&lt;br /&gt;
&lt;br /&gt;
Assume: &lt;br /&gt;
&lt;br /&gt;
* '''f&amp;lt;sub&amp;gt;cutoff&amp;lt;/sub&amp;gt;''' is the frequency at which the signal after filtering is &amp;lt;math&amp;gt;\sqrt2&amp;lt;/math&amp;gt; of its maximum value (nominally the read-out rate Nyquist frequency), and   &lt;br /&gt;
* '''f&amp;lt;sub&amp;gt;samp&amp;lt;/sub&amp;gt;''' is the sampling frequency, calculated as &amp;lt;math&amp;gt;\frac{50\;\mathrm{MHz}}{\mathrm{num\_rows} \times \mathrm{row\_len}}&amp;lt;/math&amp;gt;. For example 50MHz / (33 * 100) = 15151.5Hz.&lt;br /&gt;
&lt;br /&gt;
''Note that the filter f&amp;lt;sub&amp;gt;3dB&amp;lt;/sub&amp;gt; scales if f&amp;lt;sub&amp;gt;samp&amp;lt;/sub&amp;gt; changes.''&lt;br /&gt;
&lt;br /&gt;
; Type 1 (hard-coded coefficients)&lt;br /&gt;
: (supported in all rc _except_ 5.0.7)&lt;br /&gt;
: DC amplification = 1217.9148 &lt;br /&gt;
: f&amp;lt;sub&amp;gt;cutoff&amp;lt;/sub&amp;gt; / f&amp;lt;sub&amp;gt;samp&amp;lt;/sub&amp;gt; = 122.226Hz / 15151Hz &lt;br /&gt;
: Gain @ 200Hz=0.14189148 (wrt the DC gain) &lt;br /&gt;
&lt;br /&gt;
; Type 2 (hard-coded coefficients)&lt;br /&gt;
: (supported only in rc version 5.0.7)&lt;br /&gt;
: DC amplification = 2044&lt;br /&gt;
: f&amp;lt;sub&amp;gt;cutoff&amp;lt;/sub&amp;gt; / f&amp;lt;sub&amp;gt;samp&amp;lt;/sub&amp;gt; = 75Hz / 30000Hz&lt;br /&gt;
: A plot of the transfer function generated by simulating MCE firmware (VHDL) &lt;br /&gt;
[[File:mce_filter_type2_magnitude.png |150px]][[File:mce_filter_type2_phase.png|150px]]&lt;br /&gt;
&lt;br /&gt;
; Type 255 (configurable coefficients)&lt;br /&gt;
: ''supported in rc 5.1.0+''  Filter coefficients b&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt;, b&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;, b&amp;lt;sub&amp;gt;21&amp;lt;/sub&amp;gt;, b&amp;lt;sub&amp;gt;22&amp;lt;/sub&amp;gt; and truncation factors, k&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, k&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; are parametrized and programmable by software. &lt;br /&gt;
&lt;br /&gt;
The fitler type can be determined by reading back the MCE parameter called ''fltr_type'' (rb rc1 fltr_type). (supported in firmware 5.0.a+)&lt;br /&gt;
&lt;br /&gt;
The following plot shows the magnitude and the phase of Type 1 filter.&lt;br /&gt;
&lt;br /&gt;
Here is Elia's original plot [[Media:BW_filter.ps]]. Then we see the same plot with the impulse-response also added (by Joe, Nov 29, 2007):&lt;br /&gt;
[[Image: BW_filter2.png]]&lt;br /&gt;
&lt;br /&gt;
Here is the filter response for Scuba2 setting (f&amp;lt;sub&amp;gt;samp&amp;lt;/sub&amp;gt;=9.5kHz, f&amp;lt;sub&amp;gt;readout&amp;lt;/sub&amp;gt;=200Hz): [[Media: Filter fs10kHz 200Hzdecimated response.ps ]]&lt;br /&gt;
&lt;br /&gt;
== Filter-related Software changes ==&lt;br /&gt;
&lt;br /&gt;
=== Determining the filter type ===&lt;br /&gt;
&lt;br /&gt;
A ''fltr_type'' parameter is introduced starting firmware 5.0.a.&lt;br /&gt;
* fltr_type = 1 fcutoff / fsamp = 122.226Hz / 15151Hz&lt;br /&gt;
* fltr_type = 2 fcutoff / fsamp = 75Hz / 30000Hz&lt;br /&gt;
* fltr_type = 255 configurable coefficient&lt;br /&gt;
&lt;br /&gt;
All earlier firmware revisions are set to filter type 1 by default, except version 5.0.7 which is set to filter type 2.&lt;br /&gt;
&lt;br /&gt;
=== Software requirements ===&lt;br /&gt;
&lt;br /&gt;
* MAS - use mas/trunk r493 or later to get access to the fltr_coeff MCE parameter.&lt;br /&gt;
** In [[mce.cfg]], specify $fw_rev[&amp;quot;rc&amp;quot;] = $5010000 or greater.&lt;br /&gt;
* mce_script - use mce_script/trunk r764 or later&lt;br /&gt;
* In [[Mce config template system#experiment.cfg | experiment.cfg]]:&lt;br /&gt;
**specify one of:&lt;br /&gt;
  config_filter = 0;  #  do not write filter coefficients to the MCE&lt;br /&gt;
  config_filter = 1;  #  write filter coefficients to the MCE&lt;br /&gt;
and when config_filter = 1, the filter coefficients to be written to the MCE must be specified in the &amp;quot;filter_params&amp;quot; parameter, in the order [b&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt; b&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt; b&amp;lt;sub&amp;gt;21&amp;lt;/sub&amp;gt; b&amp;lt;sub&amp;gt;22&amp;lt;/sub&amp;gt; k&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; k&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;].  E.g.: &lt;br /&gt;
  filter_params = [ 32092, 15750, 31238, 14895, 0, 11];  # type 1 filter, fc/fs= 122.226Hz / 15.151kHz&lt;br /&gt;
  filter_params = [ 32295, 15915, 32568, 16188, 3, 14];  # type 2 filter, fc/fs= 75Hz / 30kHz&lt;br /&gt;
  filter_params = [ 32295, 15915, 32568, 16188, 5, 12];  # type 2 filter with more inter-biquad dynamic range (recommended)&lt;br /&gt;
  filter_params = [ 32297, 15934, 31683, 15320, 0, 11];  # SCUBA-2 filter after 2011-06, fc/fs = 75Hz / 12.97kHz&lt;br /&gt;
&lt;br /&gt;
== Code for simulations ==&lt;br /&gt;
&lt;br /&gt;
Note that as of mce_script r902, '''mce_data.py''' contains code for handling the MCE Butterworth filters.  This can be used to load filter parameters from a runfile, and to get the complex frequency response of a filter.  See [[mce_data.py#MCEButterworth_class]].&lt;br /&gt;
&lt;br /&gt;
A smaller, quicker python example:&lt;br /&gt;
[[ Media: mce_filt_py.txt ]]&lt;br /&gt;
&lt;br /&gt;
In this little IDL program you can find the functional form as a function of the frequency of the filter. First, Elia's original program, then as modified by Joe on November 29, 2007, then modified by Mandana on Jan. 14, 2009 for Scuba2 numbers:&lt;br /&gt;
* [[ Media: filter_pro.txt ]] &lt;br /&gt;
* [[ Media: filter_pro2.txt ]]&lt;br /&gt;
* [[ Media: low_pass_filter_model_pro.txt ]]&lt;br /&gt;
&lt;br /&gt;
=== Digital, time domain simulation codes ===&lt;br /&gt;
&lt;br /&gt;
Python-based model of a single biquad, in the time domain, for exploring digitization and dynamic range:&lt;br /&gt;
* [[ Media: biquad_time_domain_py.txt ]]&lt;br /&gt;
&lt;br /&gt;
== Filter Coefficients  ==&lt;br /&gt;
=== Butterworth Coefficients ===&lt;br /&gt;
The filter coefficients are generated using ''fdatool'' (filter-design &amp;amp; Analysis tool, part of DSP Toolbox) in '''Matlab/Simulink'''. These coefficients are floating numbers and in order to feed them to MCE firmware, they need to be quantized by converting to signed binary fractional (SBF) 1.14 format. You may use alternate methods&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; to generate coefficients. Here, we explain the method using ''fdatool''.&lt;br /&gt;
&lt;br /&gt;
Once you launch the ''fdatool'', choose the following settings:&lt;br /&gt;
&lt;br /&gt;
* Response Type: Low Pass&lt;br /&gt;
* Design Method: Butterworth&lt;br /&gt;
* Filter Order: 4&lt;br /&gt;
&lt;br /&gt;
* Frequency Specifications: &lt;br /&gt;
** For Type 1: F&amp;lt;sub&amp;gt;samp&amp;lt;/sub&amp;gt; = 12195 = (50000/100*41), F&amp;lt;sub&amp;gt;cutoff&amp;lt;/sub&amp;gt;=100&lt;br /&gt;
** For Type 2: F&amp;lt;sub&amp;gt;samp&amp;lt;/sub&amp;gt; = 30000 ~= (50000/50*33), F&amp;lt;sub&amp;gt;cutoff&amp;lt;/sub&amp;gt;=75&lt;br /&gt;
** For Type 255: F&amp;lt;sub&amp;gt;ssamp&amp;lt;/sub&amp;gt; = You specify (50000/row_len*num_rows), F&amp;lt;sub&amp;gt;cutoff&amp;lt;/sub&amp;gt;=You specify (&amp;lt;F&amp;lt;sub&amp;gt;readout&amp;lt;/sub&amp;gt; / 2)&lt;br /&gt;
** (The attenuation at F&amp;lt;sub&amp;gt;cutoff&amp;lt;/sub&amp;gt; is fixed at 3dB (half the passband power))&lt;br /&gt;
&lt;br /&gt;
Then click on Design Filter and you will get the following coefficients:&lt;br /&gt;
; Type 1 &lt;br /&gt;
:Section 1:&lt;br /&gt;
::Numerator: 1  2  1  &lt;br /&gt;
::Denominator: 1  -1.9587428340882587  0.96134553442399129 &lt;br /&gt;
::Gain = 1/g&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; = 0.00065067508393319923 (not implemented)&lt;br /&gt;
:Section 2:&lt;br /&gt;
::Numerator: 1  2  1  &lt;br /&gt;
::Denominator: 1  -1.9066292518523014  0.90916270571237567&lt;br /&gt;
::Gain = 1/g&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;= 0.00063336346501859835  (not implemented)&lt;br /&gt;
&lt;br /&gt;
; Type 2 &lt;br /&gt;
:Section 1:&lt;br /&gt;
::Numerator: 1  2  1  &lt;br /&gt;
::Denominator: 1  -1.9711486088510415  0.97139181456687917&lt;br /&gt;
:Section 2:&lt;br /&gt;
::Numerator: 1  2  1  &lt;br /&gt;
::Denominator: 1  -1.9878047097960421  0.98804997058724808 &lt;br /&gt;
:Gain = 1/(g&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; * g&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)= 0.0000000037280516432624239  (not implemented)&lt;br /&gt;
&lt;br /&gt;
; Type 255&lt;br /&gt;
: Plug in your desired f&amp;lt;sub&amp;gt;s&amp;lt;/sub&amp;gt; and f&amp;lt;sub&amp;gt;c&amp;lt;/sub&amp;gt; in Matlab fdatool and you will get a set of coefficients:&lt;br /&gt;
:Section 1:&lt;br /&gt;
::Numerator: 1  2  1  &lt;br /&gt;
::Denominator: 1  B11  B12&lt;br /&gt;
:: Gain = 1/g&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
:Section 2:&lt;br /&gt;
::Numerator: 1  2  1  &lt;br /&gt;
::Denominator: 1  B21  B22&lt;br /&gt;
::Gain = 1/g&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Coefficient Quantization ===&lt;br /&gt;
The quantization format is signed-binary fractional (SBF) 1.14 and then 2's complement to be able to account for positive and negative values.&lt;br /&gt;
* Multiply each of the Bxx coefficients by 2&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt; and then if negative multiply by -1.&lt;br /&gt;
* k2 = 1 + floor ( log&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; (g&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;) )      the inter-stage truncation&lt;br /&gt;
* k1 = floor ( log&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; (g&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;) ) - 10      the output-truncation &lt;br /&gt;
&lt;br /&gt;
(10 is a historical constant !!!)&lt;br /&gt;
&lt;br /&gt;
For example, if we use this formula to quantize Type 1 coefficients listed above:&lt;br /&gt;
&amp;lt;br&amp;gt;b11 = 32092 &lt;br /&gt;
&amp;lt;br&amp;gt;b12 = 15750 &lt;br /&gt;
&amp;lt;br&amp;gt;b21 = 31238 &lt;br /&gt;
&amp;lt;br&amp;gt;b22 = 14895 &lt;br /&gt;
&amp;lt;br&amp;gt;k1 = 0&lt;br /&gt;
&amp;lt;br&amp;gt;k2 = 11 &lt;br /&gt;
&lt;br /&gt;
* k1&amp;lt;16 and k2&amp;lt;32&lt;br /&gt;
* Now if 32-k1+k2 &amp;gt;32 then you have to talk to UBC!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''The following ONLY concerns the MCE firmware developers:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Prior to firmware 5.1.0, the coefficients were hardcoded in  '''fsfb_calc_pack.vhd''' (FILTER_B11_COEF, FILTER_B12_COEF, FILTER_B21_COEFF, FILTER_B22_COEFF, FILTER_GAIN_WIDTH, FILTER_SCALE_LSB).&lt;br /&gt;
&lt;br /&gt;
=== Calculating the DC Gain (k) ===&lt;br /&gt;
Note that in firmware, instead of g&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and g&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, an inter-biquad truncation of k&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; (implemented as a binary shift) and k&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, number of bits dropped after the second biquad, are implemented.&lt;br /&gt;
&lt;br /&gt;
Hence, the overall gain becomes &amp;lt;math&amp;gt;\frac {g_1 g_2}  {2^{(k_1 + k_2)}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(Note for firmware developers: see FILTER_GAIN_WIDTH and FILTER_SCALE_LSB in '''fsfb_calc_pack.vhd'''.) &lt;br /&gt;
&lt;br /&gt;
; Type 1&lt;br /&gt;
:k2=11, k1=0, the filter gain is estimated at 1184, but vhdl simulation results in a gain of 1216. &lt;br /&gt;
; Type 2&lt;br /&gt;
:k2=14, k1=3, the filter gain is estimated at 2046, but vhdl simulation results in a gain of 2181. &lt;br /&gt;
&lt;br /&gt;
The gain difference can be attributed to the rounding effects associated with fixed-width arithmetic.&lt;br /&gt;
&lt;br /&gt;
To roughly compute the gain, including the effects from truncating the coefficients, reverse the quantization process to obtain the floating point values associated with your coefficients, and plug into the filter definition.  Here is a rough python program which computes the true gain for our Type 1 filter:&lt;br /&gt;
 from numpy import *&lt;br /&gt;
 # Sum of k1 and k2 shifts:&lt;br /&gt;
 k12 = 11+0&lt;br /&gt;
 # Quantized coefficients b11, b12, b21, b22:&lt;br /&gt;
 n = array([32092, 15750, 31238, 14895]).astype('float')&lt;br /&gt;
 # Re-float&lt;br /&gt;
 f = n/2**14&lt;br /&gt;
 # Compute gain&lt;br /&gt;
 gain = 16. / (2**k12 * (1 - f[0] + f[1]) * (1 - f[2] + f[3]))&lt;br /&gt;
 # Answer: 1217.8583043&lt;br /&gt;
 print gain&lt;br /&gt;
&lt;br /&gt;
== Useful Links  ==&lt;br /&gt;
http://www.phas.ubc.ca/~mce/mcedocs/hardware/Firmware_block_spec/reaout_card/fsfb_calculations.pdf&lt;br /&gt;
&lt;br /&gt;
http://www.planetanalog.com/showArticle.jhtml?articleID=12802683&lt;br /&gt;
&lt;br /&gt;
== Alternative to fdatool ==&lt;br /&gt;
If you do not have access to fdatool or do not have DSP toolbox installed, you can use the following Matlab functions (or equivalent in other packages) to get the coefficients:&lt;br /&gt;
* butter: is a matlab function to generate butterworth coefficients&lt;br /&gt;
* sos2tf: matlab function to break a transfer function to second-order sections&lt;br /&gt;
* bilinear: converts an s-domain (continuous) transfer function to z-domain (discrete) transfer function.&lt;br /&gt;
* Then run the following in matlab (or whatever syntax your tool has):&lt;br /&gt;
   num=[1 2 1]&lt;br /&gt;
   denum=[1 -1.9711486088510415  0.97139181456687917]&lt;br /&gt;
   max(dbode(num, denum, 1/fs) but also look at the bode-plot to make sure it is flat, otherwise read the max from the flat portion of the plot instead of the max function.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' When I used coefficients generated by [a,b] = butter(2, 50/20000); [SOS,G]=tf2sos(a,b), the filter was not as robust. not sure why?!&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=File:Biquad_time_domain_py.txt&amp;diff=5795</id>
		<title>File:Biquad time domain py.txt</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=File:Biquad_time_domain_py.txt&amp;diff=5795"/>
		<updated>2014-07-16T14:52:40Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=PCI_card_firmware&amp;diff=5740</id>
		<title>PCI card firmware</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=PCI_card_firmware&amp;diff=5740"/>
		<updated>2014-05-28T20:46:25Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Download */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
UBC-produced firmware for the ARC-64 [[PCI card]].  [[MAS]] provides a linux kernel driver for this firmware.&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
These S-record files should work with any reasonable EEPROM programmer:&lt;br /&gt;
* U0107 (new!) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0107_candidate_2014-05-01.s&lt;br /&gt;
* U0106 (recommended) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0106.s&lt;br /&gt;
** 8-bit checksum 6FCDCE&lt;br /&gt;
** Scrubber file - try writing all ones to your  this to your chip first if your programmer won't let you &amp;quot;erase&amp;quot; it:&lt;br /&gt;
** http://e-mode.phas.ubc.ca/mce/firmware/sdsu/scrubber_RevU0106.s&lt;br /&gt;
* U0105 (deprecated) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0105.s&lt;br /&gt;
* U0104 (deprecated) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0104.s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The full source code is available in these archives (it will not compile unless you get the correct assembler and stuff):&lt;br /&gt;
* U0106 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0106.tar.gz&lt;br /&gt;
* U0105 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0105.tar.gz&lt;br /&gt;
* U0104 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0104.tar.gz&lt;br /&gt;
&lt;br /&gt;
The subversion tree can be obtained like this (you may not have access to this repository; contact UBC);&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/arc_pci&lt;br /&gt;
&lt;br /&gt;
It is laid out roughly as follows:&lt;br /&gt;
 /trunk       main line of development&lt;br /&gt;
 /releases    tagged versions of code &lt;br /&gt;
 /tools       debugging tools&lt;br /&gt;
 /clash       stuff for making CLAS work with wine and linux&lt;br /&gt;
 /docs        useful (though maybe not to you) notes&lt;br /&gt;
&lt;br /&gt;
== Firmware version notes ==&lt;br /&gt;
&lt;br /&gt;
=== U0107 (pending): alpha ===&lt;br /&gt;
&lt;br /&gt;
* This firmware can operate in either of two modes:&lt;br /&gt;
** '''U0106 compatibility mode''': the firmware will work with classic MAS driver, just like U0106 (plus some bugfixes).&lt;br /&gt;
** '''New Master-only mode''': when activated, uses new set of protocols for communication with the MAS driver.  These have proven to be much more stable on some systems.  Also, bigphysarea is no longer needed.&lt;br /&gt;
* This firmware/driver are in limited release; do not attempt to use them without consulting with UBC.&lt;br /&gt;
* Downloads:&lt;br /&gt;
** S-rec for release candidates here: http://e-mode.phas.ubc.ca/mce/firmware/sdsu/&lt;br /&gt;
** Soft-patches for upgrading U0106 to pseudo-U0107 temporarily: http://e-mode.phas.ubc.ca/mce/firmware/sdsu/patches/&lt;br /&gt;
&lt;br /&gt;
=== U0106 (2011-11-21): Recommended version ===&lt;br /&gt;
&lt;br /&gt;
* Backward compatible with U0104 and U0105.&lt;br /&gt;
* Fixes bug introduced in U0105 that prevented handling of some PCI bus errors.&lt;br /&gt;
* Introduction of command to update PCI burst size.&lt;br /&gt;
* Bugs:&lt;br /&gt;
** Versions U0104-6 all suffer from the following issues:&lt;br /&gt;
*** Host interrupts use bit-test instructions, which are not interrupt safe; consequence is a race condition that can upset ongoing tasks such as FO downloads and PCI bursts.  Patch for this issue, applicable to firmware versions U0104-6:&lt;br /&gt;
**** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
*** Multiple simultaneous PCI bus errors are not handled properly, leading to stale bits in the error register.  This is an unlikely error vector, but should be fixed.&lt;br /&gt;
&lt;br /&gt;
=== U0105 (2009-06-08) ===&lt;br /&gt;
&lt;br /&gt;
* Backward compatible with U0104.&lt;br /&gt;
* Support for MCE STOP commands and commands-on-the-fly.&lt;br /&gt;
* Accelerated MCE command code (along with Quiet-RP this increases commanding rate to ~6 kHz).&lt;br /&gt;
* Quiet-RP simplifies the protocol for MCE reply handling.&lt;br /&gt;
* Low-level improvements:&lt;br /&gt;
** CON is done as PCI burst&lt;br /&gt;
** Fibre-optic FIFO is emptied with timed read instead of polling.&lt;br /&gt;
** Hand-shaking for interrupts instead of host command to clear INTA and HC3.&lt;br /&gt;
** Non-interrupt context code disables interrupts when performing PCI transactions.&lt;br /&gt;
** Host vector interrupts are otherwise enabled, so PC doesn't have to force with HNMI bit.&lt;br /&gt;
* Bugs and fixes:&lt;br /&gt;
** Some PCI bus arbitration conditions are mis-handled.  This is fixed in U0106; alternately the commands below can be issued to patch active U0105 firmware.  (The patch will not survive a power cycle.):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0105_unignore_pci_errors.bash&lt;br /&gt;
** Also this (see description in U0106):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
&lt;br /&gt;
=== U0104: First version with non-realtime linux support ===&lt;br /&gt;
&lt;br /&gt;
* Implements quiet transfer mode!  Remains backwards compatible with A1.4.&lt;br /&gt;
* Fixes the 64k boundary crossing issue&lt;br /&gt;
* Moves parameters that enter via interrupt out of registers and into variables&lt;br /&gt;
* Version reporting tag-along to RDM command (sending 'VER' to RDM's vector address returns the code version).&lt;br /&gt;
* Maximum burst length is reduced to 64 bytes, and is configurable.&lt;br /&gt;
* Reset (RST) clears the fibre fifo&lt;br /&gt;
* Bugs:&lt;br /&gt;
** This (see description in U0106):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
&lt;br /&gt;
== U0103: Oldest UBC release ==&lt;br /&gt;
&lt;br /&gt;
* Minor modifications of SCUBA2's A1.4 firmware, to improve PCI stability.&lt;br /&gt;
* Not compatible with non-realtime systems.&lt;br /&gt;
&lt;br /&gt;
== Programming the ARC64 Flash memory ==&lt;br /&gt;
&lt;br /&gt;
To program or upgrade the PCI card's firmware, it is necessary to remove the flash memory chip from the card and program it using a standard EEPROM programmer.&lt;br /&gt;
&lt;br /&gt;
# Obviously you should turn off your computer and stuff first.&lt;br /&gt;
# The chip is a large DIP located at U5 on the PCI board.  To remove the chip you may use one of the following (in increasing order of risk, and decreasing order of barbarism):&lt;br /&gt;
## telekinesis&lt;br /&gt;
## a chip removal tool&lt;br /&gt;
## needle-nose pliers&lt;br /&gt;
## a screw-driver&lt;br /&gt;
## thumb and finger&lt;br /&gt;
## fingers only&lt;br /&gt;
# The chip is a standard 256 Kbit electrically erasable Flash ROM.  If you can't find the particular part in your EEPROM programmer software, try using one of these compatible parts:&lt;br /&gt;
## Fujitsu MBM28C256&lt;br /&gt;
## CSI (Catalyst) CAT28C256 L&lt;br /&gt;
## Anything else that has 28C256 in its name as long as it is a 28-pin DIP package and you are using the right socket for your programmer.&lt;br /&gt;
# Some programmers won't recognize this chip as erasable.  You can just try programming the chip with the new firmware, or pseudo-erasing it first using a &amp;quot;scrubber&amp;quot; file (available for U0106 in the links above).&lt;br /&gt;
# The firmware we provide is compiled into a [ http://en.wikipedia.org/wiki/SREC_%28file_format%29 Motorola S-record format ] hex file.  This is a standard format that your programmer software should be able to cope with.&lt;br /&gt;
# When placing the chip back in the board, the notch on the chip should be at the same end as the notch on the socket.&lt;br /&gt;
&lt;br /&gt;
== Other information ==&lt;br /&gt;
&lt;br /&gt;
* [[ PCI card bug list ]]&lt;br /&gt;
* [[ PCI card hacking ]]&lt;br /&gt;
* [[ PCI card code assembly on Linux ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Firmware]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=PCI_card_firmware&amp;diff=5724</id>
		<title>PCI card firmware</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=PCI_card_firmware&amp;diff=5724"/>
		<updated>2014-04-26T20:16:46Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* U0107 (pending): alpha */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
UBC-produced firmware for the ARC-64 [[PCI card]].  [[MAS]] provides a linux kernel driver for this firmware.&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
These S-record files should work with any reasonable EEPROM programmer:&lt;br /&gt;
* U0106 (recommended) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0106.s&lt;br /&gt;
** 8-bit checksum 6FCDCE&lt;br /&gt;
** Scrubber file - try writing all ones to your  this to your chip first if your programmer won't let you &amp;quot;erase&amp;quot; it:&lt;br /&gt;
** http://e-mode.phas.ubc.ca/mce/firmware/sdsu/scrubber_RevU0106.s&lt;br /&gt;
* U0105 (deprecated) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0105.s&lt;br /&gt;
* U0104 (deprecated) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0104.s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The full source code is available in these archives (it will not compile unless you get the correct assembler and stuff):&lt;br /&gt;
* U0106 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0106.tar.gz&lt;br /&gt;
* U0105 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0105.tar.gz&lt;br /&gt;
* U0104 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0104.tar.gz&lt;br /&gt;
&lt;br /&gt;
The subversion tree can be obtained like this (you may not have access to this repository; contact UBC);&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/arc_pci&lt;br /&gt;
&lt;br /&gt;
It is laid out roughly as follows:&lt;br /&gt;
 /trunk       main line of development&lt;br /&gt;
 /releases    tagged versions of code &lt;br /&gt;
 /tools       debugging tools&lt;br /&gt;
 /clash       stuff for making CLAS work with wine and linux&lt;br /&gt;
 /docs        useful (though maybe not to you) notes&lt;br /&gt;
&lt;br /&gt;
== Firmware version notes ==&lt;br /&gt;
&lt;br /&gt;
=== U0107 (pending): alpha ===&lt;br /&gt;
&lt;br /&gt;
* This firmware can operate in either of two modes:&lt;br /&gt;
** '''U0106 compatibility mode''': the firmware will work with classic MAS driver, just like U0106 (plus some bugfixes).&lt;br /&gt;
** '''New Master-only mode''': when activated, uses new set of protocols for communication with the MAS driver.  These have proven to be much more stable on some systems.  Also, bigphysarea is no longer needed.&lt;br /&gt;
* This firmware/driver are in limited release; do not attempt to use them without consulting with UBC.&lt;br /&gt;
* Downloads:&lt;br /&gt;
** S-rec for release candidates here: http://e-mode.phas.ubc.ca/mce/firmware/sdsu/&lt;br /&gt;
** Soft-patches for upgrading U0106 to pseudo-U0107 temporarily: http://e-mode.phas.ubc.ca/mce/firmware/sdsu/patches/&lt;br /&gt;
&lt;br /&gt;
=== U0106 (2011-11-21): Recommended version ===&lt;br /&gt;
&lt;br /&gt;
* Backward compatible with U0104 and U0105.&lt;br /&gt;
* Fixes bug introduced in U0105 that prevented handling of some PCI bus errors.&lt;br /&gt;
* Introduction of command to update PCI burst size.&lt;br /&gt;
* Bugs:&lt;br /&gt;
** Versions U0104-6 all suffer from the following issues:&lt;br /&gt;
*** Host interrupts use bit-test instructions, which are not interrupt safe; consequence is a race condition that can upset ongoing tasks such as FO downloads and PCI bursts.  Patch for this issue, applicable to firmware versions U0104-6:&lt;br /&gt;
**** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
*** Multiple simultaneous PCI bus errors are not handled properly, leading to stale bits in the error register.  This is an unlikely error vector, but should be fixed.&lt;br /&gt;
&lt;br /&gt;
=== U0105 (2009-06-08) ===&lt;br /&gt;
&lt;br /&gt;
* Backward compatible with U0104.&lt;br /&gt;
* Support for MCE STOP commands and commands-on-the-fly.&lt;br /&gt;
* Accelerated MCE command code (along with Quiet-RP this increases commanding rate to ~6 kHz).&lt;br /&gt;
* Quiet-RP simplifies the protocol for MCE reply handling.&lt;br /&gt;
* Low-level improvements:&lt;br /&gt;
** CON is done as PCI burst&lt;br /&gt;
** Fibre-optic FIFO is emptied with timed read instead of polling.&lt;br /&gt;
** Hand-shaking for interrupts instead of host command to clear INTA and HC3.&lt;br /&gt;
** Non-interrupt context code disables interrupts when performing PCI transactions.&lt;br /&gt;
** Host vector interrupts are otherwise enabled, so PC doesn't have to force with HNMI bit.&lt;br /&gt;
* Bugs and fixes:&lt;br /&gt;
** Some PCI bus arbitration conditions are mis-handled.  This is fixed in U0106; alternately the commands below can be issued to patch active U0105 firmware.  (The patch will not survive a power cycle.):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0105_unignore_pci_errors.bash&lt;br /&gt;
** Also this (see description in U0106):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
&lt;br /&gt;
=== U0104: First version with non-realtime linux support ===&lt;br /&gt;
&lt;br /&gt;
* Implements quiet transfer mode!  Remains backwards compatible with A1.4.&lt;br /&gt;
* Fixes the 64k boundary crossing issue&lt;br /&gt;
* Moves parameters that enter via interrupt out of registers and into variables&lt;br /&gt;
* Version reporting tag-along to RDM command (sending 'VER' to RDM's vector address returns the code version).&lt;br /&gt;
* Maximum burst length is reduced to 64 bytes, and is configurable.&lt;br /&gt;
* Reset (RST) clears the fibre fifo&lt;br /&gt;
* Bugs:&lt;br /&gt;
** This (see description in U0106):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
&lt;br /&gt;
== U0103: Oldest UBC release ==&lt;br /&gt;
&lt;br /&gt;
* Minor modifications of SCUBA2's A1.4 firmware, to improve PCI stability.&lt;br /&gt;
* Not compatible with non-realtime systems.&lt;br /&gt;
&lt;br /&gt;
== Programming the ARC64 Flash memory ==&lt;br /&gt;
&lt;br /&gt;
To program or upgrade the PCI card's firmware, it is necessary to remove the flash memory chip from the card and program it using a standard EEPROM programmer.&lt;br /&gt;
&lt;br /&gt;
# Obviously you should turn off your computer and stuff first.&lt;br /&gt;
# The chip is a large DIP located at U5 on the PCI board.  To remove the chip you may use one of the following (in increasing order of risk, and decreasing order of barbarism):&lt;br /&gt;
## telekinesis&lt;br /&gt;
## a chip removal tool&lt;br /&gt;
## needle-nose pliers&lt;br /&gt;
## a screw-driver&lt;br /&gt;
## thumb and finger&lt;br /&gt;
## fingers only&lt;br /&gt;
# The chip is a standard 256 Kbit electrically erasable Flash ROM.  If you can't find the particular part in your EEPROM programmer software, try using one of these compatible parts:&lt;br /&gt;
## Fujitsu MBM28C256&lt;br /&gt;
## CSI (Catalyst) CAT28C256 L&lt;br /&gt;
## Anything else that has 28C256 in its name as long as it is a 28-pin DIP package and you are using the right socket for your programmer.&lt;br /&gt;
# Some programmers won't recognize this chip as erasable.  You can just try programming the chip with the new firmware, or pseudo-erasing it first using a &amp;quot;scrubber&amp;quot; file (available for U0106 in the links above).&lt;br /&gt;
# The firmware we provide is compiled into a [ http://en.wikipedia.org/wiki/SREC_%28file_format%29 Motorola S-record format ] hex file.  This is a standard format that your programmer software should be able to cope with.&lt;br /&gt;
# When placing the chip back in the board, the notch on the chip should be at the same end as the notch on the socket.&lt;br /&gt;
&lt;br /&gt;
== Other information ==&lt;br /&gt;
&lt;br /&gt;
* [[ PCI card bug list ]]&lt;br /&gt;
* [[ PCI card hacking ]]&lt;br /&gt;
* [[ PCI card code assembly on Linux ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Firmware]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=PCI_card_firmware&amp;diff=5723</id>
		<title>PCI card firmware</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=PCI_card_firmware&amp;diff=5723"/>
		<updated>2014-04-18T16:58:35Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Firmware version notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hierarchy header}}&lt;br /&gt;
UBC-produced firmware for the ARC-64 [[PCI card]].  [[MAS]] provides a linux kernel driver for this firmware.&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
These S-record files should work with any reasonable EEPROM programmer:&lt;br /&gt;
* U0106 (recommended) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0106.s&lt;br /&gt;
** 8-bit checksum 6FCDCE&lt;br /&gt;
** Scrubber file - try writing all ones to your  this to your chip first if your programmer won't let you &amp;quot;erase&amp;quot; it:&lt;br /&gt;
** http://e-mode.phas.ubc.ca/mce/firmware/sdsu/scrubber_RevU0106.s&lt;br /&gt;
* U0105 (deprecated) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0105.s&lt;br /&gt;
* U0104 (deprecated) - http://e-mode.phas.ubc.ca/mce/firmware/sdsu/SDSU_RevU0104.s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The full source code is available in these archives (it will not compile unless you get the correct assembler and stuff):&lt;br /&gt;
* U0106 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0106.tar.gz&lt;br /&gt;
* U0105 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0105.tar.gz&lt;br /&gt;
* U0104 - http://e-mode.phas.ubc.ca/mce/arc_pci/source_code/arc_pci-U0104.tar.gz&lt;br /&gt;
&lt;br /&gt;
The subversion tree can be obtained like this (you may not have access to this repository; contact UBC);&lt;br /&gt;
 svn checkout svn://e-mode.phas.ubc.ca/arc_pci&lt;br /&gt;
&lt;br /&gt;
It is laid out roughly as follows:&lt;br /&gt;
 /trunk       main line of development&lt;br /&gt;
 /releases    tagged versions of code &lt;br /&gt;
 /tools       debugging tools&lt;br /&gt;
 /clash       stuff for making CLAS work with wine and linux&lt;br /&gt;
 /docs        useful (though maybe not to you) notes&lt;br /&gt;
&lt;br /&gt;
== Firmware version notes ==&lt;br /&gt;
&lt;br /&gt;
=== U0107 (pending): alpha ===&lt;br /&gt;
&lt;br /&gt;
* This firmware can operate in either of two modes:&lt;br /&gt;
** '''U0106 compatibility mode''': the firmware will work with classic MAS driver, just like U0106 (plus some bugfixes).&lt;br /&gt;
** '''New Master-only mode''': when activated, uses new set of protocols for communication with the MAS driver.  These have proven to be much more stable on some systems.  Also, bigphysarea is no longer needed.&lt;br /&gt;
* This firmware/driver are in limited release; do not attempt to use them without consulting with UBC.  Also, see [[Master-only PCI card firmware]].&lt;br /&gt;
&lt;br /&gt;
=== U0106 (2011-11-21): Recommended version ===&lt;br /&gt;
&lt;br /&gt;
* Backward compatible with U0104 and U0105.&lt;br /&gt;
* Fixes bug introduced in U0105 that prevented handling of some PCI bus errors.&lt;br /&gt;
* Introduction of command to update PCI burst size.&lt;br /&gt;
* Bugs:&lt;br /&gt;
** Versions U0104-6 all suffer from the following issues:&lt;br /&gt;
*** Host interrupts use bit-test instructions, which are not interrupt safe; consequence is a race condition that can upset ongoing tasks such as FO downloads and PCI bursts.  Patch for this issue, applicable to firmware versions U0104-6:&lt;br /&gt;
**** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
*** Multiple simultaneous PCI bus errors are not handled properly, leading to stale bits in the error register.  This is an unlikely error vector, but should be fixed.&lt;br /&gt;
&lt;br /&gt;
=== U0105 (2009-06-08) ===&lt;br /&gt;
&lt;br /&gt;
* Backward compatible with U0104.&lt;br /&gt;
* Support for MCE STOP commands and commands-on-the-fly.&lt;br /&gt;
* Accelerated MCE command code (along with Quiet-RP this increases commanding rate to ~6 kHz).&lt;br /&gt;
* Quiet-RP simplifies the protocol for MCE reply handling.&lt;br /&gt;
* Low-level improvements:&lt;br /&gt;
** CON is done as PCI burst&lt;br /&gt;
** Fibre-optic FIFO is emptied with timed read instead of polling.&lt;br /&gt;
** Hand-shaking for interrupts instead of host command to clear INTA and HC3.&lt;br /&gt;
** Non-interrupt context code disables interrupts when performing PCI transactions.&lt;br /&gt;
** Host vector interrupts are otherwise enabled, so PC doesn't have to force with HNMI bit.&lt;br /&gt;
* Bugs and fixes:&lt;br /&gt;
** Some PCI bus arbitration conditions are mis-handled.  This is fixed in U0106; alternately the commands below can be issued to patch active U0105 firmware.  (The patch will not survive a power cycle.):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0105_unignore_pci_errors.bash&lt;br /&gt;
** Also this (see description in U0106):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
&lt;br /&gt;
=== U0104: First version with non-realtime linux support ===&lt;br /&gt;
&lt;br /&gt;
* Implements quiet transfer mode!  Remains backwards compatible with A1.4.&lt;br /&gt;
* Fixes the 64k boundary crossing issue&lt;br /&gt;
* Moves parameters that enter via interrupt out of registers and into variables&lt;br /&gt;
* Version reporting tag-along to RDM command (sending 'VER' to RDM's vector address returns the code version).&lt;br /&gt;
* Maximum burst length is reduced to 64 bytes, and is configurable.&lt;br /&gt;
* Reset (RST) clears the fibre fifo&lt;br /&gt;
* Bugs:&lt;br /&gt;
** This (see description in U0106):&lt;br /&gt;
*** http://e-mode.phas.ubc.ca/mce/arc_pci/firmware/patches/patch_U0106_safetyize_vector_ints.bash&lt;br /&gt;
&lt;br /&gt;
== U0103: Oldest UBC release ==&lt;br /&gt;
&lt;br /&gt;
* Minor modifications of SCUBA2's A1.4 firmware, to improve PCI stability.&lt;br /&gt;
* Not compatible with non-realtime systems.&lt;br /&gt;
&lt;br /&gt;
== Programming the ARC64 Flash memory ==&lt;br /&gt;
&lt;br /&gt;
To program or upgrade the PCI card's firmware, it is necessary to remove the flash memory chip from the card and program it using a standard EEPROM programmer.&lt;br /&gt;
&lt;br /&gt;
# Obviously you should turn off your computer and stuff first.&lt;br /&gt;
# The chip is a large DIP located at U5 on the PCI board.  To remove the chip you may use one of the following (in increasing order of risk, and decreasing order of barbarism):&lt;br /&gt;
## telekinesis&lt;br /&gt;
## a chip removal tool&lt;br /&gt;
## needle-nose pliers&lt;br /&gt;
## a screw-driver&lt;br /&gt;
## thumb and finger&lt;br /&gt;
## fingers only&lt;br /&gt;
# The chip is a standard 256 Kbit electrically erasable Flash ROM.  If you can't find the particular part in your EEPROM programmer software, try using one of these compatible parts:&lt;br /&gt;
## Fujitsu MBM28C256&lt;br /&gt;
## CSI (Catalyst) CAT28C256 L&lt;br /&gt;
## Anything else that has 28C256 in its name as long as it is a 28-pin DIP package and you are using the right socket for your programmer.&lt;br /&gt;
# Some programmers won't recognize this chip as erasable.  You can just try programming the chip with the new firmware, or pseudo-erasing it first using a &amp;quot;scrubber&amp;quot; file (available for U0106 in the links above).&lt;br /&gt;
# The firmware we provide is compiled into a [ http://en.wikipedia.org/wiki/SREC_%28file_format%29 Motorola S-record format ] hex file.  This is a standard format that your programmer software should be able to cope with.&lt;br /&gt;
# When placing the chip back in the board, the notch on the chip should be at the same end as the notch on the socket.&lt;br /&gt;
&lt;br /&gt;
== Other information ==&lt;br /&gt;
&lt;br /&gt;
* [[ PCI card bug list ]]&lt;br /&gt;
* [[ PCI card hacking ]]&lt;br /&gt;
* [[ PCI card code assembly on Linux ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Firmware]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Series_array_setup&amp;diff=5643</id>
		<title>Series array setup</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Series_array_setup&amp;diff=5643"/>
		<updated>2013-09-23T19:39:56Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here's how to set up a series array in the python auto_tuning.&lt;br /&gt;
&lt;br /&gt;
= Run the auto_setup to see if it crashes =&lt;br /&gt;
&lt;br /&gt;
Without trying to make it a good one, just check that the program runs smoothly.  We will tell auto_setup to only acquire an SA ramp, and not to try tuning the other SQUID stages:&lt;br /&gt;
 auto_setup --last-stage=sa_ramp&lt;br /&gt;
&lt;br /&gt;
When it's working, the auto_setup should print something like:&lt;br /&gt;
 Tuning ctime: 1323464515&lt;br /&gt;
&lt;br /&gt;
That number is the current unix time.  We often refer to it as a ctime.  It becomes the &amp;quot;tuning_id&amp;quot; for this tuning.  You indicates that your data are headed $MAS_DATA/&amp;lt;tuning_id&amp;gt; and your analysis plots will show up in $MAS_DATA/analysis/&amp;lt;tuning_id&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== First glance ==&lt;br /&gt;
&lt;br /&gt;
Looking at the SA plot you will probably see one of the following:&lt;br /&gt;
* Signal contains V-phi curves&lt;br /&gt;
** Beginner's luck.  Proceed to tweaking.&lt;br /&gt;
* Signal shows noise, but no sign of a V-phi curve&lt;br /&gt;
** There's hope; try increasing the ranges of biases and feedback you are probing.  Proceed to tweaking.&lt;br /&gt;
* Signal is flat, at 0.&lt;br /&gt;
** Your MCE configuration is wrong somehow; do your mce.cfg and experiment.cfg agree on which readout cards are present?  Are sample_num and sample_dly set to reasonable values (10, 90)?  Is sample_dly less than row_len?&lt;br /&gt;
* Signal is noiseless and flat, at -81920 or +81910&lt;br /&gt;
** There's hope; you may need to adjust sa_bias_offset_ratio, as described below.&lt;br /&gt;
** This (esp +81910) is what tends to happen if the SA line is open circuit, though.&lt;br /&gt;
&lt;br /&gt;
= Tweaking the SA ramp settings =&lt;br /&gt;
&lt;br /&gt;
Your plots from your dry run above will hopefully show some signs of a series array.  If they do not, first check that your ramp parameters are reasonable (try using the sensible defaults described below).  If your curves look sort-of-good, but seem to be truncated at the top or bottom of their range, you may need to adjust your sa_offset_bias_ratio.&lt;br /&gt;
&lt;br /&gt;
== Flux and bias ranges ==&lt;br /&gt;
&lt;br /&gt;
There aren't that many settings that affect the SA ramp step of auto_setup.  By default, [[experiment.cfg]] is set up to more or less span the space allowed by the bias and feedback DACs.  These ranges are specified in the parameters:&lt;br /&gt;
 # Auto-tune does a flux feedback ramp, and optionally ramps the sa bias too.&lt;br /&gt;
 sa_ramp_bias       = 1;&lt;br /&gt;
 &lt;br /&gt;
 sa_ramp_flux_start = 0; &lt;br /&gt;
 sa_ramp_flux_count = 100;&lt;br /&gt;
 sa_ramp_flux_step  = 640; &lt;br /&gt;
 &lt;br /&gt;
 sa_ramp_bias_start = 15000;&lt;br /&gt;
 sa_ramp_bias_step  = 1500;&lt;br /&gt;
 sa_ramp_bias_count = 25;&lt;br /&gt;
&lt;br /&gt;
When &amp;quot;sa_ramp_bias&amp;quot; is set to 1, the auto_setup will will run a feedback (or &amp;quot;flux&amp;quot;) ramp for 25 different values of the SA bias, namely: 15000, 16500, 18000, ..., 51000.  This space can be narrowed to probe the relevant range for your system.&lt;br /&gt;
&lt;br /&gt;
If, some hittingday, you are happy with fixing the bias values (to speed up or stabilize the tuning while you study other squid stages, for example), you can set '''sa_ramp_bias = 0''' and put your desired SA bias values into the parameter&lt;br /&gt;
 default_sa_bias = [ 0, 0, 0, ...];&lt;br /&gt;
&lt;br /&gt;
This will cause the auto_setup to set up a single set of bias values only, and then run the feedback ramp.  The feedback range (sa_ramp_flux_*) might be adjusted to obtain higher resolution (for measuring the SA flux quanta, for example), or to restrict the ramp to a smaller number of phi0 in cases where the complete DAC range spans more than 2 phi0.&lt;br /&gt;
&lt;br /&gt;
== SA offset bias ratio ==&lt;br /&gt;
&lt;br /&gt;
[[File:series_array_ramp_clipped.png|frame|link=|SA Ramp curve showing clipping at ~82000 ADC units]]&lt;br /&gt;
A subtle tweak that all users will need to configure for their system is the so called [[http://e-mode.phas.ubc.ca/mcewiki/index.php/Experiment.cfg#sa_offset_bias_ratio | sa_offset_bias_ratio]].  This number basically describes to what extent the DC level of the SA output drifts upwards as the SA bias is increased.  If one does not compensate for this drift by applying an offset at the input op amp, the amps and ADC will saturate.  If you see your SA curves &amp;quot;rail&amp;quot; at values of -81920 or +81910, it means that your sa_offset_bias_ratio needs to be adjusted.  (Note that clipping will occur at values corresponding to the product of rca sample_num (usually 10) and the ADC range, -8192 to 8191.)&lt;br /&gt;
&lt;br /&gt;
If your SA curves are railing at the positive end (probably +81920), you should increase sa_offset_bias_ratio (start by increasing by 0.1; it's quite sensitive).  If your SA curves hit the lower boundary of the ADC (-81920), you should decrease sa_offset_bias_ratio.&lt;br /&gt;
&lt;br /&gt;
There is a script that will try to guess your ratio, but your mileage may vary:&lt;br /&gt;
 python $MAS_PYTHON/special_ops.py measure_sa_offset_ratio&lt;br /&gt;
&lt;br /&gt;
The output of that script should look something like this:&lt;br /&gt;
 Saving current configuration...&lt;br /&gt;
 Setting up...&lt;br /&gt;
 Measuring SA bias response...&lt;br /&gt;
 Restoring...&lt;br /&gt;
 Apparent resistance ratios, by column:&lt;br /&gt;
     0.001  0.036  0.038  0.043  0.039  0.042  0.040  0.000&lt;br /&gt;
     0.064  0.044  0.045  0.000  0.000  0.000  0.000  0.000&lt;br /&gt;
 The typical ratio is:  0.039&lt;br /&gt;
 Suggested sa_offset_bias_ratios, by column:&lt;br /&gt;
     0.106  0.084  0.084  0.090  0.087  0.097  0.093  0.000&lt;br /&gt;
     0.112  0.091  0.092  0.000  0.000  0.000  0.000  0.000&lt;br /&gt;
 Smallest range-filling ratio: 0.084&lt;br /&gt;
 Recommended sa_offset_bias_ratio: 0.084&lt;br /&gt;
&lt;br /&gt;
So you'd go and put 0.084 into your active experiment.cfg, and re-run the tuning to see if that helped the railing at all.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MCE_config_template_system&amp;diff=5642</id>
		<title>MCE config template system</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=MCE_config_template_system&amp;diff=5642"/>
		<updated>2013-09-18T22:27:01Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An important component of the current MCE configuration system is the &amp;quot;mce_config_template&amp;quot; file.  This file is a bash script that puts the MCE in some desired state, which usually means that it sets up the biases and locking points of the squids and series arrays to the values determined in the most recent auto-tuning.&lt;br /&gt;
&lt;br /&gt;
= General structure =&lt;br /&gt;
&lt;br /&gt;
In previous versions of MCE software, there was a template file called config_mce_auto_setup_&amp;lt;date&amp;gt;, with date of the form YYYYMMDD, that lived in the /data/cryo/&amp;lt;date&amp;gt; folder (which was linked to /data/cryo/current_data and was the destination for all MCE data files).  When the [[ Auto-tuning IDL code | auto-tune ]] was run, certain lines of the config script were updated to reflect the biases and locking points discovered by the auto-tune code.  The auto-tune code would then run the updated config script to load the values into the MCE in preparation for the next stage.&lt;br /&gt;
&lt;br /&gt;
In order to create a more flexible and robust system, the auto-tune programs no longer edit the config script directly.  Instead, there is configuration file, called [[ experiment.cfg ]], where the auto-tune programs can read and write values.  A config script is then generated by running &amp;quot;mce_make_config&amp;quot;, which creates a config script based on the values in experiment.cfg.&lt;br /&gt;
&lt;br /&gt;
The auto-tune read and write is accomplished via IDL functions called &amp;quot;load_exp_params&amp;quot; and &amp;quot;save_exp_params&amp;quot;.  These functions are in &amp;quot;load_exp_params.pro&amp;quot;, which is automatically generated by the program [[ mas_param ]] based on a template for experiment.cfg.  They allow IDL to import settings from experiment.cfg as an IDL structure, manipulate them using normal IDL vector operations, and then save the structure data back to the file.&lt;br /&gt;
&lt;br /&gt;
The mce_make_config script constructs a config script by combining various pre-defined blocks of bash code with a block of bash variable declarations that is generated by [[ mas_param ]] from experiment.cfg.&lt;br /&gt;
&lt;br /&gt;
= experiment.cfg =&lt;br /&gt;
&lt;br /&gt;
'''For a description of some of the most important configuration parameters, see [[ experiment.cfg ]].'''&lt;br /&gt;
&lt;br /&gt;
The experiment.cfg file structure is that of [[libconfig]].  Here are some typical lines:&lt;br /&gt;
&lt;br /&gt;
 # output level and time interval for driving detectors normal.&lt;br /&gt;
 &lt;br /&gt;
 tes_bias_idle = [0, 0, 0];&lt;br /&gt;
 tes_bias_normal = [65000, 65000, 65000];&lt;br /&gt;
 tes_bias_normal_time = 0.1;&lt;br /&gt;
 &lt;br /&gt;
 # Note that each entry of flux_quanta_rc# is repeated 41 times and&lt;br /&gt;
 # written to 'rc# flux_quanta%'&lt;br /&gt;
 &lt;br /&gt;
 flux_quanta = [ 0, 0, 0, 0, 0, 0, 0, 0,&lt;br /&gt;
                 0, 0, 0, 0, 0, 0, 0, 0,&lt;br /&gt;
                 0, 0, 0, 0, 0, 0, 0, 0,&lt;br /&gt;
                 0, 0, 0, 0, 0, 0, 0, 0 ];&lt;br /&gt;
&lt;br /&gt;
Although libconfig permits complex nested data structures, experiment.cfg is restricted to root-level simple data types (strings, floats, integers, arrays of floats, and arrays of integers).&lt;br /&gt;
&lt;br /&gt;
Unfortunately, experiment.cfg contains values associated with&lt;br /&gt;
* very stable properties that define the hardware configuration (e.g. number of rows of squids and sync box presence/absence)&lt;br /&gt;
* properties that must be manipulated during auto-tuning but then should return to some experiment default (e.g. rc data_mode)&lt;br /&gt;
* settings that a user can manipulate to select different auto-tuning options (e.g. the list of rows for which to generate sq1 bias ramp plots)&lt;br /&gt;
* properties that are discovered or revised at various stages of the auto-tuning (e.g. the sq2 feedback lock points)&lt;br /&gt;
&lt;br /&gt;
It is necessary to distinguish between values that will be used to generate the config script and values that should be used to generate the /final/ config script.  For example &amp;quot;default_data_mode = 2;&amp;quot; tells auto-tune what data mode to set in its final config script generation; in the mean time it will change the line &amp;quot;data_mode = 2;&amp;quot; to all sorts of other values for doing ramps and servos. &lt;br /&gt;
&lt;br /&gt;
There are 2 copies of experiment.cfg in use at any time.  The first is the working copy, kept in $MAS_DATA, which is edited by auto-tune and used to generate the config script.  The second is kept in $MAS_CONFIG, and is a clean copy where experiment parameters are recorded.  The $MAS_CONFIG copy is the one that should be commented carefully, and kept under version control.&lt;br /&gt;
&lt;br /&gt;
The set_directory script performs a number of tasks, including copying experiment.cfg from $MAS_CONFIG into $MAS_DATA if there is no copy there already.  In particular, if set_directory decides that it is necessary to create a new daily folder (and move the current_data link to point there), then a fresh copy of experiment.cfg is copied from $MAS_CONFIG to the new $MAS_DATA folder.&lt;br /&gt;
&lt;br /&gt;
Another way to replace $MAS_DATA/experiment.cfg with the $MAS_CONFIG copy is to remove it and then run set_directory.&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=USB_Blaster&amp;diff=5592</id>
		<title>USB Blaster</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=USB_Blaster&amp;diff=5592"/>
		<updated>2013-05-28T14:51:32Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Programming from the Command Line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In order to load new firmware on the MCE cards, you need to have either an Ethernet Blaster or a USB Blaster or a ByteBlaster, all available from Altera, connected to the MCE front-panel JTAG connector. On the software side, you need to have Quartus installed (check [[ Quartus II Installation ]])&lt;br /&gt;
&lt;br /&gt;
(An alternative method is to load firmware over the fibre with no need for Altera Software/Hardware, this is work in progress. but if you have the patience, we can help you get it setup once and then use it forever. )&lt;br /&gt;
&lt;br /&gt;
= Updating firmware on MCE Cards =&lt;br /&gt;
Each MCE card has an Altera Stratix FPGA and a configuration device. All cards except low-power Readout Cards (Rev. E and beyond) have an EPC16 configuration device. FPGAs are RAM-based devices, therefore, upon power up they load their firmware from a flash-based configuration devices.&lt;br /&gt;
&lt;br /&gt;
In order to load firmware temporarily, use an .sof file to directly program the Stratix FPGA. This firmware only lasts till next power cycle. In order to load firmware permanently, use a .pof file to program the EPC16 parallel configuration devices or .jic to program the EPCS64 serial configuration device on low-power readout-card. &lt;br /&gt;
&lt;br /&gt;
Firmware on all cards can be upgraded by attaching a Blaster (USB-Blaster, or [[ Using Ethernet Blaster | Ethernet Blaster ]], or ByteBlaster) through the MCE front-panel connector. &lt;br /&gt;
&lt;br /&gt;
Clock card is an exception because it has two configuration devices: a Factory configuration device and a application configuration device. When MCE is turned on, the Clock-Card FPGA is loaded from the Factory configuration device, but then it can switch to the firmware loaded in the application configuration device by issuing an &amp;quot;wb cc app_config 1&amp;quot; command in mas. See the next section to program the Clock-Card Factory configuration device. &lt;br /&gt;
&lt;br /&gt;
# Connect a USB Blaster to a PC with Quartus software installed.&lt;br /&gt;
# Plug the Blaster connector into the MCE front-panel connector. Be sure that the Clock Card is powered on.&lt;br /&gt;
# Open Quartus II. (Note that on Linux systems, you may need to invoke Quartus from the terminal.  If &amp;quot;quartus&amp;quot; is not in the path, you may be able to find it in /opt/usr/local/lib/altera/10.0/quartus/bin (which can be added to the path.  Furthermore, you may need to be root user to access the USB blaster, in which case &amp;quot;sudo quartus&amp;quot; (or &amp;quot;sudo /path/to/quartus&amp;quot;) should be enough.&lt;br /&gt;
# Select Tools -&amp;gt; Programmer&lt;br /&gt;
# Press the 'Hardware Setup' button&lt;br /&gt;
# Select USB Blaster from the 'Currently Selected Hardware' drop-down menu.  If that option is not available, press the 'Add Hardware' button, and add a USB Blaster to the list.&lt;br /&gt;
# Select 'Close'&lt;br /&gt;
# Select the 'Auto Detect' button and after few moments you should see list of devices.&lt;br /&gt;
# There are two devices listed per each MCE card with the exception of the low-power Readout card which will only show as one device. The top two devices correspond to Address Card, then the next 2 devices correspond to BC1, and so on.&lt;br /&gt;
# In order to load temporary firmware, choose the desired EP1S device. In order to load firmware permanently, choose the EPC16 device. In both cases for low-power Readout Card, select the EP3S device.&lt;br /&gt;
# Firmware programming files should be downloaded from [http://e-mode.phas.ubc.ca/mce_firmware/ firmware repository].  Copy files from this repository to the programming computer hard drive.  Temporary firmware (for EP1S and EP3S devices) uses .sof files.  Permanent firmware will be .pof (for EPC16 devices) or .jic (for EP3S devices).&lt;br /&gt;
# Double-click on the 'File' entry corresponding to the device that you wish to program, and select a programming file.  For .jic files, an EPCS64 device should be automatically added to the device list when you associate the .jic with the EP3S device.&lt;br /&gt;
# Check the box in the Program/Configure column corresponding to your device. For .jic file, check boxes for both EP3S50 and EPCS64.&lt;br /&gt;
# Select 'Start'.  If you are loading temporary firmware, it should take about 30 seconds, if you are loading permanent firmware, then it may take up to 10 minutes.&lt;br /&gt;
# For .sof files, the FPGA will automatically reconfigure itself when programming is complete.  For .pof or .jic files, it is necessary to power cycle the unit to get the new firmware loaded.&lt;br /&gt;
&lt;br /&gt;
= Updating the Factory Configuration on Clock Card= &lt;br /&gt;
# You need to program the Clock Card's .pof with your USB Blaster, but via P2 on the Clock Card board itself.  &lt;br /&gt;
# To gain access to this connector, partially eject the Clock Card from the MCE until you can see the connector. &lt;br /&gt;
# Plug the USB blaster into the connector so that the ribbon cable is oriented upwards (this puts pin 1 of the USB Blaster to pin 1 of the connector).  &lt;br /&gt;
# Gently curl the ribbon cable around so that it can come out the gap between the Clock Card faceplate and the Readout Card #4 faceplate.  &lt;br /&gt;
# Gently re-insert the Clock Card taking care not to kink the ribbon cable.  &lt;br /&gt;
# Open Quartus and go to the programmer window, as described above.&lt;br /&gt;
# Now when you press 'Auto Detect' to Scan the JTAG Chain, two devices should be listed. Click on EPC16 device and select a Clock Card .pof.&lt;br /&gt;
# Follow the instructions above for configuring the EPC16..&lt;br /&gt;
&lt;br /&gt;
= If the USB Blaster stops responding =&lt;br /&gt;
# Close Quartus&lt;br /&gt;
# Power off the MCE&lt;br /&gt;
# Wait for 5 seconds&lt;br /&gt;
# Power on the MCE&lt;br /&gt;
# Re-open Quartus&lt;br /&gt;
&lt;br /&gt;
= Using Ethernet Blaster =&lt;br /&gt;
&lt;br /&gt;
You can program the MCE remotely, if you have an Altera-supplied Ethernet Blaster. Assuming that EthernetBlaster is configured and attached to MCE:&lt;br /&gt;
&lt;br /&gt;
# In Quartus, select the &amp;quot;Tools -&amp;gt; Programmer&amp;quot; menu.&lt;br /&gt;
# Click on &amp;quot;Hardware Setup&amp;quot;&lt;br /&gt;
# Click on &amp;quot;Add Hardware&amp;quot;&lt;br /&gt;
# On the drop-down menus, select/specify the following pieces of information:&lt;br /&gt;
#*Hardware type:  EthernetBlaster&lt;br /&gt;
#*Port:  ---&lt;br /&gt;
#*Baud rate:  ---&lt;br /&gt;
#*Sever name:  &amp;lt;IP Address of the EthernetBlaster&amp;gt;&lt;br /&gt;
#*Server port:  1309 -- Server port 1309 should be opened for the Ethernet Blaster.&lt;br /&gt;
#*Server password:  &amp;lt;Password&amp;gt;&lt;br /&gt;
# Press &amp;quot;Auto Detect&amp;quot;.  It takes few moments to find the EthernetBlaster.  Press &amp;quot;OK&amp;quot;.&lt;br /&gt;
# Now you are back to Hardware Setup Page with the following item showing up in the list of &amp;quot;Available Hardware Items&amp;quot;: Hardware: Ethernet Blaster, Server: xxxxx, Port: /dev/ebhwip&lt;br /&gt;
# Click on the &amp;quot;Currently Selected Hardware&amp;quot; drop-down menu and select &amp;quot;EthernetBlaster&amp;quot;, and then press &amp;quot;Close&amp;quot;.&lt;br /&gt;
# Now Press on Auto Detect and you should see the list of cards that the EthernetBlaster is connected to.&lt;br /&gt;
&lt;br /&gt;
= Programming from the Command Line =&lt;br /&gt;
&lt;br /&gt;
On a remote Linux machine you might only have / might only be able to run a command line programmer.&lt;br /&gt;
&lt;br /&gt;
Find the path to the programmer; possibly&lt;br /&gt;
&lt;br /&gt;
 alias quartus_pgm='sudo /opt/altera/11.1/qprogrammer/bin/quartus_pgm'&lt;br /&gt;
&lt;br /&gt;
Scan (this is a CC factory configuration device):&lt;br /&gt;
&lt;br /&gt;
 quartus_pgm -a&lt;br /&gt;
 ...&lt;br /&gt;
 Info (213045): Using programming cable &amp;quot;USB-Blaster [4-2]&amp;quot;&lt;br /&gt;
 1) USB-Blaster [4-2]&lt;br /&gt;
   0100A0DD   EPC(16|4|8)&lt;br /&gt;
   171280DD   EPM(3128A|7128AE)&lt;br /&gt;
&lt;br /&gt;
Program:&lt;br /&gt;
&lt;br /&gt;
 quartus_pgm --mode=JTAG -o 'PV;firmware/cc_v0500000e_15may2012.pof@1'&lt;br /&gt;
 ...&lt;br /&gt;
 Info: Command: quartus_pgm --mode=JTAG -o PV;firmware/cc_v0500000e_15may2012.pof@1&lt;br /&gt;
 Info (213045): Using programming cable &amp;quot;USB-Blaster [4-2]&amp;quot;&lt;br /&gt;
 Info (213011): Using programming file firmware/cc_v0500000e_15may2012.pof with checksum 0x0D7E2A22 for device EPC16@1&lt;br /&gt;
 Info (209060): Started Programmer operation at Tue May 28 10:33:04 2013&lt;br /&gt;
 Info (209017): Device 1 contains JTAG ID code 0x0100A0DD&lt;br /&gt;
 Info (209018): Device 1 silicon ID is 0xB0E9&lt;br /&gt;
 Info (209044): Erasing EPC4/8/16 configuration device(s)&lt;br /&gt;
 Info (209023): Programming device(s)&lt;br /&gt;
 Info (209021): Performing verification on device(s)&lt;br /&gt;
 Info (209011): Successfully performed operation(s)&lt;br /&gt;
 Info (209061): Ended Programmer operation at Tue May 28 10:37:25 2013&lt;br /&gt;
 Info: Quartus II 32-bit Programmer was successful. 0 errors, 0 warnings&lt;br /&gt;
     Info: Peak virtual memory: 111 megabytes&lt;br /&gt;
     Info: Processing ended: Tue May 28 10:37:25 2013&lt;br /&gt;
     Info: Elapsed time: 00:04:22&lt;br /&gt;
     Info: Total CPU time (on all processors): 00:00:06&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=USB_Blaster&amp;diff=5591</id>
		<title>USB Blaster</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=USB_Blaster&amp;diff=5591"/>
		<updated>2013-05-28T14:46:18Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In order to load new firmware on the MCE cards, you need to have either an Ethernet Blaster or a USB Blaster or a ByteBlaster, all available from Altera, connected to the MCE front-panel JTAG connector. On the software side, you need to have Quartus installed (check [[ Quartus II Installation ]])&lt;br /&gt;
&lt;br /&gt;
(An alternative method is to load firmware over the fibre with no need for Altera Software/Hardware, this is work in progress. but if you have the patience, we can help you get it setup once and then use it forever. )&lt;br /&gt;
&lt;br /&gt;
= Updating firmware on MCE Cards =&lt;br /&gt;
Each MCE card has an Altera Stratix FPGA and a configuration device. All cards except low-power Readout Cards (Rev. E and beyond) have an EPC16 configuration device. FPGAs are RAM-based devices, therefore, upon power up they load their firmware from a flash-based configuration devices.&lt;br /&gt;
&lt;br /&gt;
In order to load firmware temporarily, use an .sof file to directly program the Stratix FPGA. This firmware only lasts till next power cycle. In order to load firmware permanently, use a .pof file to program the EPC16 parallel configuration devices or .jic to program the EPCS64 serial configuration device on low-power readout-card. &lt;br /&gt;
&lt;br /&gt;
Firmware on all cards can be upgraded by attaching a Blaster (USB-Blaster, or [[ Using Ethernet Blaster | Ethernet Blaster ]], or ByteBlaster) through the MCE front-panel connector. &lt;br /&gt;
&lt;br /&gt;
Clock card is an exception because it has two configuration devices: a Factory configuration device and a application configuration device. When MCE is turned on, the Clock-Card FPGA is loaded from the Factory configuration device, but then it can switch to the firmware loaded in the application configuration device by issuing an &amp;quot;wb cc app_config 1&amp;quot; command in mas. See the next section to program the Clock-Card Factory configuration device. &lt;br /&gt;
&lt;br /&gt;
# Connect a USB Blaster to a PC with Quartus software installed.&lt;br /&gt;
# Plug the Blaster connector into the MCE front-panel connector. Be sure that the Clock Card is powered on.&lt;br /&gt;
# Open Quartus II. (Note that on Linux systems, you may need to invoke Quartus from the terminal.  If &amp;quot;quartus&amp;quot; is not in the path, you may be able to find it in /opt/usr/local/lib/altera/10.0/quartus/bin (which can be added to the path.  Furthermore, you may need to be root user to access the USB blaster, in which case &amp;quot;sudo quartus&amp;quot; (or &amp;quot;sudo /path/to/quartus&amp;quot;) should be enough.&lt;br /&gt;
# Select Tools -&amp;gt; Programmer&lt;br /&gt;
# Press the 'Hardware Setup' button&lt;br /&gt;
# Select USB Blaster from the 'Currently Selected Hardware' drop-down menu.  If that option is not available, press the 'Add Hardware' button, and add a USB Blaster to the list.&lt;br /&gt;
# Select 'Close'&lt;br /&gt;
# Select the 'Auto Detect' button and after few moments you should see list of devices.&lt;br /&gt;
# There are two devices listed per each MCE card with the exception of the low-power Readout card which will only show as one device. The top two devices correspond to Address Card, then the next 2 devices correspond to BC1, and so on.&lt;br /&gt;
# In order to load temporary firmware, choose the desired EP1S device. In order to load firmware permanently, choose the EPC16 device. In both cases for low-power Readout Card, select the EP3S device.&lt;br /&gt;
# Firmware programming files should be downloaded from [http://e-mode.phas.ubc.ca/mce_firmware/ firmware repository].  Copy files from this repository to the programming computer hard drive.  Temporary firmware (for EP1S and EP3S devices) uses .sof files.  Permanent firmware will be .pof (for EPC16 devices) or .jic (for EP3S devices).&lt;br /&gt;
# Double-click on the 'File' entry corresponding to the device that you wish to program, and select a programming file.  For .jic files, an EPCS64 device should be automatically added to the device list when you associate the .jic with the EP3S device.&lt;br /&gt;
# Check the box in the Program/Configure column corresponding to your device. For .jic file, check boxes for both EP3S50 and EPCS64.&lt;br /&gt;
# Select 'Start'.  If you are loading temporary firmware, it should take about 30 seconds, if you are loading permanent firmware, then it may take up to 10 minutes.&lt;br /&gt;
# For .sof files, the FPGA will automatically reconfigure itself when programming is complete.  For .pof or .jic files, it is necessary to power cycle the unit to get the new firmware loaded.&lt;br /&gt;
&lt;br /&gt;
= Updating the Factory Configuration on Clock Card= &lt;br /&gt;
# You need to program the Clock Card's .pof with your USB Blaster, but via P2 on the Clock Card board itself.  &lt;br /&gt;
# To gain access to this connector, partially eject the Clock Card from the MCE until you can see the connector. &lt;br /&gt;
# Plug the USB blaster into the connector so that the ribbon cable is oriented upwards (this puts pin 1 of the USB Blaster to pin 1 of the connector).  &lt;br /&gt;
# Gently curl the ribbon cable around so that it can come out the gap between the Clock Card faceplate and the Readout Card #4 faceplate.  &lt;br /&gt;
# Gently re-insert the Clock Card taking care not to kink the ribbon cable.  &lt;br /&gt;
# Open Quartus and go to the programmer window, as described above.&lt;br /&gt;
# Now when you press 'Auto Detect' to Scan the JTAG Chain, two devices should be listed. Click on EPC16 device and select a Clock Card .pof.&lt;br /&gt;
# Follow the instructions above for configuring the EPC16..&lt;br /&gt;
&lt;br /&gt;
= If the USB Blaster stops responding =&lt;br /&gt;
# Close Quartus&lt;br /&gt;
# Power off the MCE&lt;br /&gt;
# Wait for 5 seconds&lt;br /&gt;
# Power on the MCE&lt;br /&gt;
# Re-open Quartus&lt;br /&gt;
&lt;br /&gt;
= Using Ethernet Blaster =&lt;br /&gt;
&lt;br /&gt;
You can program the MCE remotely, if you have an Altera-supplied Ethernet Blaster. Assuming that EthernetBlaster is configured and attached to MCE:&lt;br /&gt;
&lt;br /&gt;
# In Quartus, select the &amp;quot;Tools -&amp;gt; Programmer&amp;quot; menu.&lt;br /&gt;
# Click on &amp;quot;Hardware Setup&amp;quot;&lt;br /&gt;
# Click on &amp;quot;Add Hardware&amp;quot;&lt;br /&gt;
# On the drop-down menus, select/specify the following pieces of information:&lt;br /&gt;
#*Hardware type:  EthernetBlaster&lt;br /&gt;
#*Port:  ---&lt;br /&gt;
#*Baud rate:  ---&lt;br /&gt;
#*Sever name:  &amp;lt;IP Address of the EthernetBlaster&amp;gt;&lt;br /&gt;
#*Server port:  1309 -- Server port 1309 should be opened for the Ethernet Blaster.&lt;br /&gt;
#*Server password:  &amp;lt;Password&amp;gt;&lt;br /&gt;
# Press &amp;quot;Auto Detect&amp;quot;.  It takes few moments to find the EthernetBlaster.  Press &amp;quot;OK&amp;quot;.&lt;br /&gt;
# Now you are back to Hardware Setup Page with the following item showing up in the list of &amp;quot;Available Hardware Items&amp;quot;: Hardware: Ethernet Blaster, Server: xxxxx, Port: /dev/ebhwip&lt;br /&gt;
# Click on the &amp;quot;Currently Selected Hardware&amp;quot; drop-down menu and select &amp;quot;EthernetBlaster&amp;quot;, and then press &amp;quot;Close&amp;quot;.&lt;br /&gt;
# Now Press on Auto Detect and you should see the list of cards that the EthernetBlaster is connected to.&lt;br /&gt;
&lt;br /&gt;
= Programming from the Command Line =&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Programming_over_Fibre&amp;diff=5564</id>
		<title>Programming over Fibre</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Programming_over_Fibre&amp;diff=5564"/>
		<updated>2013-04-26T15:53:54Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Update Firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hierarchy header}}&lt;br /&gt;
The procedure to update the [[MCE firmware]] over the fibre interface using a [[MAS]] PC, also known as &amp;quot;Remote Firmware Update&amp;quot;, is described here.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
Each of the Address Card, Bias Cards, and Readout Cards of the MCE has an Altera Stratix FPGA along with a configuration device ([[MCE FPGA Types | See here]]). The Clock Card, however, has one FPGA with two configuration devices. FPGAs are RAM-based devices while configuration devices are Flash-based devices. Upon power up, each FPGA is loaded from its respective configuration device. The Clock Card FPGA is loaded from its factory configuration device upon power up, but then later, the firmware in the application configuration device can be loaded into the FPGA by issuing a command, i.e.:&lt;br /&gt;
&lt;br /&gt;
 mce_cmd -x rs cc config_app 1&lt;br /&gt;
&lt;br /&gt;
All these programmable parts, with the exception of the factory configuration device, are on a continuous JTAG chain that can be controlled via the MCE front-panel connector with an attached USB-Blaster, ''or'' via the Clock Card FPGA, provided it is running the right firmware, and is driven through the fibre interface.&lt;br /&gt;
&lt;br /&gt;
The factory configuration device, however, is not on the same JTAG chain. It is only accessible through an on-board JTAG connector and can only be programmed with a USB-Blaster attached and Quartus Programmer.&lt;br /&gt;
&lt;br /&gt;
In order to load temporary firmware, an sof file can be loaded into the FPGA. This firmware will be lost upon power cycle. To load permanent firmware, a pof file (or a jic file depending on EPC16 or EPCS64) can be loaded.&lt;br /&gt;
&lt;br /&gt;
= Remote Update: step by step =&lt;br /&gt;
This can be done in 3 steps:&lt;br /&gt;
# Scan JTAG chain&lt;br /&gt;
# Generate JAM file&lt;br /&gt;
# Update Firmware&lt;br /&gt;
== Scan JTAG Chain ==&lt;br /&gt;
&lt;br /&gt;
Run '''mce_auto_detect''':&lt;br /&gt;
 user@ubuntu:~$ mce_auto_detect&lt;br /&gt;
 mce_scan version 1&lt;br /&gt;
 card_scan&lt;br /&gt;
 #   card  card_id    card_type  pcb_rev    slot_id&lt;br /&gt;
       2 0x124fb77         3         0         8&lt;br /&gt;
       3 0x19c74de         2         0         4&lt;br /&gt;
       4 0x1256aa5         2         0         5&lt;br /&gt;
       7 0x19c0a93         1         6         1&lt;br /&gt;
       8 0x19c3071         1         6         2&lt;br /&gt;
       9 0x19c1455         1         6         3&lt;br /&gt;
      10 0x19c6305         0         0         0&lt;br /&gt;
 jtag_scan&lt;br /&gt;
 # id device&lt;br /&gt;
   1 EPC4/EPC8/EPC16&lt;br /&gt;
   2 EP1S40&lt;br /&gt;
   3 EPC4/EPC8/EPC16&lt;br /&gt;
   4 EP1S40&lt;br /&gt;
   5 EPC4/EPC8/EPC16&lt;br /&gt;
   6 EP1S10&lt;br /&gt;
   7 EPC4/EPC8/EPC16&lt;br /&gt;
   8 EP1S10&lt;br /&gt;
   9 EPC4/EPC8/EPC16&lt;br /&gt;
   10 EP1S10&lt;br /&gt;
   11 EPC4/EPC8/EPC16&lt;br /&gt;
   12 EP1S10&lt;br /&gt;
   13 EPC4/EPC8/EPC16&lt;br /&gt;
&lt;br /&gt;
Note that the order of devices are cc (#1), rc2 (device #2, #3), rc1(#4, #5), bc3 (#6, #7), bc2(#8, #9), bc1(#10, #11), ac(#12, #13). &lt;br /&gt;
&lt;br /&gt;
Device #1 refers to the Application configuration device on Clock Card.&lt;br /&gt;
&lt;br /&gt;
If there are no devices listed below &amp;quot;jtag_scan&amp;quot;, you probably have to flip a jumper on your clock card.  See the section below on [[ #Hardware Requirements ]].&lt;br /&gt;
&lt;br /&gt;
== Generate Jam File ==&lt;br /&gt;
You need to update firmware on one device type at a time, i.e., EPC only, or FPGA only, or EPCS64 only.&lt;br /&gt;
&lt;br /&gt;
'''If you have access to internet:'''&lt;br /&gt;
# Go to MCE Firmware Canning Party webpage: http://e-mode.phas.ubc.ca/mcefcp/&lt;br /&gt;
# copy and paste the result of mce_auto_detect on that webpage. &lt;br /&gt;
# Choose the target device(s) you want to program and a drop down menu of available firmware revisions will appear.&lt;br /&gt;
# Choose the firmware revision and click generate.&lt;br /&gt;
# Save the generated file somewhere on your mas PC.&lt;br /&gt;
&lt;br /&gt;
'''If you do NOT have access to internet:'''&lt;br /&gt;
# Install Quartus II Web Edition on Linux [[Quartus II Installation | See Instructions here]]&lt;br /&gt;
# make a cdf file from the output of mce_auto_detect. Here is a sample cdf file [http://www.phas.ubc.ca/~mce/mcedocs/software/sample.cdf CDF]&lt;br /&gt;
# generate a jam file by typing: &lt;br /&gt;
  quartus_cpf -c &amp;lt;cdf_file_name&amp;gt; &amp;lt;jamfilename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update Firmware== &lt;br /&gt;
&lt;br /&gt;
Run '''mce_fw_update''':&lt;br /&gt;
 Usage:   /usr/mce/mce_script/script/mce_fw_update &amp;lt;device&amp;gt; &amp;lt;jamfilename&amp;gt; &lt;br /&gt;
   device        one of:&lt;br /&gt;
           FPGA:   for temporary firmware (sof)&lt;br /&gt;
           EPC16:  for permanent firmware on any card other than RC Rev. E (pof)&lt;br /&gt;
           EPCS64: for permanent firmware on RC Rev. E (jic)&lt;br /&gt;
   jamfilename   either an absolute pathname, or a file in $MCE_JAM_DIR&lt;br /&gt;
&lt;br /&gt;
If you are programming FPGA parts (temporary firmware), this step takes seconds. However, it takes minutes to program permanent firmware into EPC16 or EPCS64 devices, e.g. '''13 minutes''' to program 2 rev F. Readout Cards.&lt;br /&gt;
&lt;br /&gt;
If the programming fails, you might need to mess with the programming frequencies.  These are passed to mce_jam via the -f flag, as frequencies in Hz.  See the mce_fw_update script, and try decreasing the frequency by a factor of 10.&lt;br /&gt;
&lt;br /&gt;
Note that when programming permanent firmware, the fw_rev will not immediately be updated.  The new firmware will not be loaded until the card is power cycled.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting Remote Update =&lt;br /&gt;
== Software Requirements ==&lt;br /&gt;
Make sure the following are installed.  &lt;br /&gt;
From the MAS repository:&lt;br /&gt;
* mce_jam : This will be installed under /usr/mce/bin/.&lt;br /&gt;
From the MCE script repository (trunk):&lt;br /&gt;
* read_idcode.jam : This should be in $MAS_TEMPLATE directory.&lt;br /&gt;
* $MCE_JAM_DIR is set : This is set through mas_env.bash.&lt;br /&gt;
* mce_auto_detect (in mce_script directory)&lt;br /&gt;
* mce_fw_update (in mce_script directory)&lt;br /&gt;
== Firmware Requirements ==&lt;br /&gt;
The Clock Card FPGA has to run firmware revision 5.0.7 or later. Considering that Clock Card FPGA can be loaded through either the Factory or Application configuration devices, at least one of these need to have 5.0.7+ firmware. If you are running Clock Card firmware prior to 5.0.7, which means your factory configuration device is loaded with firmware prior to 5.0.7, then attach USB-Blaster to the MCE front-panel connector. Run Quaruts Programmer, click on auto-detect, and program the second part from the bottom of the list, EPC16, with Clock Card firmware 5.0.7+.pof.&lt;br /&gt;
&lt;br /&gt;
Then issue the following command:&lt;br /&gt;
 mce_cmd -x rs cc config_app 1&lt;br /&gt;
to switch to the new firmware.  (Read back the firmware revision to make sure the new firmware is now active.)&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
The buffer that controls whether the FPGA can drive the JTAG chain or not is controlled by BB_EN or SW1 dip switch setting on the Clock Card. Clock Cards shipped earlier than Dec. 2010, do not have the right settings. To check this setting on your Clock Card, turn off the MCE power and unplug the Clock Card. The SW1.P1 labeled as &amp;quot;BB_EN&amp;quot; DIP should be on OPEN position. &lt;br /&gt;
&lt;br /&gt;
* Note that with DIP switch SW1.P1 set to OPEN, you can not program the FPGA(sof) from the front panel connector (USB_Blaster) anymore.&lt;br /&gt;
* With DIP switch set to OPEN, if CC firmware is pre-5.0.7, you can not access the JTAG chain from the front panel connector (USB_Blaster) anymore. Assuming you have 5.0.7+ in your configuration device, you need to issue: &amp;lt;code&amp;gt;mce_cmd -x rs cc config_app 1&amp;lt;/code&amp;gt; to be able to access front-panel JTAG.&lt;br /&gt;
&lt;br /&gt;
= Footnotes =&lt;br /&gt;
== Porting Remote Configuration Sofware to DAS ==&lt;br /&gt;
The following C-code will need to be ported to DAS to enable Remote Configuration.  You will need to convert the MCE WB and RB commands in the code to use DAS libraries and compile the code with the included Makefile:  &lt;br /&gt;
*[http://www.phas.ubc.ca/~mce/mcedocs/software/mce_jam/ MCE Jam Player -- SVN revision 16 (~/jp_25/mce_jam/trunk)].&lt;br /&gt;
** '''jam_mce.c''': contains low-level MCE routines used during programming&lt;br /&gt;
** all other files should be fine.&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
* [[intmce:Remote Firmware Update]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Rectangle_Mode_Data&amp;diff=5522</id>
		<title>Rectangle Mode Data</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Rectangle_Mode_Data&amp;diff=5522"/>
		<updated>2013-02-19T19:59:20Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;Rectangle Mode&amp;quot; refers to the sampling of a subset of the full array, typically at a kHz data rate.  The data from the Readout Cards is packed into output frames efficiently to minimize overhead. &lt;br /&gt;
&lt;br /&gt;
Rectangle mode eliminates strain on the acquisition system during fast acquisitions by eliminating read-out overhead.  This means that the 'difficulty' of read-out is a fairly linear function of (sampling frequency) x (number of detectors read out) rather than depending on each. &lt;br /&gt;
&lt;br /&gt;
The hardware limit on readout is roughly 4 MB/s.  Since MCE data are 32-bit words, this permits 1e6 detector-samples to be read out per second.&lt;br /&gt;
&lt;br /&gt;
So the maximum number of detectors that can be sampled at some frequency F is&lt;br /&gt;
  D = (1 MHz) / F&lt;br /&gt;
&lt;br /&gt;
You can't sample at 1 MHz.  But you could probably do a detector or two at 250 kHz.&lt;br /&gt;
&lt;br /&gt;
= Configuration =&lt;br /&gt;
&lt;br /&gt;
The steps for configuring a rectangle mode acquisition are:&lt;br /&gt;
# Set the multiplexing rate using num_rows and row_len&lt;br /&gt;
# If necessary, adjust row_order to mux the channels of interest (you can only read out rows you are multiplexing...).  If you do not intend to re-tune the array with the adjusted num_rows / row_order, you must also change the first entries of rc* adc_offset* to correspond to the desired rows and, for fast SQ2 switching, change row_order on the BAC/BC2.&lt;br /&gt;
# Identify a rectangle of detectors on the readout card to read out by setting the RC parameters&lt;br /&gt;
#* num_rows_reported, num_cols_reported, readout_row_index, readout_col_index&lt;br /&gt;
# Set the size of the readout frame by setting the CC parameters&lt;br /&gt;
#* num_rows_reported, num_cols_reported&lt;br /&gt;
# Set the CC decimation factor 'data_rate' so that the RC rectangles will stack perfectly into the CC readout frame.&lt;br /&gt;
#* e.g. suppose&lt;br /&gt;
#** RC num_rows_reported x num_cols_reported =  1x4 &lt;br /&gt;
#** CC num_rows_reported x num_cols_reported = 33x8&lt;br /&gt;
#* then we set &lt;br /&gt;
#** CC data_rate = (33 x 8) / (1 x 4) = 66&lt;br /&gt;
&lt;br /&gt;
= Readout limitations =&lt;br /&gt;
&lt;br /&gt;
Rectangle mode configuration should respect the following hardware limits:&lt;br /&gt;
* Total data rate must not exceed 4 MB/s&lt;br /&gt;
* Read-out frequency must not exceed 20 kHz&lt;br /&gt;
* The multiplexing frame rate must not be set so fast that the MCE cannot communicate with the readout cards.  This limit is probably in the 100s of kHz.&lt;br /&gt;
* The buffer on each RC can hold 2048 words of data.  The readout frame size, per readout card, must be kept somewhat below this limit.&lt;br /&gt;
&lt;br /&gt;
Other things to remember:&lt;br /&gt;
* num_rows &amp;gt;= 2 is encouraged.&lt;br /&gt;
* you can't sample a detector faster than it is being visited in the multiplexing cycle.&lt;br /&gt;
* In RC firmware prior to 5.1.7, the following condition has to be met:&lt;br /&gt;
 (230 + 2 * cc_num_rows_reported * cc_num_cols_reported) &amp;lt; (num_rows * row_len) &lt;br /&gt;
otherwise, the data is corrupted. This problem is fixed in RC firmware 5.1.7 (See [[Readout Card firmware]])&lt;br /&gt;
&lt;br /&gt;
= Checking MCE configuration using rect_check.py =&lt;br /&gt;
&lt;br /&gt;
Use the utility @rect_check.py@ to verify that data will be / were acquired reasonably.&lt;br /&gt;
&lt;br /&gt;
e.g. To check the state of the MCE (requires python MCE bindings), run&lt;br /&gt;
 rect_check.py --mce&lt;br /&gt;
&lt;br /&gt;
To analyze the data framing in a runfile:&lt;br /&gt;
 rect_check.py my_data.run&lt;br /&gt;
&lt;br /&gt;
(Depending on stuff, you might need to invoke rect_check as:&lt;br /&gt;
 $MAS_PYTHON/rect_check.py&lt;br /&gt;
or even&lt;br /&gt;
 python $MAS_PYTHON/rect_check.py&lt;br /&gt;
Sorry.)&lt;br /&gt;
&lt;br /&gt;
The output looks like this:&lt;br /&gt;
&lt;br /&gt;
 MCE configuration:&lt;br /&gt;
  cc_rcs   ( cc, rcs_to_report_data ):     60&lt;br /&gt;
  cc_dec   ( cc, data_rate ):             256&lt;br /&gt;
  cc_nmux  ( cc, num_rows ):               33&lt;br /&gt;
  cc_cmux  ( cc, row_len ):               100&lt;br /&gt;
  cc_nr    ( cc, num_rows_reported ):      32&lt;br /&gt;
  cc_nc    ( cc, num_cols_reported ):       8&lt;br /&gt;
  rc_nmux  ( rca, num_rows ):              33&lt;br /&gt;
  rc_cmux  ( rca, row_len ):              100&lt;br /&gt;
  rc_nr    ( rca, num_rows_reported ):      1&lt;br /&gt;
  rc_nc    ( rca, num_cols_reported ):      1&lt;br /&gt;
  rc_r0    ( rca, readout_row_index ):      0&lt;br /&gt;
  rc_c0    ( rca, readout_col_index ):      0&lt;br /&gt;
 &lt;br /&gt;
 Framing:&lt;br /&gt;
  RC storage per mux cycle:                 1&lt;br /&gt;
  CC read-out per frame:                  256&lt;br /&gt;
  CC decimation:                          256&lt;br /&gt;
 &lt;br /&gt;
 Sanity Summary:&lt;br /&gt;
  Contiguous (for high-rate readout)?     yes&lt;br /&gt;
  Complete   (all-detector readout)?       no&lt;br /&gt;
  Bizarro    (a bad thing)?                no&lt;br /&gt;
  Bounded    (a good thing)?              yes&lt;br /&gt;
 &lt;br /&gt;
 Timing:&lt;br /&gt;
  Mux freq:                          15151.00&lt;br /&gt;
  Mean sampling freq:                15151.00&lt;br /&gt;
  Read-out freq:                        59.00&lt;br /&gt;
 &lt;br /&gt;
 Data volume:&lt;br /&gt;
  Frame size (bytes/RC):                 1200&lt;br /&gt;
  Data rate (MB/s/RC):                   0.07&lt;br /&gt;
&lt;br /&gt;
The program has notions of what is &amp;quot;reasonable&amp;quot;, and these are expressed in the lines &amp;quot;Contiguous?&amp;quot;, &amp;quot;Complete?&amp;quot;, &amp;quot;Bizarro?&amp;quot;, and &amp;quot;Bounded?&amp;quot;:&lt;br /&gt;
* 'Contiguous': all detectors that are read out will be read out at each multiplexing cycle&lt;br /&gt;
** When acquiring fast data from a subset of the detectors, at the multiplexing rate, you want &amp;quot;Contiguous = yes&amp;quot;.&lt;br /&gt;
* 'Complete': all detectors that are multiplexed will be read out&lt;br /&gt;
** When acquiring normal data, you probably want &amp;quot;Complete = yes&amp;quot;.&lt;br /&gt;
* 'Bizarro': the rectangle defined in the RC does not fit evenly into the readout frame.&lt;br /&gt;
** e.g. you have set up an 8x8 rectangle but you're reading CC frames that are 33x8.  Don't do this.  I'm not even sure what you'd get out.&lt;br /&gt;
* 'Bounded': the rectangle defined in the RC corresponds to detectors that are actually getting read/servoed.  This basically just checks that rc? readout_row_index makes any sense at all given num_rows and num_rows_reported.&lt;br /&gt;
** This must be &amp;quot;yes&amp;quot; or your data could be weird.&lt;br /&gt;
&lt;br /&gt;
Note that it is possible to be none of Complete, Contiguous, or Bizarro.  For example, you could read out the first 33 of every 66 multiplexing cycles for 8 detectors, packing them efficiently into a 33 x 8 read-out frame.  Maybe that should be called Bizarro.  But right now, it isn't.&lt;br /&gt;
&lt;br /&gt;
It is unlikely, but possible, to be both Contiguous and Complete.&lt;br /&gt;
&lt;br /&gt;
If you are Bizarro, you are neither Contiguous nor Complete.  See Euler diagram below.&lt;br /&gt;
&lt;br /&gt;
[[Image:reasonable_rectangles.png]]&lt;br /&gt;
&lt;br /&gt;
= Data acquisition =&lt;br /&gt;
&lt;br /&gt;
Use &amp;quot;mce_run&amp;quot; in the usual way to acquire data.  Note that the argument specifying the number of frames is always the number of 'read-out' frames, so for packed data the number of samples per detector will be higher.&lt;br /&gt;
&lt;br /&gt;
e.g. for the above configuration&lt;br /&gt;
 mce_run my_data 100 1&lt;br /&gt;
&lt;br /&gt;
would acquire 100 read-out frames.  Since the read-out frequency is 59 Hz, this would take about 2 seconds.  Each readout frame contains 8 x 32 = 256 data from a single detector.  So the resulting data stream contains 25600 samples.&lt;br /&gt;
&lt;br /&gt;
= Data file loading =&lt;br /&gt;
&lt;br /&gt;
Recent versions of mce_data.py can extract rectangle mode data from the packed frame structure.  E.g. for the above case, extracting the data is as easy as&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; d = MCEFile('my_data').Read()&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; d.data.shape&lt;br /&gt;
 (1, 25600)&lt;br /&gt;
&lt;br /&gt;
= Rather long explanation and justification of structure, from an e-mail =&lt;br /&gt;
&lt;br /&gt;
Yesterday Bryce and I were talking about paths towards a new rectangle readout mode.  The following is a recommendation for the rough structure of the system that I think will be easy to manage and provide a maximum flexibility for backwards compatibility and future expansion.&lt;br /&gt;
&lt;br /&gt;
The current rectangle mode is simpler than the planned one because the clock card and readout card need only agree on the number of data to readout, and no addditional waiting/synchronization is required between the clock card and readout card.  The readout frame data sizes, internally and externally, are the same for everyone.  The new mode is much more complex, because now the readout card has to accumulate several samples from each pixel into its internal buffer before sending the data to the clock card, and the clock card needs to ask for the right amount of data, which is probably some multiple of the rectangle size and is not necessarily a multiple of 8 or the number of multiplexing rows.&lt;br /&gt;
&lt;br /&gt;
Anyway, the point is that here is a simple and flexible way to parametrize the new mode parameters and manage synchronization, and to provide flexibility and backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
1.  The meaning of num_rows remains unchanged.  It will always be a multiplexing parameter that all cards need to agree on.&lt;br /&gt;
&lt;br /&gt;
2.  The readout card has parameters (prepend &amp;quot;readout_&amp;quot; to all of these, if you want) &amp;quot;row_index&amp;quot;, &amp;quot;num_rows&amp;quot;, &amp;quot;col_index&amp;quot;, &amp;quot;num_cols&amp;quot; that describe the rectangle of interest.&lt;br /&gt;
&lt;br /&gt;
3. The clock card is programmed with a pair of numbers &amp;quot;readout_mult1&amp;quot; and &amp;quot;readout_mult2&amp;quot;, that it uses to determine how many words of data to query the RCs for:&lt;br /&gt;
   N_data = readout_mult1 * readout_mult2.&lt;br /&gt;
These numbers are analagous to &amp;quot;num_rows_reported&amp;quot; and &amp;quot;num_cols_reported&amp;quot;, but the idea is to kill the idea of &amp;quot;rows&amp;quot; and &amp;quot;columns&amp;quot; in the readout frames because the payload size is not a simple product of n_rows * n_cols.  The clock card continues to support &amp;quot;data rate&amp;quot;, which indicates the period at which data queries are sent to the RCs.  Software will handle the details of getting these factors right.  Eventually we will only use one of mult?; the other is for backwards compat.&lt;br /&gt;
&lt;br /&gt;
4. In the RC: at each mux frame, data from the desired rectangle is copied into a large buffer.  The RC continues filling the buffer until the CC asks for data.  When RC receives a request for N data from the CC, it returns the first N data in the buffer, and resets its write index to the start of the buffer.  If the CC doesn't ask for data, and the RC buffer write index increments all the way past the end, the RC takes _no storage action_ in subsequent steps (i.e. it writes all new data to &amp;quot;/dev/null&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Setting up rectangle mode then proceeds as follows.  Suppose the RC buffer size is 1600 and I want to readout a 4 x 33 patch of the array:&lt;br /&gt;
&lt;br /&gt;
1.  Software computes that 4x33 = 132 words fits into 1600 about 12 times.  So it sets &amp;quot;cc data_rate&amp;quot; to 12, and the product of &amp;quot;mult1&amp;quot; and &amp;quot;mult2&amp;quot; to 12 * 132 = 1584.  It also sets the readout card row and col rectangle parameters.&lt;br /&gt;
&lt;br /&gt;
2.  Software triggers frame acquisition.  For the _first_ frame read out, the clock card and readout card may not be synchronized; i.e. the readout card's buffer almost certainly contains ancient, stale data.  So the first frame is discarded.  But since the first frame query sent the the buffer write index to 0, the data from subsequent frames is fresh and ordered.  Because the clock card is asking for N data at the same rate that the RC can N-fill the buffer, this results in a contiguous data stream.&lt;br /&gt;
&lt;br /&gt;
This scheme is simple because:&lt;br /&gt;
1. CC has only enough information to ask the readout cards for the right amount of data at the right times.&lt;br /&gt;
2. RC only needs to know the rectangle of interest, and it basically lets the CC manage the resetting of the buffer.&lt;br /&gt;
3. It is backwards-compatible with existing firmware; mult1 and mult2 can masquerade as num_rows_reported and &amp;quot;8&amp;quot; (num_cols_reported).&lt;br /&gt;
&lt;br /&gt;
The scheme minimizes the amount of information that must be shared between the RC and CC, which provides flexiblity.  With &amp;quot;mult&amp;quot; approach, the CC can remain truly ignorant as to what the RC is doing.  In this scheme I have emphasized the rectangle mode features, but I also envision it being useful in raw mode firmware, since a lot of the features (such as a large, flexible RAM block in the RC) would seem useful in that context.  (For raw mode you would need to add a lock to the buffer so that it could be read out with multiple queries.)&lt;br /&gt;
&lt;br /&gt;
= Script Differences Between v4.x.x and v5.x.x =&lt;br /&gt;
&lt;br /&gt;
This section describes the minimal configuration changes necessary to operate v5 firmware as though it were v4 firmware.  If you use MAS, then stop reading now.&lt;br /&gt;
 &lt;br /&gt;
The differences between basic frame setup in v4.x.x and v5.x.x are described here.  The data frame structure has been made more flexible.  A user can read out an arbitrarily rectangular patch of the array.  The patch-size is specified using new commands.&lt;br /&gt;
&lt;br /&gt;
*In v4.x.x: The array patch-size is flexible in terms of the number of rows, and the row start index.&lt;br /&gt;
  wb cc num_rows_reported 41     //power-on default = 41&lt;br /&gt;
  wb rcs readout_row_index 0     //power-on default = 0&lt;br /&gt;
&lt;br /&gt;
*In v5.x.x: The array patch-size is now also flexible in terms of the number of columns, and the column start index.  Note that matching parameters on the Readout Cards and the Clock Card must be consistent.&lt;br /&gt;
  wb cc num_rows_reported 41     //power-on default as above&lt;br /&gt;
  wb cc num_cols_reported 8      //power-on default = 8&lt;br /&gt;
  wb rcs num_rows_reported 41    //power-on default = 41&lt;br /&gt;
  wb rcs num_cols_reported 8     //power-on default = 8&lt;br /&gt;
  wb rcs readout_row_index 0     //power-on default as above&lt;br /&gt;
  wb rcs readout_col_index 0     //power-on default = 0&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Programming_over_Fibre&amp;diff=5504</id>
		<title>Programming over Fibre</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Programming_over_Fibre&amp;diff=5504"/>
		<updated>2013-01-30T22:58:45Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Update Firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hierarchy header}}&lt;br /&gt;
The procedure to update the [[MCE firmware]] over the fibre interface using a [[MAS]] PC, also known as &amp;quot;Remote Firmware Update&amp;quot;, is described here.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
Each of the Address Card, Bias Cards, and Readout Cards of the MCE has an Altera Stratix FPGA along with a configuration device ([[MCE FPGA Types | See here]]). The Clock Card, however, has one FPGA with two configuration devices. FPGAs are RAM-based devices while configuration devices are Flash-based devices. Upon power up, each FPGA is loaded from its respective configuration device. The Clock Card FPGA is loaded from its factory configuration device upon power up, but then later, the firmware in the application configuration device can be loaded into the FPGA by issuing a command, i.e.:&lt;br /&gt;
&lt;br /&gt;
 mce_cmd -x rs cc config_app 1&lt;br /&gt;
&lt;br /&gt;
All these programmable parts, with the exception of the factory configuration device, are on a continuous JTAG chain that can be controlled via the MCE front-panel connector with an attached USB-Blaster, ''or'' via the Clock Card FPGA, provided it is running the right firmware, and is driven through the fibre interface.&lt;br /&gt;
&lt;br /&gt;
The factory configuration device, however, is not on the same JTAG chain. It is only accessible through an on-board JTAG connector and can only be programmed with a USB-Blaster attached and Quartus Programmer.&lt;br /&gt;
&lt;br /&gt;
In order to load temporary firmware, an sof file can be loaded into the FPGA. This firmware will be lost upon power cycle. To load permanent firmware, a pof file (or a jic file depending on EPC16 or EPCS64) can be loaded.&lt;br /&gt;
&lt;br /&gt;
= Remote Update: step by step =&lt;br /&gt;
This can be done in 3 steps:&lt;br /&gt;
# Scan JTAG chain&lt;br /&gt;
# Generate JAM file&lt;br /&gt;
# Update Firmware&lt;br /&gt;
== Scan JTAG Chain ==&lt;br /&gt;
&lt;br /&gt;
Run '''mce_auto_detect''':&lt;br /&gt;
 user@ubuntu:~$ mce_auto_detect&lt;br /&gt;
 mce_scan version 1&lt;br /&gt;
 card_scan&lt;br /&gt;
 #   card  card_id    card_type  pcb_rev    slot_id&lt;br /&gt;
       2 0x124fb77         3         0         8&lt;br /&gt;
       3 0x19c74de         2         0         4&lt;br /&gt;
       4 0x1256aa5         2         0         5&lt;br /&gt;
       7 0x19c0a93         1         6         1&lt;br /&gt;
       8 0x19c3071         1         6         2&lt;br /&gt;
       9 0x19c1455         1         6         3&lt;br /&gt;
      10 0x19c6305         0         0         0&lt;br /&gt;
 jtag_scan&lt;br /&gt;
 # id device&lt;br /&gt;
   1 EPC4/EPC8/EPC16&lt;br /&gt;
   2 EP1S40&lt;br /&gt;
   3 EPC4/EPC8/EPC16&lt;br /&gt;
   4 EP1S40&lt;br /&gt;
   5 EPC4/EPC8/EPC16&lt;br /&gt;
   6 EP1S10&lt;br /&gt;
   7 EPC4/EPC8/EPC16&lt;br /&gt;
   8 EP1S10&lt;br /&gt;
   9 EPC4/EPC8/EPC16&lt;br /&gt;
   10 EP1S10&lt;br /&gt;
   11 EPC4/EPC8/EPC16&lt;br /&gt;
   12 EP1S10&lt;br /&gt;
   13 EPC4/EPC8/EPC16&lt;br /&gt;
&lt;br /&gt;
Note that the order of devices are cc (#1), rc2 (device #2, #3), rc1(#4, #5), bc3 (#6, #7), bc2(#8, #9), bc1(#10, #11), ac(#12, #13). &lt;br /&gt;
&lt;br /&gt;
Device #1 refers to the Application configuration device on Clock Card.&lt;br /&gt;
&lt;br /&gt;
If there are no devices listed below &amp;quot;jtag_scan&amp;quot;, you probably have to flip a jumper on your clock card.  See the section below on [[ #Hardware Requirements ]].&lt;br /&gt;
&lt;br /&gt;
== Generate Jam File ==&lt;br /&gt;
You need to update firmware on one device type at a time, i.e., EPC only, or FPGA only, or EPCS64 only.&lt;br /&gt;
&lt;br /&gt;
'''If you have access to internet:'''&lt;br /&gt;
# Go to MCE Firmware Canning Party webpage: http://e-mode.phas.ubc.ca/mcefcp/&lt;br /&gt;
# copy and paste the result of mce_auto_detect on that webpage. &lt;br /&gt;
# Choose the target device(s) you want to program and a drop down menu of available firmware revisions will appear.&lt;br /&gt;
# Choose the firmware revision and click generate.&lt;br /&gt;
# Save the generated file somewhere on your mas PC.&lt;br /&gt;
&lt;br /&gt;
'''If you do NOT have access to internet:'''&lt;br /&gt;
# Install Quartus II Web Edition on Linux [[Quartus II Installation | See Instructions here]]&lt;br /&gt;
# make a cdf file from the output of mce_auto_detect. Here is a sample cdf file [http://www.phas.ubc.ca/~mce/mcedocs/software/sample.cdf CDF]&lt;br /&gt;
# generate a jam file by typing: &lt;br /&gt;
  quartus_cpf -c &amp;lt;cdf_file_name&amp;gt; &amp;lt;jamfilename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update Firmware== &lt;br /&gt;
&lt;br /&gt;
Run '''mce_fw_update''':&lt;br /&gt;
 Usage:   /usr/mce/mce_script/script/mce_fw_update &amp;lt;device&amp;gt; &amp;lt;jamfilename&amp;gt; &lt;br /&gt;
   device        one of:&lt;br /&gt;
           FPGA:   for temporary firmware (sof)&lt;br /&gt;
           EPC16:  for permanent firmware on any card other than RC Rev. E (pof)&lt;br /&gt;
           EPCS64: for permanent firmware on RC Rev. E (jic)&lt;br /&gt;
   jamfilename   either an absolute pathname, or a file in $MCE_JAM_DIR&lt;br /&gt;
&lt;br /&gt;
If you are programming FPGA parts (temporary firmware), this step takes seconds. However, it takes minutes to program permanent firmware into EPC16 or EPCS64 devices, e.g. '''13 minutes''' to program 2 rev F. Readout Cards.&lt;br /&gt;
&lt;br /&gt;
If the programming fails, you might need to mess with the programming frequencies.  These are passed to mce_jam via the -f flag, as frequencies in Hz.  See the mce_fw_update script, and try decreasing the frequency by a factor of 10.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting Remote Update =&lt;br /&gt;
== Software Requirements ==&lt;br /&gt;
Make sure the following are installed.  &lt;br /&gt;
From the MAS repository:&lt;br /&gt;
* mce_jam : This will be installed under /usr/mce/bin/.&lt;br /&gt;
From the MCE script repository (trunk):&lt;br /&gt;
* read_idcode.jam : This should be in $MAS_TEMPLATE directory.&lt;br /&gt;
* $MCE_JAM_DIR is set : This is set through mas_env.bash.&lt;br /&gt;
* mce_auto_detect (in mce_script directory)&lt;br /&gt;
* mce_fw_update (in mce_script directory)&lt;br /&gt;
== Firmware Requirements ==&lt;br /&gt;
The Clock Card FPGA has to run firmware revision 5.0.7 or later. Considering that Clock Card FPGA can be loaded through either the Factory or Application configuration devices, at least one of these need to have 5.0.7+ firmware. If you are running Clock Card firmware prior to 5.0.7, which means your factory configuration device is loaded with firmware prior to 5.0.7, then attach USB-Blaster to the MCE front-panel connector. Run Quaruts Programmer, click on auto-detect, and program the second part from the bottom of the list, EPC16, with Clock Card firmware 5.0.7+.pof.&lt;br /&gt;
&lt;br /&gt;
Then issue the following command:&lt;br /&gt;
 mce_cmd -x rs cc config_app 1&lt;br /&gt;
to switch to the new firmware.  (Read back the firmware revision to make sure the new firmware is now active.)&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
The buffer that controls whether the FPGA can drive the JTAG chain or not is controlled by BB_EN or SW1 dip switch setting on the Clock Card. Clock Cards shipped earlier than Dec. 2010, do not have the right settings. To check this setting on your Clock Card, turn off the MCE power and unplug the Clock Card. The SW1.P1 labeled as &amp;quot;BB_EN&amp;quot; DIP should be on OPEN position. &lt;br /&gt;
&lt;br /&gt;
* Note that with DIP switch SW1.P1 set to OPEN, you can not program the FPGA(sof) from the front panel connector (USB_Blaster) anymore.&lt;br /&gt;
* With DIP switch set to OPEN, if CC firmware is pre-5.0.7, you can not access the JTAG chain from the front panel connector (USB_Blaster) anymore. Assuming you have 5.0.7+ in your configuration device, you need to issue: &amp;lt;code&amp;gt;mce_cmd -x rs cc config_app 1&amp;lt;/code&amp;gt; to be able to access front-panel JTAG.&lt;br /&gt;
&lt;br /&gt;
= Footnotes =&lt;br /&gt;
== Porting Remote Configuration Sofware to DAS ==&lt;br /&gt;
The following C-code will need to be ported to DAS to enable Remote Configuration.  You will need to convert the MCE WB and RB commands in the code to use DAS libraries and compile the code with the included Makefile:  &lt;br /&gt;
*[http://www.phas.ubc.ca/~mce/mcedocs/software/mce_jam/ MCE Jam Player -- SVN revision 16 (~/jp_25/mce_jam/trunk)].&lt;br /&gt;
** '''jam_mce.c''': contains low-level MCE routines used during programming&lt;br /&gt;
** all other files should be fine.&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
* [[intmce:Remote Firmware Update]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
	<entry>
		<id>https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Programming_over_Fibre&amp;diff=5503</id>
		<title>Programming over Fibre</title>
		<link rel="alternate" type="text/html" href="https://e-mode.phas.ubc.ca/mcewiki/index.php?title=Programming_over_Fibre&amp;diff=5503"/>
		<updated>2013-01-30T22:55:10Z</updated>

		<summary type="html">&lt;p&gt;Mhasse: /* Generate Jam File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hierarchy header}}&lt;br /&gt;
The procedure to update the [[MCE firmware]] over the fibre interface using a [[MAS]] PC, also known as &amp;quot;Remote Firmware Update&amp;quot;, is described here.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
Each of the Address Card, Bias Cards, and Readout Cards of the MCE has an Altera Stratix FPGA along with a configuration device ([[MCE FPGA Types | See here]]). The Clock Card, however, has one FPGA with two configuration devices. FPGAs are RAM-based devices while configuration devices are Flash-based devices. Upon power up, each FPGA is loaded from its respective configuration device. The Clock Card FPGA is loaded from its factory configuration device upon power up, but then later, the firmware in the application configuration device can be loaded into the FPGA by issuing a command, i.e.:&lt;br /&gt;
&lt;br /&gt;
 mce_cmd -x rs cc config_app 1&lt;br /&gt;
&lt;br /&gt;
All these programmable parts, with the exception of the factory configuration device, are on a continuous JTAG chain that can be controlled via the MCE front-panel connector with an attached USB-Blaster, ''or'' via the Clock Card FPGA, provided it is running the right firmware, and is driven through the fibre interface.&lt;br /&gt;
&lt;br /&gt;
The factory configuration device, however, is not on the same JTAG chain. It is only accessible through an on-board JTAG connector and can only be programmed with a USB-Blaster attached and Quartus Programmer.&lt;br /&gt;
&lt;br /&gt;
In order to load temporary firmware, an sof file can be loaded into the FPGA. This firmware will be lost upon power cycle. To load permanent firmware, a pof file (or a jic file depending on EPC16 or EPCS64) can be loaded.&lt;br /&gt;
&lt;br /&gt;
= Remote Update: step by step =&lt;br /&gt;
This can be done in 3 steps:&lt;br /&gt;
# Scan JTAG chain&lt;br /&gt;
# Generate JAM file&lt;br /&gt;
# Update Firmware&lt;br /&gt;
== Scan JTAG Chain ==&lt;br /&gt;
&lt;br /&gt;
Run '''mce_auto_detect''':&lt;br /&gt;
 user@ubuntu:~$ mce_auto_detect&lt;br /&gt;
 mce_scan version 1&lt;br /&gt;
 card_scan&lt;br /&gt;
 #   card  card_id    card_type  pcb_rev    slot_id&lt;br /&gt;
       2 0x124fb77         3         0         8&lt;br /&gt;
       3 0x19c74de         2         0         4&lt;br /&gt;
       4 0x1256aa5         2         0         5&lt;br /&gt;
       7 0x19c0a93         1         6         1&lt;br /&gt;
       8 0x19c3071         1         6         2&lt;br /&gt;
       9 0x19c1455         1         6         3&lt;br /&gt;
      10 0x19c6305         0         0         0&lt;br /&gt;
 jtag_scan&lt;br /&gt;
 # id device&lt;br /&gt;
   1 EPC4/EPC8/EPC16&lt;br /&gt;
   2 EP1S40&lt;br /&gt;
   3 EPC4/EPC8/EPC16&lt;br /&gt;
   4 EP1S40&lt;br /&gt;
   5 EPC4/EPC8/EPC16&lt;br /&gt;
   6 EP1S10&lt;br /&gt;
   7 EPC4/EPC8/EPC16&lt;br /&gt;
   8 EP1S10&lt;br /&gt;
   9 EPC4/EPC8/EPC16&lt;br /&gt;
   10 EP1S10&lt;br /&gt;
   11 EPC4/EPC8/EPC16&lt;br /&gt;
   12 EP1S10&lt;br /&gt;
   13 EPC4/EPC8/EPC16&lt;br /&gt;
&lt;br /&gt;
Note that the order of devices are cc (#1), rc2 (device #2, #3), rc1(#4, #5), bc3 (#6, #7), bc2(#8, #9), bc1(#10, #11), ac(#12, #13). &lt;br /&gt;
&lt;br /&gt;
Device #1 refers to the Application configuration device on Clock Card.&lt;br /&gt;
&lt;br /&gt;
If there are no devices listed below &amp;quot;jtag_scan&amp;quot;, you probably have to flip a jumper on your clock card.  See the section below on [[ #Hardware Requirements ]].&lt;br /&gt;
&lt;br /&gt;
== Generate Jam File ==&lt;br /&gt;
You need to update firmware on one device type at a time, i.e., EPC only, or FPGA only, or EPCS64 only.&lt;br /&gt;
&lt;br /&gt;
'''If you have access to internet:'''&lt;br /&gt;
# Go to MCE Firmware Canning Party webpage: http://e-mode.phas.ubc.ca/mcefcp/&lt;br /&gt;
# copy and paste the result of mce_auto_detect on that webpage. &lt;br /&gt;
# Choose the target device(s) you want to program and a drop down menu of available firmware revisions will appear.&lt;br /&gt;
# Choose the firmware revision and click generate.&lt;br /&gt;
# Save the generated file somewhere on your mas PC.&lt;br /&gt;
&lt;br /&gt;
'''If you do NOT have access to internet:'''&lt;br /&gt;
# Install Quartus II Web Edition on Linux [[Quartus II Installation | See Instructions here]]&lt;br /&gt;
# make a cdf file from the output of mce_auto_detect. Here is a sample cdf file [http://www.phas.ubc.ca/~mce/mcedocs/software/sample.cdf CDF]&lt;br /&gt;
# generate a jam file by typing: &lt;br /&gt;
  quartus_cpf -c &amp;lt;cdf_file_name&amp;gt; &amp;lt;jamfilename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update Firmware== &lt;br /&gt;
run '''mce_fw_update''':&lt;br /&gt;
Usage:   mce_fw_update &amp;lt;device&amp;gt; &amp;lt;jamfilename&amp;gt;&lt;br /&gt;
  device        FPGA, EPC16, or EPCS64&lt;br /&gt;
                     - FPGA for temporary firmware (sof)&lt;br /&gt;
                     - EPC16 for permanent firmware on any card other than RC Rev. E (pof)&lt;br /&gt;
                     - EPCS64 for permanent firmware on RC Rev. E (jic)&lt;br /&gt;
  jamfilename   filename&lt;br /&gt;
                     - file needs to be located in $MCE_JAM_DIR&lt;br /&gt;
&lt;br /&gt;
If you are programming FPGA parts (temporary firmware), this step takes seconds. However, it takes minutes to program permanent firmware into EPC16 or EPCS64 devices, e.g. '''13 minutes''' to program 2 rev F. Readout Cards.&lt;br /&gt;
&lt;br /&gt;
If the programming fails, you might need to mess with the programming frequencies.  These are passed to mce_jam via the -f flag, as frequencies in Hz.  See the mce_fw_update script, and try decreasing the frequency by a factor of 10.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting Remote Update =&lt;br /&gt;
== Software Requirements ==&lt;br /&gt;
Make sure the following are installed.  &lt;br /&gt;
From the MAS repository:&lt;br /&gt;
* mce_jam : This will be installed under /usr/mce/bin/.&lt;br /&gt;
From the MCE script repository (trunk):&lt;br /&gt;
* read_idcode.jam : This should be in $MAS_TEMPLATE directory.&lt;br /&gt;
* $MCE_JAM_DIR is set : This is set through mas_env.bash.&lt;br /&gt;
* mce_auto_detect (in mce_script directory)&lt;br /&gt;
* mce_fw_update (in mce_script directory)&lt;br /&gt;
== Firmware Requirements ==&lt;br /&gt;
The Clock Card FPGA has to run firmware revision 5.0.7 or later. Considering that Clock Card FPGA can be loaded through either the Factory or Application configuration devices, at least one of these need to have 5.0.7+ firmware. If you are running Clock Card firmware prior to 5.0.7, which means your factory configuration device is loaded with firmware prior to 5.0.7, then attach USB-Blaster to the MCE front-panel connector. Run Quaruts Programmer, click on auto-detect, and program the second part from the bottom of the list, EPC16, with Clock Card firmware 5.0.7+.pof.&lt;br /&gt;
&lt;br /&gt;
Then issue the following command:&lt;br /&gt;
 mce_cmd -x rs cc config_app 1&lt;br /&gt;
to switch to the new firmware.  (Read back the firmware revision to make sure the new firmware is now active.)&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
The buffer that controls whether the FPGA can drive the JTAG chain or not is controlled by BB_EN or SW1 dip switch setting on the Clock Card. Clock Cards shipped earlier than Dec. 2010, do not have the right settings. To check this setting on your Clock Card, turn off the MCE power and unplug the Clock Card. The SW1.P1 labeled as &amp;quot;BB_EN&amp;quot; DIP should be on OPEN position. &lt;br /&gt;
&lt;br /&gt;
* Note that with DIP switch SW1.P1 set to OPEN, you can not program the FPGA(sof) from the front panel connector (USB_Blaster) anymore.&lt;br /&gt;
* With DIP switch set to OPEN, if CC firmware is pre-5.0.7, you can not access the JTAG chain from the front panel connector (USB_Blaster) anymore. Assuming you have 5.0.7+ in your configuration device, you need to issue: &amp;lt;code&amp;gt;mce_cmd -x rs cc config_app 1&amp;lt;/code&amp;gt; to be able to access front-panel JTAG.&lt;br /&gt;
&lt;br /&gt;
= Footnotes =&lt;br /&gt;
== Porting Remote Configuration Sofware to DAS ==&lt;br /&gt;
The following C-code will need to be ported to DAS to enable Remote Configuration.  You will need to convert the MCE WB and RB commands in the code to use DAS libraries and compile the code with the included Makefile:  &lt;br /&gt;
*[http://www.phas.ubc.ca/~mce/mcedocs/software/mce_jam/ MCE Jam Player -- SVN revision 16 (~/jp_25/mce_jam/trunk)].&lt;br /&gt;
** '''jam_mce.c''': contains low-level MCE routines used during programming&lt;br /&gt;
** all other files should be fine.&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
* [[intmce:Remote Firmware Update]]&lt;/div&gt;</summary>
		<author><name>Mhasse</name></author>
		
	</entry>
</feed>