WhizniumSBE And WhizniumDBE

2y ago
10 Views
2 Downloads
1.39 MB
10 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Mara Blakely
Transcription

WhizniumSBE and WhizniumDBEMPSI Technologies Modular Vision DemonstratorThermal Imager Data PathA code walkthroughSeptember 19, 2018Alexander Wirthmülleraw@mpsitech.comMPSI Technologies GmbHFOR INTERNAL USE

OVERVIEW. 31 FLIR LEPTON3 MODULE . 42 ZYNQ PL / FPGA MULTISPECTRALDETECTORDEVICE RTL CODE . 43 ZYNQ PS / EMBEDDED LINUX MULTISPECTRALDETECTORDEVICE C LIBRARY . 64 ZYNQ PS / EMBEDDED LINUX MULTISPECTRALDETECTORCONTROL ENGINE . 75 CLIENT WEB-BROWSER MULTISPECTRALDETECTORCONTROL WEB-BASED UI . 9This document is copyrighted and confidential material owned by MPSI Technologies GmbH,Munich/Germany.2

OverviewThis code walkthrough offers a basic understanding of embedded data processing using acombined WhizniumDBE and WhizniumSBE project of moderate complexity as an example.The presented use case follows the data path of thermal images from their origin, a FLIRLepton3 thermal imager, via FPGA-based read-out and Embedded Linux executable to aclient's web-browser, see Figure 1.Figure 1: Five-step data path.In order to follow this guide, it is suggested to download/clone the following repositoriesfrom the MPSI Technologies GitHub account: 1MultiSpectralDetectorDevice: modular vision demonstrator FPGA sub-system torControldbecore: WhizniumDBE core library1 tectorControl: modular vision demonstrator Embedded Linux torDevicesbecore: WhizniumSBE core library1 https://github.com/mpsitech/sbecoredbecore and sbecore are suggested to follow the inline “excursions”3

1 FLIR Lepton3 moduleWithin the 160x120 pixel FLIR Lepton3 thermal imager module, frame data is produced at arate of 9fps. After module initialization via I2C, it is provided as a steady stream through aSPI interface.This manufacturer datasheet provides details: ocument/flir-lepton-engineering-datasheet.pdfReset and master clock signals along with both serial interfaces are routed via customhardware to a commercial Zynq evaluation board (“Zedboard”), where they end up atsuitable FPGA I/O pads ; the hardware signals are detailed in Figure 2.Lepton3 pinRESET LMASTER CLKFPGA padnirst (N17)imclk (P21)purposeFPGA - FLIR resetFPGA - FLIR 25MHz clockI2C 2-wire interface, “fast” mode 400kbpsLepton3 pinFPGA padpurposeSCLiscl (L17)FPGA - FLIR clockSDAisda (M17)bi-directional push-pull dataSPI 3-wire interface, CPOL 1, CPHA 1, 12.5MHzLepton3 pinFPGA padpurposeSPI CS Lniss (N18)FPGA - FLIR chip selectSPI CLKisck (P20)FPGA - FLIR clockSPI MISOirxd (T19)FLIR - FPGA dataFigure 2: Lepton3 hardware signals and their connections to the FPGA2 Zynq PL / FPGA MultiSpectralDetectorDevice RTL codeLepton3 configurationFile: e main operation (op) FSM reacts to the command invocation setRng(rng tru8) in itsstates stateOpInit/Inv using the host interface handshake ports req/ackInvSetRng.A five second initialization time span, required by the Lepton3 module when coming out ofreset with its master clock applied, is implemented using the unit’s 10kHz signal tkclk(stateOpStartA/B).Every five seconds, the Lepton3 read commands getSerno, getPartno, getAuxtemp,getFpatemp and getStats (sequence in stateOpLoopCmd) are triggered through the I2C4

