Also, the code was updated where a problem was found.
uint32_t i; // Cycle control variable
rpp_ain_update();
- rpp_sci_printf("ADC1: values: ");
- /* conversion results : */
for (i = 0; i < PORT_ADC_CHANNEL_NUM; i++) {
- rpp_sci_printf((uint8_t *)"\r\nChannel: %d\tvalue: %d\t%h", i+1, rpp_ain_get(i+1), rpp_ain_get(i+1));
+ rpp_sci_printf((uint8_t *)"ADC%-2d %4d\n", i+1, rpp_ain_get(i+1));
}
return 0;
}
/** Descriptor of command for adc port reading */
cmd_des_t const cmd_des_read_adc1={
0, 0,
- "adcread","Read values from ADC1", /* FIXME: is ADC1 also a name of a pin? */
+ "adcread","Read values from ADC inputs",
"=== Command syntax ===\n"
"\n"
" adcread\n"
"\n"
"=== Description ===\n"
"\n"
- "This command reads values of all ADIN 1-12 channels and prints it as\n" /* FIXME: Which pins are this? */
- "channel-value (hexadecimal) table.\n"
+ "This command reads values corresponding to analog voltages on ADC\n"
+ "inputs 1-12 and prints them as decimal numbers.\n"
"\n"
"=== Example ===\n"
"\n"
" --> adcread\n"
- " ADC1: values:\n"
- " Channel: 1 value: 110\n" /* FIXME: There is no exadecimal number */
- " Channel: 2 value: 107\n"
- " Channel: 3 value: 109\n"
- " Channel: 4 value: 108\n"
- " Channel: 5 value: 109\n"
- " Channel: 6 value: 110\n"
- " Channel: 7 value: 111\n"
- " Channel: 8 value: 110\n"
- " Channel: 9 value: 107\n"
- " Channel: 10 value: 109\n"
- " Channel: 11 value: 110\n"
- " Channel: 12 value: 110\n"
- "\n"
- "Prints the values of all ADC channels.\n",
+ " ADC1 2338\n"
+ " ADC2 107\n"
+ " ADC3 108\n"
+ " ADC4 106\n"
+ " ADC5 108\n"
+ " ADC6 110\n"
+ " ADC7 110\n"
+ " ADC8 109\n"
+ " ADC9 106\n"
+ " ADC10 107\n"
+ " ADC11 110\n"
+ " ADC12 108\n",
CMD_HANDLER(cmd_do_read_adc1_values), (void *)&cmd_list_adc
};
/** Error counter for errors in receiving */
extern uint32_t canRecError;
-/**
- * @brief Function for printing CAN error status
- *
- * Function prints CAN status as a human readable string and status code.
- *
- * @note The function canInit has to be called before this function can be used.
- *
- * @param[in] node Pointer to CAN registers
- * @param[in] str String to be printed befor status and code
- * @param[in] errorStatus Code of the CAN status
- * @param[in] isFinal 0 when error testing during sending and receiving
- * 1 when final printout was requested
- */
-uint32_t canCheckForError(canBASE_t *node, const char* str, uint32_t *errorStatus, uint8_t isFinal)
+static void canPrintStatus(int can_num, uint32_t es)
{
- //uint32_t errorStatus = node->ES;
- uint32_t errorLevel = *errorStatus & 0xE0U;
- uint32_t errStat = *errorStatus;
- char* levText = "Unknown level. ES: 0x";
-
+ uint32_t errorLevel = es & 0xE0U;
+ char* levText;
- if (*errorStatus != 0) {
- if (errorLevel & canLEVEL_BUS_OFF) {
- levText = "CAN bus is off. ES: 0x";
- }
- else if (errorLevel & canLEVEL_PASSIVE) {
- levText = "CAN bus in passive mode. ES: 0x";
- }
- else if (errorLevel & canLEVEL_WARNING) {
- levText = "CAN bus in passive mode. ES: 0x";
- }
- else if (errorLevel == canLEVEL_ACTIVE) {
- if (isFinal) {
- levText = "CAN is active. ES: 0x";
- *errorStatus = 0;
- }
- else levText = NULL;
- }
- }
- else {
- if (isFinal) {
- levText = "CAN no error. ES: 0x";
- }
- else levText = NULL;
+ switch (errorLevel) {
+ case canLEVEL_BUS_OFF:
+ levText = "Bus-Off";
+ break;
+ case canLEVEL_PASSIVE:
+ levText = "Error Passive";
+ break;
+ case canLEVEL_WARNING:
+ levText = "Warning";
+ break;
+ case canLEVEL_ACTIVE:
+ levText = "Bus-On";
+ break;
+ default:
+ levText = "Unknown";
}
- if (levText == NULL) return errorLevel;
+ rpp_sci_printf("CAN%d status: %s, ES: %#x\n", can_num, levText, es);
+}
+
+uint32_t canCheckForError(int can_num, uint32_t es)
+{
+ uint32_t errorLevel = es & 0xE0U;
- rpp_sci_printf(str);
- rpp_sci_printf(levText);
- rpp_sci_printf("%h\r\n", errStat);
+ if (errorLevel != 0) {
+ canPrintStatus(can_num, es);
+ }
- return errorLevel;
+ return errorLevel;
}
/**
*/
int cmd_do_test_can_loopback(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
{
- uint32_t can[2];
+ uint32_t can_src, can_dst;
canBASE_t *canBases[3] = {canREG1, canREG2, canREG3};
uint32_t canMailBoxes[3] = {canMESSAGE_BOX1, canMESSAGE_BOX2, canMESSAGE_BOX3};
char* token = NULL;
// Get can ID 1
if ((token = strtok(param[1], " ")) == NULL) {
- rpp_sci_printf("ERROR: Parameter 1 expected.");
+ rpp_sci_printf("ERROR: Parameter 1 expected.\n");
return 1;
}
- if (EOF == sscanf(token, "%d", &can[0])){
- rpp_sci_printf("ERROR: unsigned number expected as param 1!");
+ if (EOF == sscanf(token, "%d", &can_src)){
+ rpp_sci_printf("ERROR: unsigned number expected as param 1!\n");
return 1;
}
// Get can ID 2
if ((token = strtok(NULL, " ")) == NULL) {
- rpp_sci_printf("ERROR: Parameter 2 expected.");
+ rpp_sci_printf("ERROR: Parameter 2 expected.\n");
return 1;
}
- if (EOF == sscanf(token, "%d", &can[1])){
- rpp_sci_printf("ERROR: unsigned number expected as param 2!");
+ if (EOF == sscanf(token, "%d", &can_dst)){
+ rpp_sci_printf("ERROR: unsigned number expected as param 2!\n");
return 1;
}
if ((token = strtok(NULL, " ")) != NULL) {
- rpp_sci_printf("ERROR: More than 2 parameters detected!");
+ rpp_sci_printf("ERROR: More than 2 parameters detected!\n");
return 1;
}
- if (can[0] == can[1]) {
- rpp_sci_printf("ERROR: Destination equals source!);");
+ if (can_src == can_dst) {
+ rpp_sci_printf("ERROR: Destination equals source!\n");
return 1;
}
- if (can[0] < 1 | can[1] > 3) {
- rpp_sci_printf("Parameter out of range <1;3>!");
+ if (can_src < 1 | can_dst > 3) {
+ rpp_sci_printf("Parameter out of range <1;3>!\n");
return 1;
}
- canSrc = canBases[can[0]-1];
- canDst = canBases[can[1]-1];
- canMsgBox = canMailBoxes[can[0]-1];
+ canSrc = canBases[can_src-1];
+ canDst = canBases[can_dst-1];
+ canMsgBox = canMailBoxes[can_src-1];
canMsgReceived = xSemaphoreCreateCounting(1, 0);
canMsgSent = xSemaphoreCreateCounting(1, 0);
canEnableErrorNotification(canSrc);
for (i = 0; i < 100; i++) { // Send 100 times the message
- if (canCheckForError(canSrc, "TX", &canSendError, 0) != canLEVEL_ACTIVE) {
+ if (canCheckForError(can_src, canSendError) != canLEVEL_ACTIVE) {
break;
}
canTransmit(canSrc, canMsgBox, tx_data);
txTimeOutCnt++;
}
else {
- if (canCheckForError(canSrc, "TX", &canSendError, 0) & canLEVEL_BUS_OFF) {
+ if (canCheckForError(can_src, canSendError) & canLEVEL_BUS_OFF) {
break;
}
else {
if (canGetData(canDst, canMsgBox, rx_data))
messagesReceived++;
- if (canCheckForError(canDst, "RX", &canRecError, 0) & canLEVEL_BUS_OFF) {
+ if (canCheckForError(can_dst, canRecError) & canLEVEL_BUS_OFF) {
break;
}
}
}
}
}
- rpp_sci_printf("CAN final error state:\r\n");
- canCheckForError(canSrc, "TX", &canSendError, 1);
- canCheckForError(canDst, "RX", &canRecError, 1);
rpp_sci_printf("Messages transmitted: %d/100\r\n", messagesTransmitted);
rpp_sci_printf("Messages received: %d/100\r\n", messagesReceived);
rpp_sci_printf("TX timeouts: %d\r\n", txTimeOutCnt);
rpp_sci_printf("Src RX error counter: %d\r\n", (canSrc->EERC & 0xFF00U) >> 8);
rpp_sci_printf("Dst TX error counter: %d\r\n", canDst->EERC & 0xFFU);
rpp_sci_printf("Dst RX error counter: %d\r\n", (canDst->EERC & 0xFF00U) >> 8);
+ canPrintStatus(can_src, canSendError);
+ canPrintStatus(can_dst, canRecError);
canDisableErrorNotification(canDst);
canDisableErrorNotification(canSrc);
"=== Command syntax ===\n"
"\n"
" cantest <SOURCE> <DESTINATION>\n"
- "where <SOURCE> and <DESTINATION> is a number in range 1-3 and <SOURCE>\n"
- "is not equal <DESTINATION>.\n"
+ "\n"
+ "where <SOURCE> and <DESTINATION> are different numbers in range 1-3.\n"
"\n"
"=== Description ===\n"
"\n"
- "This command tests CAN bus by sending and receiving messages through\n"
- "external loopback. When the bus is in fault state, this command resets it\n" /* FIXME: What it is fault state? */
- "into functional state.\n"
+ "This command tests CAN communication by sending and receiving messages\n"
+ "through external loopback. At the beginning, the involved CAN\n"
+ "controller are initialized to the Bus-On state.\n"
+ "\n"
+ "The command sends 100 messages and measures the numbers of TX errors,\n"
+ "RX errors and detected timeouts. At the end, these statistics are\n"
+ "printed as well as the status of the involved CAN controllers.\n"
"\n"
- "The command sends a message 100 times and measures the numbers of TX\n"
- "errors, RX errors and detected timeouts. At the end, the state of the\n"
- "bus and the number of errors is printed.\n"
+ "When an error is detected during the test, the status of faulty CAN\n"
+ "controller is printed immediately.\n"
"\n"
"=== Example ===\n"
"\n"
" --> cantest 1 2\n"
- "\n"
- "Sends 100 times message from CAN1 to CAN2\n",
+ " Testing CAN loopback\n"
+ " Messages transmitted: 100/100\n"
+ " Messages received: 100/100\n"
+ " TX timeouts: 0\n"
+ " RX timeouts: 0\n"
+ " Src TX error counter: 0\n"
+ " Src RX error counter: 0\n"
+ " Dst TX error counter: 0\n"
+ " Dst RX error counter: 0\n"
+ " CAN1 status: Bus-On, ES: 0x8\n"
+ " CAN2 status: Bus-On, ES: 0x10\n",
CMD_HANDLER(cmd_do_test_can_loopback), (void *)&cmd_list_can
};
ret = rpp_hbr_enable(period);
if (ret == FAILURE) {
- rpp_sci_printf("Enable procedure failed.");
+ rpp_sci_printf("Enable procedure failed.\n");
}
- return cmd_opchar_replong(cmd_io, param, period, 0, 16);
+ return cmd_opchar_replong(cmd_io, param, period, 0, 10);
}
/**
ret = rpp_hbr_control((double)cmd/(double)100);
if (ret == -1) {
- rpp_sci_printf("H-bridge not enabled.");
+ rpp_sci_printf("H-bridge not enabled.\n");
return -1;
}
else if (ret == -2) {
- rpp_sci_printf("Command out of range.");
+ rpp_sci_printf("Command out of range.\n");
return -CMDERR_BADPAR;
}
- return cmd_opchar_replong(cmd_io, param, cmd, 0, 16);
+ return cmd_opchar_replong(cmd_io, param, cmd, 0, 10);
}
/**
int ret;
ret = rpp_hbr_disable();
if (ret == FAILURE) {
- rpp_sci_printf("H-bridge already disabled.");
+ rpp_sci_printf("H-bridge already disabled.\n");
}
- return cmd_opchar_replong(cmd_io, param, ret, 0, 16);
+ return cmd_opchar_replong(cmd_io, param, ret, 0, 10);
}
#endif /* DOCGEN */
"=== Command syntax ===\n"
"\n"
" hbrenable:<PER>\n"
- "where <PER> is PWM period in us\n"
+ "\n"
+ "where <PER> is PWM period in microseconds.\n"
"\n"
"=== Description ===\n"
"\n"
- "This command enables the H-bridge, i.e. the enable signal is set,\n"
- "watchdog reset task is started and PWM is configured with specified\n"
- "period and duty cycle 0%.\n"
+ "This command enables the H-bridge (HBR pin), i.e. the enable signal\n"
+ "the H-bridge chip is set, the watchdog reset task is started and the\n"
+ "PWM is configured with the specified period and duty cycle 0%.\n"
"\n"
- "If the period is lower than zero, default frequency 18kHz is used\n"
- "instead. This command should be called before any other HBR command is\n"
- "used. If HBR is already enabled, an error is returned.\n"
+ "If the period is lower than zero, the default frequency of 18kHz is\n"
+ "used instead. This command should be called before any other command\n"
+ "starting with hbr is used. If H-bridge is already enabled, an error is\n"
+ "printed.\n"
"\n"
"=== Example ===\n"
"\n"
" --> hbrenable:1000\n"
- " hbrenable=3E8\n" /* FIXME: Why hex */
+ " hbrenable=1000\n"
"\n"
- "Enables HBR with period 1kHz. HBR output is still inactive, but ready\n" /* FIXME: What does it mean "inactive"? */
+ "Enables HBR with period 1kHz. HBR output is still inactive, but ready\n"
"for other commands.\n",
CMD_HANDLER(cmd_do_hbr_enable), (void *)&cmd_list_hbr
};
"The command sets the direction and the size of the voltage at HBR\n"
"output.\n"
"\n"
- "When <SPEED> is 0, the output is inactive.\n"
- "\n"
"HBR has to be enabled by hbrenable command before calling this\n"
"command.\n"
"\n"
"=== Example ===\n"
"\n"
" --> hbrcontrol:-25\n"
- " hbrcontrol=FFFFFFE7\n" /* FIXME: Why hex? */
+ " hbrcontrol=-25\n"
"\n"
- "Activates motor rotation to the left with 25% speed.\n"
+ "Rotates the motor to the left with 25% speed.\n"
"\n"
" --> hbrcontrol:25\n"
- " hbrcontrol=19\n"
+ " hbrcontrol=25\n"
"\n"
- "Activates motor rotation to the right with 25% speed.\n"
+ "Rotates the motor to the right with 25% speed.\n"
"\n"
" --> hbrcontrol:0\n"
" hbrcontrol=0\n"
"\n"
- "Deactivates motor rotation.\n", /* FIXME: What does it mean "deactivate"? */
+ "Stops the motor.\n",
CMD_HANDLER(cmd_do_hbr_control), (void *)&cmd_list_hbr
};
"stopped and the enable signal is cleared. The watchdog task is left\n"
"running, because it is harmless.\n"
"\n"
- "After H-bridge is disabled, it can not be controlled by any command\n"
+ "After H-bridge is disabled, it cannot be controlled by any command\n"
"until it is enabled again by the hbrenable command.\n"
"\n"
"=== Example ===\n"
if (ret < 0)
return ret;
- rpp_sci_printf("HOUT_IFBK: values: ");
- /* conversion results : */
for (i = 0; i < PORT_HOUTIFBK_CHANNEL_NUM; i++) {
- rpp_sci_printf("\r\nChannel: %d\tvalue: %d %h", i+1, values[i], values[i]);
+ rpp_sci_printf("HOUT%d: %d\n", i+1, values[i]);
}
return 0;
}
rpp_sci_printf("Bad pin selected");
break;
}
+ rpp_sci_printf("\n");
return 0;
}
double period = hout_pwm_get_period(pin);
uint32_t duty = hout_pwm_get_duty(pin);
- rpp_sci_printf("hout%d_pwm_period: %d\r\nhout%d_pwm_duty: %d/%", pin, period, pin, duty);
- return 0;
+ rpp_sci_printf("houtpwm%d_period=%g\r\nhoutpwm%d_duty=%u\%", pin+1, period, pin+1, duty);
+ return 0;
}
}
/** Command descriptor for test hout fault state command */
cmd_des_t const cmd_des_test_hout_fail = {
0, 0,
- "houtfail","Test if some HOUT pin is in the fault state",
+ "houtfail#","Test if some HOUT pin is in the fault state",
"=== Command syntax ===\n"
"\n"
- " houtfail <PIN>\n" /* FIXME: Why it is not hourfail<PIN>? */
+ " houtfail<PIN>\n"
"where <PIN> is in range 1-6\n"
"\n"
"=== Description ===\n"
"\n"
"This command tests, if HOUT pin is in a good condition. When the\n"
- "circuit controlling HOUT pin detects some failure, it starts to\n"
- "generate a signal on HOUT_DIAG output. This command is supposed to\n"
- "detect such a state.\n"
+ "circuit controlling HOUT pin detects some failure, it signals that on\n"
+ "HOUT_DIAG output. This command is supposed to read this output and\n"
+ "print its state.\n"
+ "\n"
+ "Possible outputs of this command:\n"
+ "* OK - no failure detected\n"
+ "* FAIL - a failure detected\n"
+ "* NOT RUNNING - PWM was set set up and started\n"
+ "\n"
+ "Note: Before using this command, houtpwmstart and houtpwm commands\n"
+ "should be called.\n"
"\n"
"=== Example ===\n"
"\n"
- " --> houtfail 1\n"
+ " --> houtpwm6:(1000,25)\n"
+ " --> houtpwmstart6\n"
+ " --> houtfail6\n"
+ " OK\n"
"\n"
"Detects the state of the HOUT1 and prints OK, FAIL or NOT RUNNING.\n",
CMD_HANDLER(cmd_do_test_hout_fault), (void *)&cmd_list_hout
"=== Description ===\n"
"\n"
"The command reads analog values from HOUT_IFBK pins and prints\n"
- "them in HOUTX-value table.\n",
+ "them in a table.\n"
+ "\n"
+ "=== Example ===\n"
+ "\n"
+ " --> houtifbk\n"
+ " HOUT1: 0\n"
+ " HOUT2: 134223784\n"
+ " HOUT3: 134223784\n"
+ " HOUT4: 0\n"
+ " HOUT5: 38924\n"
+ " HOUT6: 1342231444\n",
CMD_HANDLER(cmd_do_read_hout_ifbk_values), (void *)&cmd_list_hout
};
/** Command descriptor for HOUT set PWM command */
cmd_des_t const cmd_des_hout_pwm={
0, CDESM_OPCHR|CDESM_RW,
- "houtpwm*","Set or get actual PWM parameters", /* FIXME: Why is here * and other commands have #? */
+ "houtpwm#","Set or get actual PWM parameters",
"=== Command syntax ===\n"
"\n"
" houtpwm<PIN>:(<PER>,<DUTY>)\n"
"* <PIN> is a number in range 1-6\n"
"* : means set parameters\n"
"* ? means get parameters\n"
- "* <PER> is a number greater than 0\n"
- "* <DUTY> is a number in range 0-100\n"
+ "* <PER> is a length of the PWM period in microseconds\n"
+ "* <DUTY> is a the PWM duty cycle in percent (0-100)\n"
"\n"
"=== Description ===\n"
"\n"
"HOUT1 PWM will have the period of 1ms and will be active for 25% of\n"
"this period.\n"
"\n"
- " --> hbrpwm1?\n"
+ " --> houtpwm1?\n"
+ " houtpwm1_period=1000\n"
+ " houtpwm1_duty=25\n"
"\n"
"Prints the actual period of HOUT1 PWM in microseconds and the duty\n"
"cycle in percents.\n",
"\n"
"=== Description ===\n"
"\n"
- "If HOUT PWM was previously set by the houtpwm command, this command\n"
- "starts to generate the PWM signal on the specified pin.\n"
+ "This command starts to generate the PWM signal on the specified HOUT\n"
+ "pin. The HOUT PWM has to be previously set by the houtpwm command,\n"
+ "otherwise an error is printed.\n"
"\n"
"=== Example ===\n"
"\n"
+ " --> houtpwm1:(1000,25)\n"
" --> houtpwmstart1\n"
"\n"
- "HOUT1 PWM generation will be activated.\n",
+ "HOUT1 PWM generation will be started.\n",
CMD_HANDLER(cmd_do_hout_pwm_start), (void *)&cmd_list_hout
};
if (val != 0 && val != 1)
return -CMDERR_BADPAR;
hal_gpio_pin_set_value(*desc, (uint32_t) val);
+ cmd_opchar_replong(cmd_io, param, val, 0, 0);
return val;
}
else{
uint32_t pin_value = hal_gpio_pin_get_value(*desc);
- return cmd_opchar_replong(cmd_io, param, pin_value, 0, 0);
+ return cmd_opchar_replong(cmd_io, param, pin_value, 0, 0);
}
}
}
hal_gpio_pin_conf(*desc);
+ cmd_opchar_replong(cmd_io, param, val, 0, 0);
return val;
}
else{
"\n"
"=== Description ===\n"
"\n"
- "This command is used to set or get a value of the particular pin.\n"
+ "This command is sets or gets a value of the particular pin.\n"
"\n"
"The list of valid pin names can be obtained with pinlist command.\n"
"\n"
- "Most of the pins are accessible indirectly via highlevel commands\n"
- "HBR_EN is, for example, controlled by the hbrenable command. This command\n"
- "serves as supplement to highlevel commands for testing purpose.\n"
+ "Most of the pins are accessible indirectly via other highlevel\n"
+ "commands. HBR_EN is, for example, controlled by the hbrenable command.\n"
+ "This command serves as supplement to highlevel commands for testing\n"
+ "purpose.\n"
"\n"
"=== Example ===\n"
"\n"
- " --> pinvalHBREN:1\n" /* FIXME: No output */
+ " --> pinvalHBREN:1\n"
+ " pinvalHBREN=1\n"
"\n"
- "Sets the HBR_EN pin to 1\n"
+ "Sets the HBR_EN pin to 1.\n"
"\n"
" --> pinvalHBREN?\n"
" pinvalHBREN=1\n"
"\n"
- "Gets a value of the HBR_EN pin\n",
+ "Gets a value of the HBR_EN pin.\n",
CMD_HANDLER(cmd_do_pin_val), (void *)&cmd_list_pin
};
"\n"
"The list of valid pin names can be obtained with pinlist command.\n"
"\n"
- "Most of the pins are accessible indirectly via highlevel commands\n"
- "HBR_EN is, for example, controlled by the hbrenable command. This command\n"
- "serves as supplement to highlevel commands for testing purpose.\n"
+ "Most of the pins are accessible indirectly via other highlevel\n"
+ "commands HBR_EN is, for example, controlled by the hbrenable command.\n"
+ "This command serves as supplement to highlevel commands for testing\n"
+ "purpose.\n"
"\n"
"=== Example ===\n"
"\n"
- " --> pindirHBREN:1\n" /* FIXME: No output */
+ " --> pindirHBREN:1\n"
+ " pindirHBREN=1\n"
"\n"
- "Sets the HBR_EN pin as output\n"
+ "Sets the HBR_EN pin as output.\n"
"\n"
" --> pindirHBREN?\n"
" pindirHBREN=1\n"
"\n"
- "Get the direction of the HBR_EN pin\n",
+ "Gets the direction of the HBR_EN pin.\n",
CMD_HANDLER(cmd_do_pin_dir), (void *)&cmd_list_pin
};
"=== Example ===\n"
"\n"
" --> portvalLOUT:(FA)\n" /* FIXME: This example returns ERROR 20 */
- "LOUT1 = 0\n" /* FIXME: This is an exaple output? */
+ " LOUT1 = 0\n"
"\n"
- "LOUT2 = 1\n"
+ " LOUT2 = 1\n"
"\n"
- "LOUT3 = 0\n"
+ " LOUT3 = 0\n"
"\n"
- "LOUT4 = 1\n"
+ " LOUT4 = 1\n"
"\n"
- "LOUT5-8 = 1\n",
+ " LOUT5-8 = 1\n",
CMD_HANDLER(cmd_do_port_val), (void *)&cmd_list_port
};
{
int i;
- rpp_sci_printf("SPI! %h ", addr);
- if (status < 0)
- rpp_sci_printf("FAIL ");
+ if (status < 0) {
+ rpp_sci_printf("spirx failed: %d\n", status);
+ return;
+ }
- rpp_sci_printf(" RX(");
+ rpp_sci_printf("spirx:%#x(", addr);
for (i = 0; i < status; i++) {
- rpp_sci_printf("%h,", buf[i]);
+ rpp_sci_printf("%#x", buf[i]);
+ if (i < status-1)
+ rpp_sci_printf(",");
}
rpp_sci_printf(")\n");
"\n"
" spitr<NAME>?(<CMD>,<RESP>)\n"
"where\n"
- "* <NAME> is a string specifying the name of the peripheral\n" /* FIXME: what are the valid names? */
+ "* <NAME> is a string specifying the name of the peripheral (one of DINSPI, LOUT, DAC12, DAC34, HBR, FRAY1 and FRAY2)\n"
"* <CMD> is a hexadecimal number in range 0 - FFFFFFFF\n"
"* <RESP> is a hexadecimal number in range 0 - FFFFFFFF\n"
"\n"
"=== Description ===\n"
"\n"
- "This command can translate a response from SPI from many different\n"
- "peripherals into human readable form. Standard SPI response is in the\n"
+ "This command translates a response from SPI from many different\n"
+ "peripherals into a human readable form. The SPI response is in the\n"
"form of a hexadecimal number, which encodes the information. This\n"
"commands takes this response, the command which produced this\n"
"response, the name of the peripheral and translates the response into\n"
"the attribute-value table.\n"
"\n"
"=== Example ===\n"
- "\n"
- " --> spitrFRAY1?(FFFF,2B10)\n" /* FIXME: Hangs!!! */
+ "FIXME: Hangs!!!\n"
+ " --> spitrFRAY1?(FFFF,2B10)\n"
"\n"
"Translates response 0x2B10 returned by command 0xFFFF into a human\n"
"readable form.\n",
"=== Description ===\n"
"\n"
"The command sends given data to the SPI peripheral and prints the\n"
- "response.\n"
+ "response. The response contains the address and the received data in\n"
+ "parentheses.\n"
"\n"
"=== Example ===\n"
"\n"
" --> spimst1:0(7F,00,00)\n"
- " SPI! RX()\n" /* FIXME: What it means? */
+ " spirx:0x0(0x3f,0xc0,0xff)\n"
"\n"
"Sends reset command (0x7F0000) to the DIN peripheral.\n",
CMD_HANDLER(cmd_do_spimst), (void *)&cmd_list_spi
/** Command descriptor for poweron */
cmd_des_t const cmd_des_power_on = {
0, 0,
- "poweron","Set VBATEN and VBAT1EN using PWM", /* FIXME: Why PWM? */
+ "poweron","Enable VBATEN and VBAT1EN power supply by using PWM hack",
"=== Command syntax ===\n"
"\n"
" poweron\n"
"\n"
"=== Description ===\n"
"\n"
- "This command turns on the VBAT voltage and slowly charges capacitors\n"
- "connected to VBAT1 by using PWM signal with scalable timing.\n"
+ "This command tries to work around error on VBAT power supply wiring\n"
+ "and attempts to switch the power supply on.\n"
+ "\n"
+ "It turns on the VBAT voltage by slowly charging the capacitors\n"
+ "connected to the VBAT1 signal by using the software-generated PWM\n"
+ "signal with increasing duty cycle.\n"
"\n"
"The poweron command has to be launched before any access to any SPI\n"
- "peripherals, otherwise they will not work.\n"
+ "peripherals, otherwise they will not work (or the power supply has to\n"
+ "be electrically bypassed).\n"
"\n"
- "Please note that parameters for the PWM signal may change from device\n" /* FIXME: I don't understand this. */
- "to device and it might be necessary to tune them for each device.\n",
+ "Please note that parameters for the PWM signal may change from device\n"
+ "to device and it might be necessary to tune them (in source code) for\n"
+ "each device.\n",
CMD_HANDLER(cmd_do_power_on), (void *)&cmd_list_vbat
};
/** Command descriptor for poweroff */
cmd_des_t const cmd_des_power_off = {
0, 0,
- "poweroff","Clear VBATEN and VBAT1EN",
+ "poweroff","Disables VBATEN and VBAT1EN power supply",
"=== Command syntax ===\n"
"\n"
" poweroff\n"