Forum

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

   

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
86Duino One Serial port 1 & interrupts do not work?
2017 年 04 月 25 日
01:10:37
emmet380
New Member
Forum Posts: 6
Member Since:
2017 年 04 月 25 日
Offline

Hello,
I have tried to get the interrupt to work on the 86duino One board for both serial port 1 (pin 31,29) and serial 2 (TX1, RX1) and NO luck!

The code below is what I use now. When I fire a terminal on PC and send character to the above ports, the serialEvent never gets called. even if I replaced the serial1.available with 1. The current Bootloader version: Hehuan 1.0 and BIOS version: Beta 0.9

Another side question is if the base address for crossbar is 0xA00 why we keep writing 0xA01? my understanding is that for example Rich-IO Port 0 Selection is at BA+00 which is 0xA00, is that right? the same confusion I have is with UART BA which says 0xc01 but I use 0xc00 and it works.

Please help!Cool
Thank you

/*
Serial Event example

When new serial data arrives, this sketch adds it to a String.
When a newline is received, the loop prints the string and
clears it.

A good test for this is to try it with a GPS receiver
that sends out NMEA 0183 sentences.

Created 9 May 2011
by Tom Igoe

This example code is in the public domain.

http://www.arduino.cc/en/Tutor.....erialEvent

*/

String inputString = ""; // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete

void setup() {
// sb_Write16(0x64,0x0A01);

// io_outpb(0xA90, 0x08); // bit group selection port0[0]
// io_outpb(0xA91, 0x08); // bit group selection port0[1]
// io_outpb(0xA92, 0x08); // bit group selection port0[2]
// io_outpb(0xA93, 0x08); // bit group selection port0[3]
// io_outpb(0xA94, 0x08); // bit group selection port0[4]
// io_outpb(0xA95, 0x08); // bit group selection port0[5]
// io_outpb(0xA96, 0x08); // bit group selection port0[6]
// io_outpb(0xA97, 0x08); // bit group selection port0[7]

// io_outpb(0xA00, 0x8); // Rich-IO Port 0 selection
// io_outpb(0xA34, 0x01); // PAD attribute port0[1] for TX1

// io_outpb(0xA11, 0x1); // Bit-Rich port0 select bit 1
// io_outpb(0xA12, 0x0); // Bit-Rich port0 select bit 2
// io_outpb(0xA13, 0x0); // Bit-Rich port0 select bit 3
// io_outpb(0xA14, 0x2); // Bit-Rich port0 select bit 4

// io_outpb(0xA28, 0xfe); // On Chip Power Down device control 0
// io_outpb(0xA29, 0xff); // On Chip Power Down device control 0
// io_outpb(0xA2a, 0xfb); // On Chip Power Down device control 0
// io_outpb(0xA2b, 0xff); // On Chip Power Down device control 0
// io_outpb(0xA2c, 0xff); // On Chip Power Down device control 0

// initialize serial:
Serial.begin(9600);
Serial1.begin(9600);
// reserve 200 bytes for the inputString:
inputString.reserve(200);
}

void loop() {
// print the string when a newline arrives:
if (stringComplete) {
Serial1.print("Data from PC: ");
Serial1.println(inputString);
// clear the string:
inputString = "";
stringComplete = false;
}
else{
delay(800);
Serial.println("NO Data from PC!!");
Serial1.println("NO Data from PC!!");
}
}

/*
SerialEvent occurs whenever a new data comes in the
hardware serial RX. This routine is run between each
time loop() runs, so using delay inside loop can delay
response. Multiple bytes of data may be available.
*/
void serialEvent() {
while (Serial1.available()) {
// get the new byte:
char inChar = (char)Serial1.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (inChar == '
') {
stringComplete = true;
}
}
}

2017 年 04 月 25 日
03:42:02
emmet380
New Member
Forum Posts: 6
Member Since:
2017 年 04 月 25 日
Offline

I can confirm that the routing of COM1 to pin 31(RX1) and 29(TX1) now works except the RX1 do not work. My guess it has to do with interrupts??? its set at IR4 but also port 3,9 are set to the same IRQ4. Please help. to get the COM1 to be re routed from port 1 to port 0 I used the following crossbar settings. Its the same as the above with exception that the 0xA34 had to be cleared not set.

Whether I use TX1 RX1 (pin 0 and 1) or reroute it to pin 29 and 31. the same issue is NO interrupts and pin RX1 does not work!

io_outpb(0xA90, 0x08); // bit group selection port0[0]
io_outpb(0xA91, 0x08); // bit group selection port0[1]
io_outpb(0xA92, 0x08); // bit group selection port0[2]
io_outpb(0xA93, 0x08); // bit group selection port0[3]
io_outpb(0xA94, 0x08); // bit group selection port0[4]
io_outpb(0xA95, 0x08); // bit group selection port0[5]
io_outpb(0xA96, 0x08); // bit group selection port0[6]
io_outpb(0xA97, 0x08); // bit group selection port0[7]

io_outpb(0xA00, 0x8); // Rich-IO Port 0 selection set to Bit-RichIO Port 0
io_outpb(0xA01, 0x3); // Rich-IO Port 0 selection to MCM P2

io_outpb(0xA11, 0x1); // Bit-Rich port0 select bit 1
io_outpb(0xA12, 0x0); // Bit-Rich port0 select bit 2
io_outpb(0xA13, 0x0); // Bit-Rich port0 select bit 3
io_outpb(0xA14, 0x2); // Bit-Rich port0 select bit 4

// PAD attribute port0[1] for TX1 set for Tri State. Check http://www.86duino.com/?page_id=85/general-electronics/how-to-connect-vga-to-pci-e
io_outpb(0xA34, 0x00);

2017 年 04 月 26 日
17:07:35
cucubutter
Moderator
Forum Posts: 84
Member Since:
2014 年 04 月 10 日
Offline

Hi emmet380

Serial1's interrupt call the serialEvent1 function, you can look this document : http://www.86duino.com/index.php?p=1888.
You must change io_outpb(0xA34, 0x00) to io_outpb(0xA31, 0x00) because your TX1 on port 0 pin 1.

cucubutter

2017 年 04 月 26 日
18:08:47
Android_Lin
Moderator
Forum Posts: 211
Member Since:
2014 年 04 月 01 日
Offline

Hi, emmet380,

We need to write 0x0A01 to the base address register for crossbar because the bit 0 is enable bit for decoding IO address, see the picture :
https://drive.google.com/open?id=0B-3r7Or1HZx6YldNbU1uUjNNTjg
and it is the same function for bit 0 of UART BA register.

Android_Lin

2017 年 04 月 28 日
05:39:40
emmet380
New Member
Forum Posts: 6
Member Since:
2017 年 04 月 25 日
Offline

So I should use serialEvent1 and not serialEvent?

I will check this share my results here.Thank you Android_Lin

2017 年 05 月 08 日
15:54:47
cucubutter
Moderator
Forum Posts: 84
Member Since:
2014 年 04 月 10 日
Offline

Yes, use serialEvent1.

cucubutter

Forum Timezone: Asia/Taipei

Most Users Ever Online: 66

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Dinosaur: 27

leutenecker: 13

mrZagg: 10

lukeross: 8

tomka: 8

smeezekitty: 8

hippy: 8

Ekkehard: 8

UIdahoCIT: 8

blaxxun: 7

Member Stats:

Guest Posters: 0

Members: 1541

Moderators: 14

Admins: 5

Forum Stats:

Groups: 2

Forums: 10

Topics: 239

Posts: 1082

Newest Members: nhollywoodmarli, bat869cube672, lenggeleranto, iknowesp, dimka, elihu, Woodrowcercraby, Robertnalty, Homerwoppy, RonaldLew

Moderators: Glaux: 70, uaa: 11, guigra: 17, asian55: 22, Android_Lin: 211, bcarroll: 12, cucubutter: 84, recycled-air: 12, stevemork: 16, zerozaber: 52, pongraczi: 20, George Andrews III: 56, poto: 11, garpastym: 20

Administrators: eveshih: 1, anthony: 31, viky6: 0, roboard: 135, hcl: 0