apollo-lhc / cm_mcu

Microcontroller source code for the APOLLO blade for the CMS tracker HL-LHC upgrade.
MIT License
2 stars 2 forks source link

Add a power control state machine state 6 for controlling V3.8 needed for Samtec 12-ch 25Gbs #183

Closed pkotamnives closed 1 year ago

pkotamnives commented 1 year ago

This PR will resolve #140

Note that this change is only needed for REV2. Currently, the infrastructure of this state machine is ready to be reviewed. We only need to add a bit mask to ff struct such as ffl12_f1_args and ffl12_f2_args to store information if a vendor part of each ch is a 25Gb one to enable V3.8, and the state machine condition.

pkotamnives commented 1 year ago

some comments inline. You say the code doesn't sucessfully power-on; I did not immediately see why.

hi @pwittich, yes you're right. I just tried imposing ff_part_bit_mask in PowerSupplyTask in a different way, and it seems to work fine. I just tested the latest commit on Apollo 205 and the ff_part_bit_mask are 7 for both FPGAs which is expected. The power supply also seems to be functioning fine. Let me know if there are any tests to check.

Type "help" to view a list of registered commands.
% 200 SRV INF InitTask.c:34:REC register=0x00000011
202 SRV INF LocalTasks.c:966:LGA80D_init
% 206 SRV INF cm_mcu.c:443:Stack canary now 52
2040 SRV INF LocalTasks.c:424:Setting a bit mask of enabled Fireflys to 1
2040 SRV INF InitTask.c:46:Clock I/O expander initialized
% 20101 PWR INF PowerSupplyTask.c:298:power-up requested
% 20201 ALM WRN AlarmUtilities.c:297:Voltage high: status: 0x0000 at ADC ch 01 now +00.67 % off
% 20250 MONI2C INF MonitorI2CTask.c:141:FF12: PWR on. (Re)starting I2C monitoring.
20250 MONI2C INF MonitorI2CTask.c:141:FF12V: PWR on. (Re)starting I2C monitoring.
20304 MONI2C INF MonitorI2CTask.c:141:FFDAQ: PWR on. (Re)starting I2C monitoring.
20305 MONI2C INF MonitorI2CTask.c:141:FFDAV: PWR on. (Re)starting I2C monitoring.
20973 SRV WRN LocalTasks.c:1537:Quit.. garbage EEPROM of r0b PreL
20975 SRV WRN LocalTasks.c:1537:Quit.. garbage EEPROM of r1a PreL
20977 SRV WRN LocalTasks.c:1537:Quit.. garbage EEPROM of r1b PreL
20979 SRV WRN LocalTasks.c:1537:Quit.. garbage EEPROM of r1c PreL
20979 SRV INF InitTask.c:61:Clocks configured
20980 MONI2C INF MonitorI2CTask.c:141:CLKSI: PWR on. (Re)starting I2C monitoring.
201008 I2C WRN I2CCommunication.c:194:transfer stuck
201027 I2C ERR I2CCommunication.c:201:write fail PERIPHERAL_BUSY
201027 MONI2C WRN MonitorI2CTask.c:158:Mux write error PERIPHERAL_BUSY, break (instance=FFDAQ,ps=0)
201042 SRV INF LocalTasks.c:675:Getting Firefly 12-ch part (FPGA1): CRRNBY12024123M     :
201042 MONI2C INF MonitorI2CTask.c:141:CLKR0A: PWR on. (Re)starting I2C monitoring.
201043 MONI2C WRN LocalTasks.c:642:Mux write error ADDR_ACK_ERROR
201043 MONI2C ERR MonitorI2CTask.c:170:FFDAQ: page fail ADDR_ACK_ERROR
201071 I2C WRN I2CCommunication.c:194:transfer stuck
201072 SRV WRN LocalTasks.c:647:GetFFpart read Error ADDR_ACK_ERROR, break
201072 SRV INF LocalTasks.c:690:Bit-mask Firefly 12-ch part (FPGA1): 7
:201073 MONI2C ERR MonitorI2CTask.c:170:FFDAQ: page fail ADDR_ACK_ERROR
201100 I2C WRN I2CCommunication.c:194:transfer stuck
201119 I2C ERR I2CCommunication.c:201:write fail PERIPHERAL_BUSY
201119 MONI2C WRN MonitorI2CTask.c:158:Mux write error PERIPHERAL_BUSY, break (instance=FFDAV,ps=0)
201134 SRV INF LocalTasks.c:745:Getting Firefly 12-ch part (FPGA2): CRRNBY12024123M     :
201147 SRV WRN LocalTasks.c:717:GetFFpart read Error ADDR_ACK_ERROR, break
201164 SRV INF LocalTasks.c:760:Bit-mask Firefly 12-ch part (FPGA2): 7                  :
201165 MONI2C ERR MonitorI2CTask.c:182:FFDAV: FF_STATUS_REG read Error ADDR_ACK_ERROR, break (ps=0)
pwr:                                                                                    
F1_ENABLE:      1                                                                       
F2_ENABLE:      1                                                                       
State machine state: ON                                                                 
External Alarm: 0                                                                            
PG_F1_INT_A: PWR_ON                                                                     
PG_F1_INT_B: PWR_ON                                                                     
PG_F2_INT_A: PWR_ON                                                                     
PG_F2_INT_B: PWR_ON                                                                          
PG_1V8: PWR_ON                                                                          
PG_3V3: PWR_ON                                                                    
PG_F1_VCCAUX: PWR_ON                                                                    
PG_F2_VCCAUX: PWR_ON                                                                      
PG_F1_AVCC: PWR_ON                                                                      
PG_F2_AVCC: PWR_ON                                                                      
PG_F1_AVTT: PWR_ON                                                                      
PG_F2_AVTT: PWR_ON                                                                          
PG_4V0: PWR_ON                                                                
%                       
pwittich commented 1 year ago

Is this ready for final review?

pkotamnives commented 1 year ago

Is this ready for final review?

hi @pwittich, it was operating as expected with 12-ch non-25Gbs FFs but we can't test it with the 12-ch 25Gbs. Also, I am not sure if you would like the way I have added some logging info when we check each FF part in LocalTask.c but I think this PR is in a good state to be reviewed now.