UCANS32K146 add support for B revision

This commit is contained in:
Peter van der Perk 2021-06-04 15:53:31 +02:00 committed by Xiang Xiao
parent 7b882c3588
commit 81954fc644
2 changed files with 27 additions and 5 deletions

View File

@ -73,6 +73,12 @@
#define BOARD_LED_G_BIT (1 << BOARD_LED_G)
#define BOARD_LED_B_BIT (1 << BOARD_LED_B)
/* Board revision detection pin
* 0 equals UCANS32K146-01
* 1 equals UCANS32K146B
*/
#define BOARD_REVISION_DETECT_PIN (GPIO_INPUT | PIN_PORTA | PIN10 )
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LEDs on board
* the RDDRONE-UAVCAN146. The following definitions describe how NuttX
* controls the LEDs:
@ -138,11 +144,9 @@
/* CAN selections ***********************************************************/
#define PIN_CAN0_TX PIN_CAN0_TX_4 /* PTE5 */
#define PIN_CAN0_RX PIN_CAN0_RX_4 /* PTE4 */
#define PIN_CAN0_ENABLE (GPIO_OUTPUT | PIN_PORTE | PIN11 )
#define CAN0_ENABLE_OUT 0
#define PIN_CAN0_STB (GPIO_OUTPUT | PIN_PORTE | PIN11 )
#define PIN_CAN1_TX PIN_CAN1_TX_1 /* PTA13 */
#define PIN_CAN1_RX PIN_CAN1_RX_1 /* PTA12 */
#define PIN_CAN1_ENABLE (GPIO_OUTPUT | PIN_PORTE | PIN10 )
#define CAN1_ENABLE_OUT 0
#define PIN_CAN1_STB (GPIO_OUTPUT | PIN_PORTE | PIN10 )
#endif /* __BOARDS_ARM_RDDRONE_UAVCAN146_INCLUDE_BOARD_H */

View File

@ -23,7 +23,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <arch/board/board.h>
#include <sys/types.h>
#include <syslog.h>
@ -147,5 +147,23 @@ int s32k1xx_bringup(void)
s32k1xx_eeeprom_register(0, 4096);
#endif
#ifdef CONFIG_S32K1XX_FLEXCAN
s32k1xx_pinconfig(BOARD_REVISION_DETECT_PIN);
if (s32k1xx_gpioread(BOARD_REVISION_DETECT_PIN))
{
/* STB high -> active CAN phy */
s32k1xx_pinconfig(PIN_CAN0_STB | GPIO_OUTPUT_ONE);
}
else
{
/* STB low -> active CAN phy */
s32k1xx_pinconfig(PIN_CAN0_STB | GPIO_OUTPUT_ZERO);
}
#endif
return ret;
}