| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		
			AlastairM
 
 
  Joined: 28 Apr 2008 Posts: 33
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				| DSPIC33CH128MP202 share ADC pin between master and slave | 
			 
			
				 Posted: Tue Jan 21, 2025 6:03 am     | 
				     | 
			 
			
				
  | 
			 
			
				Is it possible to share (internally) an ADC pin in the slave and master code?
 
e.g. pin1 
 
master:AN1/RA1 
 
slave:S1AN15/S1RA1
 
Or does the CPRA fuse setting mean that the pin is physically 'master' or ''slave' and just not available for the other core?
 
I wanted the master to monitor the waveform frequency in the background while the slave samples
 
I have a spare pin for an external connection but I'd prefer not mod the pcb...
 
Thanks
 
Alastair | 
			 
		  | 
	
	
		  | 
	
	
		
			temtronic
 
 
  Joined: 01 Jul 2010 Posts: 9589 Location: Greensville,Ontario 
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Tue Jan 21, 2025 7:18 am     | 
				     | 
			 
			
				
  | 
			 
			
				yessh , I have enough 'fun' with one PIC in a package and you have TWO !!
 
Honestly, I'd look at the 'drawings' in the datasheet, only what, 5-6-700 pages to scan.......
 
What you ask seems 'possible', actually a good 'feature'. I know some PICs can 'interconnect' internal peripherals(her that here) so it 'might' be possible.
 
 
My first thought was of course a jumper.....that's what a 'dinosaur' like me uses !
 
 
edit. sigh, I downloaded the datasheet..834 pages !!!! I tried to scan,to see if the ADC s could be linked but yeesh, 'it's complicated' !!! sorry....
 
I want to got back to 16C84s !!! | 
			 
		  | 
	
	
		  | 
	
	
		
			AlastairM
 
 
  Joined: 28 Apr 2008 Posts: 33
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Tue Jan 21, 2025 8:08 am     | 
				     | 
			 
			
				
  | 
			 
			
				I found that bit of the datasheet quite confusing...
 
I'll try a few configurations on the actual hardware and come back after I've finished 'hacking' | 
			 
		  | 
	
	
		  | 
	
	
		
			Ttelmah
 
 
  Joined: 11 Mar 2010 Posts: 19967
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Tue Jan 21, 2025 8:12 am     | 
				     | 
			 
			
				
  | 
			 
			
				I suspect you probably can. Obviously only on a pin that is accessible both
 
to the master ADC and a slave ADC. However I'd also suspect that the 
 
accuracy may well be degraded slightly.if you do this..There will be some
 
noise introduced when the sample and hold connects and disconnects, so
 
for a low accuracy application it might be OK. It is noticeable that the 
 
examples from MicroChip, where they want something controlled by a 
 
voltage always work from one core, and send the result to the second
 
core. | 
			 
		  | 
	
	
		  | 
	
	
		
			AlastairM
 
 
  Joined: 28 Apr 2008 Posts: 33
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Tue Jan 21, 2025 8:53 am     | 
				     | 
			 
			
				
  | 
			 
			
				You're correct about the signal integrity - but I'll live with it for now.
 
It worked OK on the hardware!
 
I now have the slave sampling continuously and the slave sample rate being changed by the master using the mailbox interrupt when the master sees a change in the waveform.
 
I think the #FUSES CPRA & CPRB are just relevant for  IO pins to stop the cores fighting - the compiler doesn't complain when used for ADC. Interesting... | 
			 
		  | 
	
	
		  | 
	
	
		
			AlastairM
 
 
  Joined: 28 Apr 2008 Posts: 33
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Tue Jan 21, 2025 9:00 am     | 
				     | 
			 
			
				
  | 
			 
			
				dsPIC33CH128MP202 2-core 200MHz lots of goodies
 
28-pin SOP -  ridiculous   | 
			 
		  | 
	
	
		  | 
	
	
		
			temtronic
 
 
  Joined: 01 Jul 2010 Posts: 9589 Location: Greensville,Ontario 
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Tue Jan 21, 2025 9:15 am     | 
				     | 
			 
			
				
  | 
			 
			
				NUTs..200 MHz. need to be careful about PCB layout and cleanliness at that speed
 
 
My remote energy control system ran at 24 BAUD. yes 24 bits per second.
 
 
sigh....I miss the good old days....
 
 
enjoy you're making PROGRESS !! | 
			 
		  | 
	
	
		  | 
	
	
		 |