BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Sun Jul 22, 2018 9:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Newbie question
PostPosted: Fri Dec 27, 2013 3:40 am 
Offline
Citizen

Joined: Fri Dec 27, 2013 2:30 am
Posts: 6
Hi everyone,

I'm a newbie on the arc32 (or in general with board :p) and I would like to know if it's possible to send data arduino mega -> arc32 & arc32 -> arduino mega (rx, tx, SPI...)?

Thx

Devilalex505


Top
 Profile  
 
 Post subject: Re: Newbie question
PostPosted: Fri Dec 27, 2013 1:45 pm 
Offline
Citizen

Joined: Fri Dec 27, 2013 2:30 am
Posts: 6
I try to use TXD2 from Arc32 and RX1 from arduino mega 2560, but nothing happen :/

Image

Code Arduino :

Code:
void setup() {
  // initialize both serial ports:
  Serial1.begin(57600);
}

void loop() {
 
  if(Serial1.available())
   {
     Serial1.read());
   }
   
}


Code Arc32 :

Code:
SETHSERIAL1 H9600,H8DATABITS,HNOPARITY,H1STOPBITS
SETHSERIAL2 H57600,H8DATABITS,HNOPARITY,H1STOPBITS
Spd1 Var Word
Spd2 var Word

ENABLEHSERIAL2
ENABLEHSERIAL

Main:

 Spd1 = "test"
 HSerout 1,["HW Spd1 = ",dec Spd1,13]
 HSerout 2,["HW Spd2 = ",dec Spd1,13]

 Toggle P44 'Status LED
 
 pause 5000
   
GoTo Main


There is no data received by the arduino :(

If someone have any idea or if it's impossible

PS: Sorry for my english

thx,

Devilalex505


Top
 Profile  
 
 Post subject: Re: Newbie question
PostPosted: Fri Dec 27, 2013 5:06 pm 
Offline
Master

Joined: Tue Nov 21, 2006 5:34 pm
Posts: 662
I think it should work. Been a long time since I played with Arc32 and I don't have this version.

How do you know that the Arduino did not receive anything? Your test program tries to read a character but does not do anything with it... I assume your test has a bit more in it.


Top
 Profile  
 
 Post subject: Re: Newbie question
PostPosted: Fri Dec 27, 2013 6:23 pm 
Offline
Citizen

Joined: Fri Dec 27, 2013 2:30 am
Posts: 6
It's the ARC32 REV C.

Normaly, if you receive something you have Rx LED on the arduino which blinking, but in my case I have nothing on this LED, so no data receive :(

I also tried to read data on the arduino with Serial1.read() just to be sure but same problem... nothing :/

I don't know if the problem is :

- Arc32 don't send data from the TXD2
or
- Arduino don't read data from the Rx1 pin


Top
 Profile  
 
 Post subject: Re: Newbie question
PostPosted: Sat Dec 28, 2013 4:15 pm 
Offline
Master

Joined: Tue Nov 21, 2006 5:34 pm
Posts: 662
Again I could be wrong, but I don't remember any LEDs on my Arduino Mega that blink when I receive data on the TX1. I remember 4 leds on the board, one for power, another L which is on IO pin 13, plus RX,TX which I believe are connected to the USB rx/tx.

So If it were me, I would try something like:
Code:
void loop() {
 
  if(Serial1.available())
   {
     int ch = Serial1.read());
     Serial.print(ch);
   }
 }

Then you should be able to look at the Serial monitor for the Arduino and see the characters and the LED associated with TX should blink.

Edit: Actually if it were me, I would hook up my Logic Analyzer to several of the IO pins on the Arc32 connector and verify that the serial data was going out the Pin I expect it to be... But I like to cheat.


Top
 Profile  
 
 Post subject: Re: Newbie question
PostPosted: Sat Dec 28, 2013 6:10 pm 
Offline
Citizen

Joined: Fri Dec 27, 2013 2:30 am
Posts: 6
You were right about the LED but the problem is the same...

I tried to send and receive data on the arduino with Tx1 and RX2, and it works, so the problem is not the Tx1 from arduino MEGA.

So, I tried to send data from arduino Tx1 to arc32 RXD2 but it doesn't work... :/

Image

Code:
void setup() {
  // initialize both serial ports:
  Serial2.begin(9600);
  Serial1.begin(9600);
  Serial.begin(9600);
  pinMode(13, OUTPUT);
}

void loop() {
 
  Serial1.write("ttt");
 
  #Test between Tx1 and Rx2 from arduino -> work
  while(Serial2.available() > 0)
  {
    Serial.write(Serial2.read());
    digitalWrite(13, HIGH);
  }
 
  digitalWrite(13,LOW);
  delay(10000);
   
}


Code:
sethserial1 H9600,H8DATABITS,HNOPARITY,H1STOPBITS
sethserial2 H9600,H8DATABITS,HNOPARITY,H1STOPBITS

temp var byte

main

  hserin 2, [temp]
  hserout["test : ",str temp\100\10,13]
 
  high p44 ; to see status led activity

goto main


I don't know if the problem is due to GRD->GRD or something else... and I don't find on google example on the communication arc32 - arduino, only on ssc32 - arduino :(


Top
 Profile  
 
 Post subject: Re: Newbie question
PostPosted: Sat Dec 28, 2013 7:15 pm 
Offline
Master

Joined: Tue Nov 21, 2006 5:34 pm
Posts: 662
Again I don't have this version of board. Mine still have the Aux1 connector at the edge of the board near the power connectors and it is a 90 degree angled connector.

Personally the next thing I would try would be to try swap pin3 with pin 5 and see if maybe RX and TX are reversed. Sometimes hard to know if someone labels RX if they are implying to connect this to the RX of the device or this is the RX...

I grabbed my old Arc32 and hooked it up to Logic Analyzer it does appear to come out at the right pin (output on Pin 3). There is also another issue to work out. That is what common Baud rate will work between the two boards. That is the Arc32 runs at 20mhz and when you tell it to output at 576200 the hardware will not actually output at the baud rate, likewise for Arduinos that run at 16mhz. I know when I connected XBees to both of these processors, I had better luck with special baud rates like 62500 as the baud rate error I think is 0 on both processors.

Kurt


Top
 Profile  
 
 Post subject: Re: Newbie question
PostPosted: Sat Dec 28, 2013 8:26 pm 
Offline
Citizen

Joined: Fri Dec 27, 2013 2:30 am
Posts: 6
Hi kurt,

I found my problem... pin 7(GRD) & 8(VCC) from AUX1 are not working, so I used an other GRD on the board and it's work now!

So my question, is it normal to have the pin 7 and 8 with this problem? (jumper maybe or resistor out?) I know, you don't have this version but I'm sure that you have more knowledge than me about boards :P

thx,

devilalex505


Top
 Profile  
 
 Post subject: Re: Newbie question
PostPosted: Sat Dec 28, 2013 10:46 pm 
Offline
Citizen

Joined: Fri Dec 27, 2013 2:30 am
Posts: 6
Hi everyone,

If found the problem about AUX1, it come from datasheet on the Arc32 REV C, below the solution :

Image

Thx kurt for your help!

Devilalex505


Top
 Profile  
 
 Post subject: Re: Newbie question
PostPosted: Sun Dec 29, 2013 12:01 am 
Offline
Master

Joined: Tue Nov 21, 2006 5:34 pm
Posts: 662
You are welcome,

Glad you got it going


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO