summaryrefslogtreecommitdiffstats
path: root/nuttx/arch/arm/src/lpc17xx
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-01-20 02:40:56 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-01-20 02:40:56 +0000
commitf1865f4ca0fbfe30b47e030f0dc567e909203b68 (patch)
tree8958c0afbbd40e1246d7566c44d7436f3e279bee /nuttx/arch/arm/src/lpc17xx
parentf7053b7bf854a99cad9177c47fae844c32292799 (diff)
Fixes to PIC32 USB driver and LPC17xx CAN driver
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4316 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/arch/arm/src/lpc17xx')
-rwxr-xr-xnuttx/arch/arm/src/lpc17xx/lpc17_can.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_can.c b/nuttx/arch/arm/src/lpc17xx/lpc17_can.c
index d4206cfd72..80e1480773 100755
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_can.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_can.c
@@ -151,7 +151,7 @@
# define CONFIG_CAN_TSEG2 7
#endif
-#define CAN_BIT_QUANTA (CONFIG_CAN_TSEG1 + CONFIG_CAN_TSEG2 + 3)
+#define CAN_BIT_QUANTA (CONFIG_CAN_TSEG1 + CONFIG_CAN_TSEG2 + 1)
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing CAN */
@@ -1070,7 +1070,7 @@ static int can12_interrupt(int irq, void *context)
*
* |<----------------- NOMINAL BIT TIME ----------------->|
* |<- SYNC_SEG ->|<------ BS1 ------>|<------ BS2 ------>|
- * |<--- 3*Tq --->|<----- Tbs1 ------>|<----- Tbs2 ------>|
+ * |<---- Tq ---->|<----- Tbs1 ------>|<----- Tbs2 ------>|
*
* Where
* Tbs1 is the duration of the BS1 segment
@@ -1080,7 +1080,7 @@ static int can12_interrupt(int irq, void *context)
* Relationships:
*
* baud = 1 / bit_time
- * bit_time = 3*Tq + Tbs1 + Tbs2
+ * bit_time = Tq + Tbs1 + Tbs2
* Tbs1 = Tq * ts1
* Tbs2 = Tq * ts2
* Tq = brp * Tcan
@@ -1108,14 +1108,14 @@ static int can_bittiming(struct up_dev_s *priv)
canllvdbg("CAN%d PCLK: %d baud: %d\n", priv->port,
CAN_CLOCK_FREQUENCY(priv->divisor), priv->baud);
- /* Try to get CAN_BIT_QUANTA quanta in one bit_time.
+ /* Try to get CAN_BIT_QUANTA quanta in one bit_time.
*
- * bit_time = Tq*(3 + ts1 + ts2)
+ * bit_time = Tq*(ts1 + ts2 + 1)
* nquanta = bit_time/Tq
* Tq = brp * Tcan
- * nquanta = (3 + ts1 + ts2)
+ * nquanta = (ts1 + ts2 + 1)
*
- * bit_time = brp * Tcan * (3 + ts1 + ts2)
+ * bit_time = brp * Tcan * (ts1 + ts2 + 1)
* nquanta = bit_time / brp / Tcan
* brp = Fcan / baud / nquanta;
*
@@ -1135,7 +1135,7 @@ static int can_bittiming(struct up_dev_s *priv)
/* In this case, we have to guess a good value for ts1 and ts2 */
ts1 = (nclks - 1) >> 1;
- ts2 = nclks - ts1 - 3;
+ ts2 = nclks - ts1 - 1;
if (ts1 == ts2 && ts1 > 1 && ts2 < CAN_BTR_TSEG2_MAX)
{
ts1--;