interface. Each read represents a 6-byte transfer in which one 16-bit data word is read fromthe module.First the transfer length is transmitted to the Lepton3 module in stateOpSetLenA/B,followed by the command’s base address in stateOpSetCmdA/B. If no module error isencountered, all bytes are burst-read in states stateOpReadA/B.Each I2C transfer is activated using the combinatorial stateOp-dependent signal reqI2c.File: fer operation (xfer) FSM.Frame acquisitionFile: ain operation (op) FSM loops over segments and packets, filling ping-pong (A/B) buffer.{a/b}buf mutex management (buf) FSM takes care of A/B full/clear logic. {a/b}buf B/hostiffacing operation (bufB) FSM is used to output the correct data to the host interface.File: MultiSpectralDetectorDevice/msdd/zedb/Spimaster v1 0.vhdTransfer operation (xfer) FSM. Strobe for every byte received.File: MultiSpectralDetectorDevice/msdd/zedb/Dpbram v1 0 size38kB2x dual-port RAM connected to host interface.Host interfaceFile: and set constant definitions. Relevant for example:tixVControllerLwiracq/Lwirif, tixVLwiracqCommandSetRng,tixVLwiracqCommandGetInfo (status : in operation (op) FSM allows various types of transfers:stateOpRxop - stateOpRx - stateOpTxack:command with non-empty invocation parametersstateOpRxop - stateOpTx:command with non-empty return parametersstateOpRxop - stateOpRxbuf - stateOpTxack:buffer transfer host to FPGAstateOpRxop - stateOpTxbuf:buffer transfer FPGA to hostFile: MultiSpectralDetectorDevice/msdd/zedb/Crc8005 v1 0.vhd5

On-the-fly byte-wise CRC calculation in one clock cycle.File: MultiSpectralDetectorDevice/msdd/zedb/Axirx v1 0.vhd, Axitx v1 0.vhdAXI interconnect reacting to transfers initiated by the host (RX and TX) ; signals enRx, rx,strbRx, enTx, strbTx generated from original bus signals in wrapper moduleZedb ip v1 0 S00 AXI.vhd.3 Zynq PS / Embedded Linux MultiSpectralDetectorDevice C libraryStatus pollingFile: db/zedb/CtrMsddZedbLwiracq.cppAfter starting the acquisition using void setRng(const bool rng), the method voidgetInfo(utinyint& tixVBufstate, uint& tkst, usmallint& min,usmallint& max)- return parameters only, is invoked until the buffer statetixVBufstate (vector declaration in CtrMsddZedbLwiracq.h, VecVBufstate) reachesabuf or bbuf. At this time, tkst/min/max contain the frame metadata (10kHz clock timestamp, min/max values), and the frame data is available for buffer transfer.File: db/zedb/UntMsddZedb.cppByte-level command and buffer transfer communication is handled in rx(unsignedchar* buf, const size t buflen) and tx(unsigned char* buf, constsize t buflen). The AXI interconnect is a Unix character device, allowing the use ofstandard read() / write() methods.Excursion: Invocation parameters to byte sequenceFiles: dbecore/Cmd.cpp, dbecore/Par.cppCmd::parsInvToBuf(unsigned char** buf, size t& buflen) andPar::parsToBuf(map string,Par & pars, vector string & seqPars,unsigned char** buf, size t& buflen).Buffer transferFile: db/zedb/UntMsddZedb.cppA frame comprises 38400 data bytes, which are followed by 2 CRC bytes in a single readtransfer. The buffer transfer is initiated by a call to voidread{Abuf/Bbuf}FromLwiracq(const size t reqlen, unsigned char*&data, size t& datalen) which in turn calls File: MultiSpectralDetectorDevice/msdd/devmsdd/Msdd.cpp6

bool runBufxf(Bufxf* bufxf) and bool runBufxfFromBuf(Bufxf* bufxf).Memory allocation can be internal or external. Notably, on read operations from the FPGAsubsystem, non-detection of erroneous all-zero transfers is avoided by inverting the CRCbytes.4 Zynq PS / Embedded Linux MultiSpectralDetectorControl engineLWIR acquisition thread and infinite loopFile: MsdcSrcMsdd.cppThe acquisition is started by a call to bool startLwir(unsigned char* buf0, void(*callback)(void*), void* argCallback), to which a pointer to an (allocated)buffer for the first frame and a callback method argument are passed.WhizniumDBE’s “easy” model does not support non-blocking operation when waiting fornew frames, so that a separate thread with periodic polling is started.The thread entry point is void* runLwir(void* arg) ; within its infinite loop, a buffertransfer is performed each time a new frame becomes available, after which the providedcallback function is invoked.Callback, acquisition and process stageFile: MsdcAcqLwir.cppThe callback function void MsddCallback(void* arg) is executed from within thethread mentioned before. It is thus crucial that it only performs the minimal actions requiredand then returns to the acquisition loop.If an empty buffer is available for the next frame, the callback points the acquisition threadto it using void JobMsdcSrcMsdd::setLwirBuf(unsigned char* buf), else a NULLpointer is passed, resulting in omitted frames. This condition is resolved once a bufferbecomes available in uint enterSgeAcq(DbsMsdc* dbsmsdc, const boolreenter).Control over the newly arrived frame is passed on to one of the engine’s job processorthreads, by triggering an external call which is handled in boolhandleCallMsdcBufrdy(DbsMsdc* dbsmsdc, const ubigint jrefTrig, constboolvalInv). If the job’s state machine is ready for a new frame, i.e. is in stage WAITBUF,the stage is changed to ACQ, else the frame is dropped.In uint enterSgeAcq(DbsMsdc* dbsmsdc, const bool reenter), an optionalgeometrical transform is applied to the frame, and also the raw data is auto-gain-correctedto spread over the entire 16-bit grayscale space.7

Acquisition takes place in the master job, and triggering a CallMsdcIbitRdy notifies allslaves of the now pre-processed frame.Both the master job an all slave jobs subsequently switch into the PRC stage, where eachinstance of JobMsdcAcqLwir can perform the additional geometrical transforms it needs.Finally, also in uint enterSgePrc(DbsMsdc* dbsmsdc, const bool reenter), aCallMsdcImgRdy is triggered which notifies the superior (UI) panel job of the processedframe.Live data video panelFile: Liv/PnlMsdcLivVideo.cppIn bool handleCallMsdcImgrdy(DbsMsdc* dbsmsdc, const ubigintjrefTrig), the frame data is copied into a DpchEngLive dispatch (definition inPnlMsdcLivVideo blks.cpp), a serializable (to XML) C object. As the following HTTPStransfer to the client is to be initiated by the server (at least virtually / emulated), thedispatch is passed on to a dispatch collector up the job hierarchy.Dispatch collector for long pollingFile: d.cppHTTP/1.1 does not support communication triggered by the server for which reasonWhizniumSBE applications use “long polling” (delayed answering of a client request toemulate server-triggered action). Per card or browser tab, in this case for CrdMsdcLiv, adispatch collector accumulates pending dispatches while no client request is available.In the engine’s exchange object, void submitDpch(DpchEngMsdc* dpcheng) handlesthe matching of dispatches to be transferred to available dispatch collectors. If a (nowobsolete) DpchEngLive is alrady present, its content is overwritten/merged with the newLWIR frame.If a HTTPS request is available, control will move over to the application server, else thedispatch will be retained.HTTPS application server powered by libmicrohttpdFile: dAppsrv.cppDispatch collector (“notify”) HTTPS/GET requests are received at the URLhttps:// ip : port /notify/ scrJref where scrJref is the scrambled jobreference, in this case of the relevant instance of CrdMsdcLiv.In the application server’s libmicrohttpd callback function, int MhdCallback(void*cls, MHD Connection* connection, const char* url, const char*method, const char* version, const char* upload data, size t*upload data size, void** con cls) and then void8

writeDpchEng(XchgMsdccmbd* xchg, ReqMsdc* req), the dispatch is serialized intoa XML string using its void writeXML(const uint ixMsdcVLocale,xmlTextWriter* wr) method.Excursion: Base64 encoding for XMLFiles: sbecore/Xmlio.cppBinary data (8-bit character space) is reduced to Base64 encoding (6-bit character space) invoid toBase64(const unsigned char* inbuf, unsigned int inbuflen,char** outbuf, unsigned int& outbuflen) in order to be transmitted correctly.Also, machine type (e.g. Intel little-endian, ARM big-endian) independence is warranted byalways using “network order” (big-endianness) for the transfer of multi-byte variables, this isimplemented in void writeBase64(xmlTextWriter* wr, const char* buf,const unsigned int len, const unsigned int varlen).5 Client web-browser MultiSpectralDetectorControl web-based UIHTML5 canvas elementFile: dcLiv/PnlMsdcLivVideo bcont.xmlIn terms of WhizniumSBE modeling, the area in which the LWIR image is to be displayed, is acustom control CusImg in row tr id "trImg" of height 480 pixels. A HTML5 canvaselement is inserted manually, its bitmap content is accessible through JavaScript code.Long-polling the engine’s application serverFile: dcLiv/CrdMsdcLiv.jsThe function iterateReqit() forms the counterpart to the engine’s dispatch collector.The responseXML representation of the data received already allows to interpret thedispatch XML root tag. Each card knows its panel’s scrambled job references, allowing topass on a received dispatch accordingly (here to PnlMsdcLivVideo).Image displayFile: dcLiv/PnlMsdcLivVideo.jsThe DpchEngLive arrives at handleDpchEng(dom, dpch) and thenhandleDpchEngMsdcLivVideoLive(dom). Its non-binary content is inserted into thepanel’s DOM, while the grayscale bitmap is transformed back into binary form andsubsequently stored in the variable doc.gray.Along with some scaling, the function refreshLive(mask) is responsible for updating thecanvas RGBX bitmap content.9

Excursion: Base64 decodingFile: t/vecio.jsFunction fromBase64(str). As JavaScript does not assume “network order” but rather thelocal machine’s endianness, also an optional re-ordering is implemented in allparse*(str) functions.10

RESET_L nirst (N17) FPGA - FLIR reset MASTER_CLK imclk (P21) FPGA - FLIR 25MHz clock I2C 2-wire interface, “fast” mode 400kbps Lepton3 pin FPGA pad purpose SCL iscl (L17) FPGA - FLIR clock SDA isda (M17) bi-directional push-pull data SPI 3-wire interf

Related Documents:

Jack and HALO Michael and COOPER Michael and SIRI McAllister and ARTY Declan and NOBLE . Aaron and QUINCY Eric and LEX Michael and VOCO Mikayla and SAFFRON Guinevere and SOLSTICE Jannette and SAPPHIRE James and NINJA Kimberly and WAGS Molly and MATER Justin and WENDELL Elliot and U

w and z and . w and @ and .! and s and .! and f and . [and x and . [and and . v and c and . J. Circle one letter in each group that has some major difference with the remaining letters. Describe the difference. 1. t n m k Difference: 2. l q Difference: 3. x # ! Difference:

Aug 13, 2020 · FT. FBR KIP ADJACENT SPANS FT. FBR KIP 30 and 35 46.78 35 and 35 47.26 30 and 40 48.07 35 and 40 48.59 30 and 45 49.08 35 and 45 50.76 30 and 50 51.25 35 and 50 52.97 30 and 55 54.06 35 and 55 55.79 30 and 60 57.25 35 and 60 58.98 30 and

Hamed, Ashraf N. E. and Schmitz, Roland and Bergermann, Anja and Totzke, Frank and Kubbutat, Michael and Müller, Werner E. G. and Youssef, Diaa T.A. and Bishr, Mokhtar M. and Kamel, Mohamed S. and Edrada-Ebel, RuAngelie and Wätjen, Wim and Proksch, Peter (2018) Bioactive py

Poluzzi, Elisabetta and Veronese, Giacomo and Piccinni, Carlo and Raschi, Emanuel and Koci, Ariola and Pagano, Paola and Godman, Brian and Marchesini, Giulio and Boriani, Giuseppe and De Ponti, Fabrizio (2016) Switching among equivalents in chronic cardiovascular therapies : 'real world' data from Italy. Basic and Clinical Pharmacology

Priority Mail Regional Rate Box A 10.13 and up 9.98 and up 7.83 and up 7.68 and up Priority Mail Regional Rate Box B 10.53 and up 10.37 and up 8.23 and up 8.07 and up Priority Mail (1 lb.) 7.70 and up 7.50 and up 7.16 and up 7.02 and up

Don and Christine Carlin Anand and Pamela Chakraborty Craig and April Chapman Erik and Amanda Copeland Jay and Jennifer Crowell Michael and Lorraine Cunningham Jim and Kimberly Darrin Jeff and Diane Davis Chris and Adria Deforeest Dibble Engineers Inc. Christian Eckhoff and Kimberly Grant Michael and Marina Elizarov Richard and Carolyn Ersek

HIGH RISK BAKING Although most cakes and biscuits are classed as low risk products, some fillings and finishes are more high risk. Fresh cream, some cheese cakes and royal icing made from raw egg whites are all high risk and require extra thought to ensure they are prepared safely. Cakes that require refrigeration must be kept at or below 8 C at all times with limited time out of temperature .