irena-arm/flash_erena
wallmann 0c2492d681 updated flash_erena to FANS flight configuration and removed unnecessary code from erena.py
git-svn-id: svn+ssh://asterix.ieap.uni-kiel.de/home/subversion/stephan/solo/eda/arm@8267 bc5caf13-1734-44f8-af43-603852e9ee25
2021-08-06 12:25:26 +00:00
..
ASCENT.SPY erene flash debugged 2020-07-12 11:31:26 +00:00
CRON.RC updated flash_erena to FANS flight configuration and removed unnecessary code from erena.py 2021-08-06 12:25:26 +00:00
CRONFLY.RC updated flash_erena to FANS flight configuration and removed unnecessary code from erena.py 2021-08-06 12:25:26 +00:00
DESCENT.SPY erene flash debugged 2020-07-12 11:31:26 +00:00
ERENA.RBF flash_erena: new bitfiles 2019-10-15 18:53:24 +00:00
ERENA.RC FANS erena flash flight scripte 2020-07-08 21:15:13 +00:00
ESC40104.RBF FANS FPGA bitfile w/ pulse generator 2020-07-08 21:15:58 +00:00
ETH.RC flash_erena: sc scripte 2019-10-09 14:55:11 +00:00
HVINIT.RC FANS erena flash flight scripte 2020-07-08 21:15:13 +00:00
HVRAMP.RC FANS erena flash flight scripte 2020-07-08 21:15:13 +00:00
INIT.RC erena/INIT: raise verbosity of CRON 2020-09-01 12:24:59 +00:00
MEASURE.RC FANS erena flash flight scripte 2020-07-08 21:15:13 +00:00
MICROSD.RC FANS erena flash flight scripte 2020-07-08 21:15:13 +00:00
PRESSURE.RC erene flash debugged 2020-07-12 11:31:26 +00:00
PULSER.RC updated flash_erena to FANS flight configuration and removed unnecessary code from erena.py 2021-08-06 12:25:26 +00:00
readme.md flash_erene doc readme.md 2020-07-08 22:38:05 +00:00
README.TXT FANS erena flash flight scripte 2020-07-08 21:15:13 +00:00
TWOSTEP.RC updated flash_erena to FANS flight configuration and removed unnecessary code from erena.py 2021-08-06 12:25:26 +00:00
UDP.RC FANS erena flash flight scripte 2020-07-08 21:15:13 +00:00

README.TXT

FAT12 1MByte Filesystem for Erena

INIT.RC script loaded at startup ERENA.RBF FPGA bitfile full 2-channel ESC40104.RBF FPGA bitfile 40MHz, 1ch, 4-depth, w/ nm64__prim ERENA.RC erena settings TWOSTEP.RC epipe configuration HVINIT.RC setup PMT HV HVRAMP.RC ramp PMT HV one step PULSER.RC configure the pulse generator

MEASURE.RC start flight measurement PRESSURE.RC configure the pressure spy ASCENT.SPY pressure/spy script for ascent DESCENT.SPY pressure/spy script for descent

CRON.RC nonflight cron script CRONFLY.RC flight cron script

ETH.RC ethernet interface settings UDP.RC configure/reset ethernet for flight data stream MICROSD.RC configure/reset µSD-card for flight data stream

Global Variables

F=(0,1,2,3) flight phase (idle,ascent,descent,landing) R=-1 target udp_size H target HV setting 0…15888 A current HV setting B=794 HV step/second, 100V/s S second of the minute U UDP commands received V time of last UDP command

INIT.RC

@sleep 1 @var/set verb=3 sd/init @var/set dac = 0x1ffff altera/file "ESC40104.RBF" @s/if errno>=500: s/exit @s/exe "ETH.RC" @s/exe "ERENA.RC" @sleep 10 @s/if usb: s/exit @s/exe "MEASURE.RC"

  • Load the bitfile for 40MHz, 1 channel, 4-deep epipe.
  • Configure the ethernet chip.
  • Configure the epipe.
  • Wait 10 seconds, idf no USB host connects, start flight measurement.

ETH.RC

eth/source/ip 172.16.18.113 eth/dest/str/mac/ip/port 18:31:bf:df:0c:34 172.16.18.114 1112 @eth/dest/mes/mac/ip/port 18:31:bf:df:0c:34 172.16.18.114 1113 @eth/init @s/if errno>=500: s/exit @var/set eth_verbosity = 4 @var/set udp_command_port = 1111 eth/rxen enable

  • The network 172.16.18.0/24 is what we usually get for BEUS campains.
  • eth/dest/.. must be mac and ip of the controlling laptop.
  • Enable command reception on port 1111. The receiver function of the chip must be enabled as well.

ERENA.RC

echo ERENA.RC for ESC40104 Revision: 8075 alt/cmd/delay[12] 0x1001 alt/cmd/delay[12] 0x1002 @echo altera/reg 0x1014 0x20 @ ADC_OUTPUT @echo altera/reg 0x10ff 0x01 @ ADC_TRANS @script/exec "TWOSTEP.RC" @script/exec "PULSER.RC" @script/exec "HVINIT.RC"

  • Read the ADC ID.
  • Do not reconfigure ADC outputs !?
  • Configure the epipe.
  • Configure the pulser.
  • Configure the PMT HV ramp.

PULSER.RC

@altera/reg 0x089e 0x0041

The Address for the epulser is 0x089e. Without parameter: emit a pulse.

  • bits [2:0] ON value,
  • bits [5:3] OFF value,
  • bits [14:6] pulse length in units of 25ns,
  • bit [15] Emit a pulse right away.

