Skip to content
Snippets Groups Projects
Commit a048b7ba authored by Douglas Araujo's avatar Douglas Araujo
Browse files

Fix channel SPI loop

parent abf1d74b
No related branches found
No related tags found
1 merge request!1ICSHWI-14275: Create VMM FEN Epics module
...@@ -22,7 +22,11 @@ void FENConfigModule::sendAll(bool useConfigCheck) { ...@@ -22,7 +22,11 @@ void FENConfigModule::sendAll(bool useConfigCheck) {
configFEN(); configFEN();
for(int hybrid = 0; hybrid <= HYBRIDS_PER_FEN; hybrid++) { for(int hybrid = 0; hybrid <= HYBRIDS_PER_FEN; hybrid++) {
if (isHybridEnabled(hybrid)) { if (isHybridEnabled(hybrid)) {
configHybrid(hybrid);
for(int vmm = 0; vmm < VMMS_PER_HYBRID; vmm++) {
configVMM(hybrid, vmm, useConfigCheck);
}
} }
} }
} }
...@@ -142,8 +146,6 @@ bool FENConfigModule::configVMM(int hybrid_index, int vmm_index, bool enableConf ...@@ -142,8 +146,6 @@ bool FENConfigModule::configVMM(int hybrid_index, int vmm_index, bool enableConf
unsigned int firstGlobalRegSPI_2 = 0; unsigned int firstGlobalRegSPI_2 = 0;
unsigned int lastGlobalRegSPI_2 = 2; unsigned int lastGlobalRegSPI_2 = 2;
unsigned int firstChRegSPI = 3;
unsigned int lastChRegSPI = 66;
unsigned int firstGlobalRegSPI_1 = 67; unsigned int firstGlobalRegSPI_1 = 67;
unsigned int lastGlobalRegSPI_1 = 69; unsigned int lastGlobalRegSPI_1 = 69;
...@@ -155,11 +157,12 @@ bool FENConfigModule::configVMM(int hybrid_index, int vmm_index, bool enableConf ...@@ -155,11 +157,12 @@ bool FENConfigModule::configVMM(int hybrid_index, int vmm_index, bool enableConf
} }
//channel SPI //channel SPI
for(unsigned int i = firstChRegSPI; i <= lastChRegSPI; i++) { for(unsigned int i = 0; i < CHANNELS_PER_VMM; i++) {
std::string param = "vmm_ch" + std::to_string(i - firstChRegSPI); std::string position_str = std::to_string(i);
param += sVmmIndex; if (position_str.size() == 1) position_str = "0" + position_str;
param += std::string(2 - std::to_string(i - firstChRegSPI).length(), '0'); // Right justify with '0' std::string param = "vmm_ch" + position_str + sVmmIndex;
uint32_t value = std::stoul(channelRegisters[i - firstChRegSPI], nullptr, 2); uint32_t value = std::stoul(channelRegisters[i], nullptr, 2);
std::cout << "param: " << param << std::endl;
pFEN->user_reg_write(param, value); pFEN->user_reg_write(param, value);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment