• AVR Freaks

Weird CAN an ADC problem

Author
maykonvs
New Member
  • Total Posts : 30
  • Reward points : 0
  • Joined: 2016/06/14 11:18:24
  • Location: 0
  • Status: offline
2018/02/01 09:58:06 (permalink)
0

Weird CAN an ADC problem

I have a project that is using the Graphics Stack, CAN and Resitive Touch. The microcontroller is a PIC32MZ2064DAG176. I was having a lot of trouble using the touch, I just couldn't get it to work reasonably, it was too instable. Analyzing the ADC data I saw that the signal was indeed noisy.
 
I removed the LCD screen and put a potentiometer in place of its touch lines, and after a lot of tryouts and erros, what I got is: if the CAN pins are configured as CAN the ADC convertion value changes, it gets higher and very noisy, if they are used as outputs the problem fades way.
 
BSP_ADC_TOUCH_XPLUS    AN24 / PIN 160
BSP_ADC_TOUCH_YPLUS    AN33 / PIN 157
C2TX                                 PIN 25
C2RX                                 PIN 26 
 
Anyone has a clue about this problem?
#1
HJonker
Super Member
  • Total Posts : 489
  • Reward points : 0
  • Joined: 2006/04/19 02:17:59
  • Location: NL
  • Status: offline
Re: Weird CAN an ADC problem 2018/02/01 23:31:05 (permalink)
0
What is connected to C2RX?
You state that when you set BOTH pins as output you have no noise, whilst setting the pins to CAN, you do get noise. When having set the pins to CAN, the C2RX is effectivly an input, and C2TX is an output. So the thing actually changed between the 2 schenario's is C2RX going from output to input.
Now if nothing is connected to C2RX, you have a thing going on: the pin is floating, and can cause havoc. I'd suggest to either attach a pull down to that pin, so you can safely switch between dual output and CAN. OR attach the proper CAN linedriver, and ONLY set the pins to CAN.
Just my first thoughts.

Kind Regards,
Hans Jonker
(Amsterdam, Holland)
#2
maykonvs
New Member
  • Total Posts : 30
  • Reward points : 0
  • Joined: 2016/06/14 11:18:24
  • Location: 0
  • Status: offline
Re: Weird CAN an ADC problem 2018/02/02 03:05:03 (permalink)
0
You are right, after I posted the question I made the test, and indeed, only changing the C2RX to input is enough.
But I don't need the scenario where C2RX is an output, I need it as CAN only, and I have a CAN driver attached to it, the CAN is working great, I can send and receive data with no problem.
 
The system I am developing has a bootloader. In this bootloader I use the ADC, and it works perfectly. This way I saw that the problem wasn't hardware, so I started removing things that I have enabled in my application and not in the bootloader. When I started messing with the CAN2 pins the problem went away, but I need them working as CAN. I have no clue why this is happening.
 
Thank you for helping
#3
maykonvs
New Member
  • Total Posts : 30
  • Reward points : 0
  • Joined: 2016/06/14 11:18:24
  • Location: 0
  • Status: offline
Re: Weird CAN an ADC problem 2018/02/06 04:11:25 (permalink)
0
Any ideas?
#4
Jump to:
© 2019 APG vNext Commercial Version 4.5