HVINIT.RC

var H = 1000 *15888/2000 var B = 100 *15888/2000

  • DAC setting H=15888 is 5V => 2000V
  • var B is the ramp step, per second.

HVRAMP.RC

@s/if H==A: s/exit @var $A=H-A @s/if A > H and A > H+B: var $A= -B @s/if A < H and A+B < H: var $A= B @var A=A+$A nm/dac/i=0 A+0x8000

  • Ramp A towards H in steps of B
  • Use unsigned math for the comparissons!
  • $A is a local variable
  • The DAC setting for 0V is 0x8000
  • Actually, the 0V value is the setting of DAC H [7].

CRON.RC

@clock @v S = time % 60 @s/if H != A: s/exec "HVRAMP.RC" @s/if S % 2: pressure/inject; s/exit @s/if S==0: al/reg/inj 0x889e; s/exit @s/if S==4: nm/adc/read

  • Call HV ramp when required.
  • Read pressure sensor every odd second
  • Emit test pulse in second 0
  • Read ADCs in second 4

MEASURE.RC

@s/exe "PRESSURE.RC" var/set spi_min_qtime = 665 @var/set udp_reset = 1000000 @al/fifo/clear 1 @al/fifo/set 8 @al/fifo/reset 0x1f0 @var/set sd_write_size = 0 @v/set sd_write_count = 0 @v/set udp_count = 0 @v/set udp_size = 0 @v/set R=-1 @script/cron/none script/cron "CRONFLY.RC" @s/exe "MICROSD.RC" @s/exe "UDP.RC" alt/stream/spi/hk/fifos

  • Configure the pressure spy
  • allow 50 data packets per second. 665 qticks = 20ms between packets.
  • Clear µSD and UDP stream. Those will get activated below.
  • var R=-1 is the target value for udp_size.
  • Start the flight CRON script.
  • Start streaming to µSD-card.
  • Start streaming via UDP.
  • Enable FPGA streaming to the mainloop (spi), without destinations.

MICROSD.RC

@s/if F>=3: s/exit @var/set sd_size=0 @sd/init sd/csd @s/if errno >= 500: sd/csd @s/if errno >= 500: s/exit @sd/find @s/if errno>500: sd/find @s/if errno>500: s/exit var/set sd_write_ptr = sd_free @var/set sd_write_size = sd_size - sd_write_ptr

  • In flight phase F=3, "LANDING" do not restart µSD writing.
  • Initialize SD card, two attempts each step.
  • Enable writing to the remaining space.

UDP.RC

eth/init @s/if enc==3: eth/rx/en @s/if enc==7: var/set udp_size=R

  • Initialize the ethernet chip.
  • If successful, enable the receiver.
  • If successful, enable streaming via UDP.

PRESSURE.RC

pressure/read @echo s/if bate_cal!=0x1e58bae1: s/exit pressure/spy/on @var/set F=1 script/spy "ASCENT.SPY" @var/set script_cron_prio=3

  • Read the pressure sensor.
  • DO NOT verify the identity of the sensor (needs update of the constant).
  • Enable the pressure spy.
  • Connect the spy to script "ASCENT.SPY", to be called when a pressure reading is found in a data block.

ASCENT.SPY

@s/if pressure>2000: s/exit @s/if temperature>6000: s/exit @s/if temperature<1000: s/exit @e/info "ASCENTED p=", pressure/10 script/spy "DESCENT.SPY" @var/set F=2

The pressure spy leaves the reading results in variables. When the pressure dropped below 200mbar, and the temperature readings are plausible, switch to DESCENT phase, F=2.

DESCENT.SPY

@s/if pressure<8000: s/exit @s/if pressure>11000: s/exit @s/if temperature>5000: s/exit @s/if temperature<1000: s/exit @echo pressure/spy/off script/spy/none @e/info "DECENTED p=", pressure/10 @var F=3 @var H=0 @var sd_write_size = 20 @alt/fifo/inject/clear 1

If the pressure rose above 800mbar, and the temperature readings are plausible,

  • turn off the pressure spy and spy script,
  • ramp down the PMT HV to H=0,
  • write 20 more data blocks to the µSD card, then stop,
  • turn off the epipe (clear master control bit [0]).

CRONFLY.RC

@clock @v S = time % 60 @s/if H != A: s/exec "HVRAMP.RC" @s/if S % 2: pressure/inject; s/exit @s/if S==0: al/reg/inj 0x889e; s/exit @s/if S==4: nm/adc/read @s/if S != 58: s/exit @s/if sd_status & 0xc00: var sd_write_size=0 @s/if ! sd_write_size: s/exe "MICROSD.RC" @s/if ! udp_rx_cmd: var udp_size=0 @s/if udp_rx_cmd > U: var V=time @var U=udp_rx_cmd @s/if V+600 < time: var udp_size=0 @s/if enc==3: eth/rx/en @s/if enc!=7: var udp_size=0 @s/if udp_size: s/exit @s/exe "UDP.RC" @var V=time @var U=udp_rx_cmd

This is executed once per second. Same as CRON.RC, and, once per minute in second 58, do

  • if the µSD-card has an error status, reset it,
  • if we never got any command via UDP, reset the ethernet chip,
  • if the last UDB command was received more then 10 minutes ago, reset the ethernet chip,
  • if the ethernet chip is not up, reset it.

TWOSTEP.RC

too long.