Test Setup
06.06.2024 - Softwarelabor
scuxl0646
schreiben und lesen des echo registers
Funktionscode 0x13 schreibt in das echoregister. Funktionscode 0x89 liest (siehe
FG380.211 S.18).
via eb-tools
eb-write dev/wbm0 0x420800/2 0xcafe
eb-write dev/wbm0 0x420802/2 0x1310
eb-write dev/wbm0 0x421802/2 0x8910
eb-read dev/wbm0 0x421a02/2 > /dev/null
via
FeSupport::MilSupport::Ifb
void simple_example(FeSupport::MilSupport::MilAccess SIO_no,unsigned MIL_addr) {
auto busAdapterFactory = boost::make_shared<FeSupport::Scu::BusAdapters::BusAdapterFactory> (SIO_no);
boost::shared_ptr<FeSupport::MilSupport::Ifb> ifb = boost::make_shared<FeSupport::MilSupport::Ifb>(busAdapterFactory, MIL_addr);
if (ifb->onlineTest() == false) return;
ifb->mil()->setDebug(true);
std::cout << ifb->configInfo() << "\n";
uint16_t word = 0xcafe;
ifb->writeData(IFB_ECHO_WRITE, word);
uint16_t echo;
auto complStat = ifb->readData(IFB_ECHO_READ, echo);
std::cout << ifb->configInfo() << " write : " << std::hex << word << " read : " << echo;
if (complStat & 1) { std::cout << " ok\n"; }
else { std::cout << " err" << std::hex << complStat << std::dec << "\n"; }
}
Example output (SIO_1,milslave address 0x10):
/home/bel/thaberm/lnx/workspace9/feSupport/feSupport/milSupport/Ifb.cpp::Ifb:41 Fg900_151 created for ifb 16
IFB-Adr: 16 Online ID: fb00(FG380.211) EPLD: 0x600 GrpCnt: 1 Mode: 0
/home/bel/thaberm/lnx/workspace9/feSupport/feSupport/scu/etherbone/EtherboneConnection.cpp::doVectorWrite::928: format 0x12 addr 0x420800 data[0] 0xcafe
/home/bel/thaberm/lnx/workspace9/feSupport/feSupport/scu/etherbone/EtherboneConnection.cpp::doVectorWrite::928: format 0x12 addr 0x420802 data[1] 0x1310
/home/bel/thaberm/lnx/workspace9/feSupport/feSupport/scu/etherbone/EtherboneConnection.cpp::doWrite::870 addr 0x4219e0 data 0x8910
/home/bel/thaberm/lnx/workspace9/feSupport/feSupport/scu/etherbone/EtherboneConnection.cpp::doVectorRead::848: format 0x12 addr 0x421c1e data[0] 0x1
/home/bel/thaberm/lnx/workspace9/feSupport/feSupport/scu/etherbone/EtherboneConnection.cpp::doVectorRead::848: format 0x12 addr 0x421c3e data[1] 0x0
/home/bel/thaberm/lnx/workspace9/feSupport/feSupport/scu/etherbone/EtherboneConnection.cpp::doRead::773 addr 0x421be0 data 0xcafe
IFB-Adr: 16 Online ID: fb00(FG380.211) EPLD: 0x600 GrpCnt: 1 Mode: 0 write : cafe read : cafe ok
Functioncode-RAM der IFK beschreiben
- 0x30-0x4F sind reserviert fuer schreibe Modulbus-Funktionscode und 0xB0-0xBF zum Lesen.
- Functioncode-RAM Adresse schreiben: FC 0x62 (
IFB_WR_FC_RAM_ADR
)
- Functioncode-RAM Daten schreiben: FC 0x63 (
IFB_WR_FC_RAM_DAT
)
- Funtioncode-RAM lesen ??
Zum Beispiel in
mbio64-class-def.hh
(ist das die richtige?)
/*------------------------------*/
/* Functioncode-RAM beschreiben */
/*------------------------------*/
void setFctCodeRam() {
SLong i;
TModbusAdrbus adrWord;
_ifb.setIfbAdr(_pCrate->getIfb().getIfbAdr()+_modulAdr-1);
/*-------------------------------*/
/* Function-Codes für 64-Bit I/O */
/*-------------------------------*/
for (i = 0; i <= C_MAX_IO64_FCTCODE; i++) {
_ifb.writeData(IFB_WR_FC_RAM_ADR, io64Fctcode[i].fctCode);
adrWord.wo = 0; /* preset */
adrWord.adr.mod =_modulAdr;
adrWord.adr.sub = io64Fctcode[i].subAdr;
_ifb.writeData(IFB_WR_FC_RAM_DAT, adrWord.wo);
} /* FOR i... */
} /* setFctCodeRam */
Modulbus Adress:
typedef union TModbusAdrbus {
UWord wo;
struct {
UWord res : 3; /* Bit 13..15 */
UWord mod : 5; /* Bit 8..12 */
UWord sub : 8; /* Bit 0.. 7 */
} adr;
} TModbusAdrbus;
5bit Moduladresse und 8bit Sub-adresse. Siehe auch PZU-Doku S. 45, insb: verfuegbar auf allen Modulbuskomponenten:
Sub |
w/r |
bit8-15 |
bit0-7 |
FE |
r |
Modul-ID (Karte) |
Modul-ID (Steckplatz) |
FC |
r |
Modulskalierung |
Modul-Adresse |
FA |
r |
EPLD-ID (Karte) |
frei (FF) |
--
TobiasHabermann - 06 Jun 2024