This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using PMAP to reroute C1OUT to P7.1 on MSP432P401R

Hi Guys,

since I did a mistake in hardware routing, I want the C1OUT (Comperator1 OUT) signal on the P7.1 port via PMAP. I am not quite sure if this is possible, but when it is, I am definetly doing something wrong in my software routines.

Here's my port mapping array:

/* Port mapper configuration register for C1OUT to P7.1*/
const uint8_t port_mapping[] =
{
        //Port P7:
		PM_CE1OUT, PM_NONE, PM_NONE, PM_NONE, PM_NONE, PM_NONE, PM_NONE,
        PM_NONE
};

and here's my comparator Initialization. I want to use the comparator to monitor a battery voltage, so that when it falls down the Vref value a LED will light up to show, that the battery needs to be charged. Iam using P5.7 as the COMP_IN and falsly connected P7.1 as the OUT Pin for driving the LED. Since P7.1 is normally C0OUT I want to use PMAP to route C1OUT to P7.1. Sadly it does not seem to work.

/* Comparator configuration structure */
const COMP_E_Config batMonitor =
{
COMP_E_VREF, // Positive Input Terminal
COMP_E_INPUT6, // Negative Input Terminal
COMP_E_FILTEROUTPUT_DLYLVL4, // Delay Level 4 Filter
COMP_E_NORMALOUTPUTPOLARITY, // Inverted Output Polarity
COMP_E_NORMAL_MODE// Ultra low power mode
};


bool init_batMonitor()
{
    /* Remapping  C1OUT to P7.1 */
    MAP_PMAP_configurePorts((const uint8_t *) port_mapping, PMAP_P7MAP, 1,
            PMAP_DISABLE_RECONFIGURATION);

	/* setting PORT5.7 to be comparator IN */
	MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5, GPIO_PIN7, GPIO_TERTIARY_MODULE_FUNCTION);

	/* setting PORT7.1 as C0OUT for battery charging LED */
	MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P7, GPIO_PIN1,
	            GPIO_PRIMARY_MODULE_FUNCTION);

	/* Initialize the Comparator E module
	 *  Comparator Instance 1,
	 *  Reference Voltage to Positive(+) Terminal,
	 *  C1.6 to Negative(-) Terminal,
	 *  Ultra low Power Mode,
	 *  Output Filter On with max delay,
	 *  Inverted Output Polarity
	 */
	 if(!(MAP_COMP_E_initModule(COMP_E1_BASE, &batMonitor))) return false;

	/*Set the reference voltage that is being supplied to the (+) terminal
	 *  Comparator Instance 1,
	 *  Reference Voltage of 2,5V,
	 *  Lower Limit of 2,5V*(20/32) = 2,5V*0,62, (aprox. 1,55v respective for 3,1V/2; see MAX8903 datasheet for VBATPQ )
	 *  Upper Limit of 2,5V*(20/32)
	 */
	MAP_COMP_E_setReferenceVoltage(COMP_E1_BASE, COMP_E_VREFBASE2_5V,
										20, 20);

	/* setting COMP_E reference accuracy to clocked for low power */
	//MAP_COMP_E_setReferenceAccuracy(COMP_E1_BASE,COMP_E_ACCURACY_CLOCKED);

	/* Disable Input Buffer on P5.6/C1.6
	 *  Base Address of Comparator E1,
	 *  Input Buffer port
	 *  Selecting the CEx input pin to the comparator
	 *  multiplexer with the CEx bits automatically
	 *  disables output driver and input buffer for
	 *  that pin, regardless of the state of the
	 *  associated CEPD.x bit
	 */
	MAP_COMP_E_disableInputBuffer(COMP_E1_BASE, COMP_E_INPUT6);

	/* Allow power to Comparator module */
	MAP_COMP_E_enableModule(COMP_E1_BASE);

	/* Delaying to allow comparator to settle */
	uint_fast16_t ii;
	for (ii = 0; ii < 400; ii++);

	return true;
}

**Attention** This is a public forum