Commit 334c180e authored by Andreas Werner's avatar Andreas Werner
Browse files

add muxing for our board

parent 385ed086
......@@ -8,6 +8,7 @@
#include "mcdrv_twrkv46f150m.h"
#include "fsl_common.h"
#include <system.h>
/*******************************************************************************
* Definitions
......
......@@ -105,6 +105,7 @@ extern const char bldcCommutationTableComp[16];
* U_dcb (PTB18) | | ADCB_CH0
* I_dcb (PTB0) | | ADCB_CH2
*/
#if 0
/* BEMF phase A assigned to ADC0 only */
#define ADC0_PH_A (3)
#define ADC1_PH_A ADC_NO_CHAN
......@@ -123,6 +124,26 @@ extern const char bldcCommutationTableComp[16];
/* Aux channel is assigned to ADC1 only */
#define ADC0_AUX (0)
#define ADC1_AUX ADC_NO_CHAN
#else
/* BEMF phase A */
#define ADC0_PH_A (3)
#define ADC1_PH_A ADC_NO_CHAN
/* BEMF phase B */
#define ADC0_PH_B (6) //c
#define ADC1_PH_B ADC_NO_CHAN
/* BEMF phase C */
#define ADC0_PH_C (7) //c
#define ADC1_PH_C ADC_NO_CHAN
/* DC-bus voltage */
#define ADC0_UDCB ADC_NO_CHAN
#define ADC1_UDCB (2)
/* DC-bus current */
#define ADC0_IDCB (4)
#define ADC1_IDCB ADC_NO_CHAN
/* Aux channel */
#define ADC0_AUX (0)
#define ADC1_AUX ADC_NO_CHAN
#endif
/******************************************************************************
* MC driver macro definition and check - do not change this part
......
......@@ -5,6 +5,7 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
//vim: ts=4 sw=4 expandtab
/***********************************************************************************************************************
* This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
......@@ -61,6 +62,10 @@ pin_labels:
#include "fsl_gpio.h"
#include "pin_mux.h"
/* FreeROTSHAL Muxing */
#include <iomux.h>
#include <mux.h>
/* FUNCTION ************************************************************************************************************
*
* Function Name : BOARD_InitBootPins
......@@ -189,11 +194,12 @@ PinTool_ADC:
* END ****************************************************************************************************************/
void PinTool_ADC(void)
{
struct mux *mux = mux_init();
/* Port B Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortB);
/* Port E Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortE);
#if 0
/* PORTB1 (pin 54) is configured as ADCB_CH3 */
PORT_SetPinMux(BOARD_ADCB_PHB_PORT, BOARD_ADCB_PHB_PIN, kPORT_PinDisabledOrAnalog);
......@@ -205,6 +211,43 @@ void PinTool_ADC(void)
/* PORTE19 (pin 13) is configured as ADCB_CH1 */
PORT_SetPinMux(BOARD_ADCB_PHA_PORT, BOARD_ADCB_PHA_PIN, kPORT_PinDisabledOrAnalog);
#endif
// ADCA_CH2 T_FB
// No muxing needed pin is fixed
//mux_pinctl(mux, ADCA_CH2, MUX_CTL_MODE(MODE0) | MUX_CTL_OPEN, 0);
// ADCA_CH3 I_FB_V
// No muxing needed pin is fixed
//mux_pinctl(mux, ADCA_CH3, MUX_CTL_MODE(MODE0) | MUX_CTL_OPEN, 0);
// ADCA_CH6c I_FB_W
// No muxing needed pin is fixed
// Muxing in ADC is needed!
//mux_pinctl(mux, ADCA_CH6c, MUX_CTL_MODE(MODE0) | MUX_CTL_OPEN, 0);
SIM->ADCOPT &= SIM_ADCOPT_ADCBCH6SEL_MASK;
SIM->ADCOPT |= SIM_ADCOPT_ADCACH6SEL(0x2); // Select c
// ADCA_CH7c I_FB_U
// No muxing needed pin is fixed
// Muxing in ADC is needed!
//mux_pinctl(mux, ADCA_CH7c, MUX_CTL_MODE(MODE0) | MUX_CTL_OPEN, 0);
SIM->ADCOPT &= SIM_ADCOPT_ADCBCH7SEL_MASK;
SIM->ADCOPT |= SIM_ADCOPT_ADCACH7SEL(0x2); // Select c
// PTE24/ADCB_CH4 V_FB_W
mux_pinctl(mux, PTE24, MUX_CTL_MODE(MODE0) | MUX_CTL_OPEN, 0);
// PTE25/ADCB_CH5 V_FB_V
mux_pinctl(mux, PTE25, MUX_CTL_MODE(MODE0) | MUX_CTL_OPEN, 0);
// PTB0/ADCB_CH2 V_FB_DC
mux_pinctl(mux, PTB0, MUX_CTL_MODE(MODE0) | MUX_CTL_OPEN, 0);
// PTB1/ADCB_CH3 V_FB_U
mux_pinctl(mux, PTB1, MUX_CTL_MODE(MODE0) | MUX_CTL_OPEN, 0);
// PTE29/ADCA_CH4 I_BUS
mux_pinctl(mux, PTE29, MUX_CTL_MODE(MODE0) | MUX_CTL_OPEN, 0);
}
/* clang-format off */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment