LPC17xx CAN driver now supports all 3 transmit buffers and loopback mode; LCP1766-STK NSH configuration will support the CAN loopback test
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4253 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
16b9d42729
commit
46fc72d1cb
@ -2328,4 +2328,9 @@
|
|||||||
loopback mode on the STM3240G-EVAL board.
|
loopback mode on the STM3240G-EVAL board.
|
||||||
* configs/stm3240g-eval/src/up_adc.c: Complete coding of ADC support for the
|
* configs/stm3240g-eval/src/up_adc.c: Complete coding of ADC support for the
|
||||||
potentiometer on board the STM3240G-EVAL.
|
potentiometer on board the STM3240G-EVAL.
|
||||||
|
* arch/arm/src/lpc17_can.c: Several CAN driver improvements. Adds support for
|
||||||
|
testing in loopback mode. now uses all three transmit buffers for better
|
||||||
|
performance.
|
||||||
|
* confgs/olimex-lpc1766stk/nsh: Now supports the CAN loopback test as an
|
||||||
|
optional "built-in" application.
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* arch/arm/src/lpc17xx/lpc17_can.h
|
* arch/arm/src/lpc17xx/lpc17_can.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -295,7 +295,7 @@
|
|||||||
#define CAN_GSR_TXERR_SHIFT (24) /* Bits 24-31: Tx Error Counter */
|
#define CAN_GSR_TXERR_SHIFT (24) /* Bits 24-31: Tx Error Counter */
|
||||||
#define CAN_GSR_TXERR_MASK (0xff << CAN_GSR_TXERR_SHIFT)
|
#define CAN_GSR_TXERR_MASK (0xff << CAN_GSR_TXERR_SHIFT)
|
||||||
|
|
||||||
/* Interrupt and capure register */
|
/* Interrupt and capture register */
|
||||||
|
|
||||||
#define CAN_ICR_RI (1 << 0) /* Bit 0: Receive Interrupt */
|
#define CAN_ICR_RI (1 << 0) /* Bit 0: Receive Interrupt */
|
||||||
#define CAN_ICR_TI1 (1 << 1) /* Bit 1: Transmit Interrupt 1 */
|
#define CAN_ICR_TI1 (1 << 1) /* Bit 1: Transmit Interrupt 1 */
|
||||||
@ -409,7 +409,7 @@
|
|||||||
#define CAN_RFS_BP (1 << 10) /* Bit 10: Received in AF Bypass mode */
|
#define CAN_RFS_BP (1 << 10) /* Bit 10: Received in AF Bypass mode */
|
||||||
/* Bits 11-15: Reserved */
|
/* Bits 11-15: Reserved */
|
||||||
#define CAN_RFS_DLC_SHIFT (16) /* Bits 16-19: Message Data Length Code (DLC) */
|
#define CAN_RFS_DLC_SHIFT (16) /* Bits 16-19: Message Data Length Code (DLC) */
|
||||||
#define CAN_RFS_DLC_MASK (15 << yy)
|
#define CAN_RFS_DLC_MASK (15 << CAN_RFS_DLC_SHIFT)
|
||||||
/* Bits 20-29: Reserved */
|
/* Bits 20-29: Reserved */
|
||||||
#define CAN_RFS_RTR (1 << 30) /* Bit 30: Message Remote Transmission Request */
|
#define CAN_RFS_RTR (1 << 30) /* Bit 30: Message Remote Transmission Request */
|
||||||
#define CAN_RFS_FF (1 << 31) /* Bit 31: Message 29-bit vs 11-bit ID */
|
#define CAN_RFS_FF (1 << 31) /* Bit 31: Message 29-bit vs 11-bit ID */
|
||||||
|
@ -918,7 +918,8 @@ static bool can_txempty(FAR struct can_dev_s *dev)
|
|||||||
* CAN RX FIFO 0 interrupt handler
|
* CAN RX FIFO 0 interrupt handler
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* dev - An instance of the "upper half" can driver state structure.
|
* irq - The IRQ number of the interrupt.
|
||||||
|
* context - The register state save array at the time of the interrupt.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero on success; a negated errno on failure
|
* Zero on success; a negated errno on failure
|
||||||
|
@ -879,6 +879,20 @@ Where <subdir> is one of the following:
|
|||||||
+CONFIG_GPIO_IRQ=y
|
+CONFIG_GPIO_IRQ=y
|
||||||
+CONFIG_ARCH_IRQBUTTONS=y
|
+CONFIG_ARCH_IRQBUTTONS=y
|
||||||
|
|
||||||
|
4. This example supports the CAN loopback test (apps/examples/can) but this
|
||||||
|
must be manually enabled by selecting:
|
||||||
|
|
||||||
|
CONFIG_CAN=y : Enable the generic CAN infrastructure
|
||||||
|
CONFIG_LPC17_CAN1=y : Enable CAN1
|
||||||
|
CONFIG_CAN_LOOPBACK=y : Enable CAN loopback mode
|
||||||
|
|
||||||
|
See also apps/examples/README.txt
|
||||||
|
|
||||||
|
Special CAN-only debug options:
|
||||||
|
|
||||||
|
CONFIG_DEBUG_CAN
|
||||||
|
CONFIG_CAN_REGDEBUG
|
||||||
|
|
||||||
nx:
|
nx:
|
||||||
An example using the NuttX graphics system (NX). This example uses
|
An example using the NuttX graphics system (NX). This example uses
|
||||||
the Nokia 6100 LCD driver. NOTE: The Nokia 6100 driver does not
|
the Nokia 6100 LCD driver. NOTE: The Nokia 6100 driver does not
|
||||||
|
@ -55,3 +55,8 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
|||||||
CONFIGURED_APPS += examples/buttons
|
CONFIGURED_APPS += examples/buttons
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_CAN),y)
|
||||||
|
CONFIGURED_APPS += examples/can
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -337,6 +337,8 @@ CONFIG_DEBUG_VERBOSE=n
|
|||||||
CONFIG_DEBUG_SYMBOLS=n
|
CONFIG_DEBUG_SYMBOLS=n
|
||||||
CONFIG_DEBUG_NET=n
|
CONFIG_DEBUG_NET=n
|
||||||
CONFIG_DEBUG_USB=n
|
CONFIG_DEBUG_USB=n
|
||||||
|
CONFIG_DEBUG_GPIO=n
|
||||||
|
CONFIG_DEBUG_CAN=n
|
||||||
CONFIG_MM_REGIONS=2
|
CONFIG_MM_REGIONS=2
|
||||||
CONFIG_ARCH_LOWPUTC=y
|
CONFIG_ARCH_LOWPUTC=y
|
||||||
CONFIG_RR_INTERVAL=200
|
CONFIG_RR_INTERVAL=200
|
||||||
@ -624,6 +626,28 @@ CONFIG_NET_BROADCAST=n
|
|||||||
CONFIG_NET_DHCP_LIGHT=n
|
CONFIG_NET_DHCP_LIGHT=n
|
||||||
CONFIG_NET_RESOLV_ENTRIES=4
|
CONFIG_NET_RESOLV_ENTRIES=4
|
||||||
|
|
||||||
|
#
|
||||||
|
# CAN device driver settings
|
||||||
|
#
|
||||||
|
# CONFIG_CAN - Enables CAN support (one or both of CONFIG_LPC17_CAN1 or
|
||||||
|
# CONFIG_LPC17_CAN2 must also be defined)
|
||||||
|
# CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
|
||||||
|
# Default: 8
|
||||||
|
# CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
|
||||||
|
# Default: 4
|
||||||
|
# CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
|
||||||
|
# mode for testing. The STM32 CAN driver does support loopback mode.
|
||||||
|
# CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN1 is defined.
|
||||||
|
# CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN2 is defined.
|
||||||
|
#
|
||||||
|
CONFIG_CAN=n
|
||||||
|
#CONFIG_CAN_FIFOSIZE
|
||||||
|
#CONFIG_CAN_NPENDINGRTR
|
||||||
|
CONFIG_CAN_LOOPBACK=n
|
||||||
|
CONFIG_CAN_REGDEBUG=n
|
||||||
|
CONFIG_CAN1_BAUD=700000
|
||||||
|
CONFIG_CAN2_BAUD=700000
|
||||||
|
|
||||||
#
|
#
|
||||||
# USB Device Configuration
|
# USB Device Configuration
|
||||||
#
|
#
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# configs/olimex-lpc1766stk/src/Makefile
|
# configs/olimex-lpc1766stk/src/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -56,6 +56,10 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
|||||||
CSRCS += up_buttons.c
|
CSRCS += up_buttons.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_CAN),y)
|
||||||
|
CSRCS += up_can.c
|
||||||
|
endif
|
||||||
|
|
||||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||||
|
|
||||||
|
@ -139,4 +139,4 @@ int can_devinit(void)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_STM32_CAN || CONFIG_STM32_CAN2 || CONFIG_STM32_CAN3 */
|
#endif /* CONFIG_CAN && (CONFIG_STM32_CAN2 || CONFIG_STM32_CAN3) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user