Show Posts
Pages: [1]
1  Using Arduino / Microcontrollers / Re: Arduino Due External Interrupts on: November 15, 2012, 04:35:06 am
Yay, it works on 1.5.2r2 IDE! Thanks again! woop woop
2  Using Arduino / Microcontrollers / Re: Arduino Due External Interrupts on: November 15, 2012, 03:30:02 am
Ah, thanks Graynomad! I will try it out. I apologise for creating this whole new thread for it, I did not come across that thread in my initial search for my answer.
3  Using Arduino / Microcontrollers / Re: Arduino Due External Interrupts on: November 15, 2012, 03:00:20 am
I am using 1.5. I'll give it a try as soon as I can get a hold of 1.5.2 (doesn't seem to be out yet).
4  Using Arduino / Microcontrollers / Re: Arduino Due External Interrupts on: November 15, 2012, 02:26:07 am
Ok, so I changed the code to:

Code:
int state = 0;

void setup(){
  Serial.begin(115200);
  pinMode(2, INPUT);
  attachInterrupt(19, state_change, CHANGE);
}

void loop(){
  Serial.println(state);
  delay(1);
}

void state_change(){
  state = (state + 1);
}

So everytime I change the state of pin 19 (which I did by connecting it to another Arduino with a simple 'blink' type sketch, it should increment state. But it doesn't smiley-sad
5  Using Arduino / Microcontrollers / Arduino Due External Interrupts on: November 14, 2012, 05:20:02 am
Hi,

I'm trying to use external interrupts on the Arduino Due but can't seem to get it working. Here is my code:

Code:
void setup(){
  Serial.begin(115200);
  pinMode(2, INPUT);
  attachInterrupt(2, state_change, CHANGE);
}

void loop(){
}

void state_change(){
  Serial.println("woot");
}

This should attach an interrupt to pin number 2 (according to http://www.arduino.cc/en/Reference/AttachInterrupt ). I have also tried using the old way of attaching to interrupt '0' to use pin 2 and I have also tried interrupt '4' to use pin 19 as well as tried attach interrupt '19' to use pin 19 but nothing is working. I realise it may be bad practice to put a serial command in an interrupt function but this is just to get the interrupt working.

Has anyone used external interrupts on the Due yet?

Thanks
Mark
6  Using Arduino / Networking, Protocols, and Devices / Re: Reading Stop and Start Bits on: October 23, 2012, 12:49:15 pm
I'll look into this Salae LA, sounds particularly useful.

Unfortunately it is the bit error positions that are just as important as the error event itself because I need to make a statistical model of the channel (as part of my Master's Thesis). The errors would usually occur in bursts and thus the positions of the errors to observe these bursts are quite important. Maybe another way to do it is have a counter count the number of bits between errors and when there is an error, save the counter value then reset the counter.

I'll also see if I can get a hold of the Due as soon as possible.

Thanks for your help! I'll post again if I get it to work.

PS I hate assembler!
7  Using Arduino / Networking, Protocols, and Devices / Re: Reading Stop and Start Bits on: October 23, 2012, 09:17:01 am
Ya that's what I'm slowly figuring out - it's too slow smiley-sad Maybe the new Arduino Due would be able to do the trick if I can get a hold of it?

A logic analyzer would have been perfect, but yes, that's exactly what I have to do - sample over a long period of time and analyze afterwards (and the analyzers I have looked at can not hold nearly enough samples).

I do have access to both ends. My plan, though, was to generate a pseudo random sequence of bits and send them from my laptop. So I'll have that particular sequence stuffed with start and stop bits from my laptop's UART. Then, obviously I know what the sequence must be and thus can compare after receiving.

pylon, not such a bad idea but involves a lot of implementation work! If all else fails I'll look into it.
8  Using Arduino / Networking, Protocols, and Devices / Re: Reading Stop and Start Bits on: October 23, 2012, 08:41:17 am
Yea asynchronous. That's kind of my problem. I'm going to be sending a continuous stream of bits, and if there's an error in the start bit then I'm not going to detect it.

For example, I send 2 bytes, one straight after the other. The output of the sender onto the powerline will be 0|10100110|10|11000111|1. So there is a 0 start bit, followed by 8 data bits, then a stop bit and then the start bit to start the next byte. But now let's say the noisy powerline corrupts one of the bits and the following sequence is received by the receiving transceiver: 0|10100110|11|11000111. Due to the corrupted bit, a normal UART will not tell me that there has been an error there and instead just send to me: 00111111 as data bits for the second byte.

Remember the transceivers have 2 interfaces: serial and the powerline. Whatever it receives on its serial rx line it pumps into the powerline, and whatever it detects on the powerline it pumps into its serial tx line. So the one transceiver will be receiving a nice long stream of serial from my laptop, which it will pump into the powerline. The receiving transceiver will then receive the bits. The transceiver holds its tx line high (as usual serial) and then when the powerline modulated signal is detected it changes it to low and high as it detects the signal (I'd imagine this is similar to how wireless devices that interface with serial work as well, but I'm not sure).

Point is I need a way to periodically sample the serial line at a high speed, but my Arduino does not seem to be fast enough, but I was thinking surely it must be fast enough somehow if it has a software serial library it must be able to sample it that quickly.
9  Using Arduino / Networking, Protocols, and Devices / Re: Reading Stop and Start Bits on: October 23, 2012, 04:36:28 am
Let me try clarify some more. I'm sending the serial data to a transceiver that sends the information over a powerline. The receiving transceiver pumps out whatever bits it receives on the power line (the transceivers use a special phase modulation to send/receive bits over the power line). However, the power line is noisy, so the sender sends a 0 start bit but the receiver detects that a 1 was sent. The problem is that if that error occurs on a start/stop bit then I can't use ordinary UART to detect it because that will just produce frame errors and/or produce the wrong byte and I will lose out on detecting which bits caused the error.

I just need some way of sampling the serial output of the receiver fast enough to be able to record the full bit stream of what the receiver is detecting.

The serial has to be sent in one long stream and I can't have 'breaks' inbetween because the point is to characterise the powerline as a communication channel in terms of bit errors, and having breaks will not give a good representation.
10  Using Arduino / Networking, Protocols, and Devices / Re: Reading Stop and Start Bits on: October 23, 2012, 03:36:29 am
That's my problem though. If I receive "0|10101001|11|10011010|1" for example (I have seperated the start and stop bits with '|'). So if the second start bit is an error (as I've shown with bold) then the second byte is going to be wrong (will start late) and will be extremely difficult to say where the error was exactly. But I need to know exactly which bit was an error because the point is to send a stream of bits over the channel and then compare the received bits with the original stream to 'examine' the nature of the bit errors (this is for research).

EDIT: Just to clarify, the channel is going to be quite noisy, and this will affect the bits that are received. So the sender will send a '0' start bit but the receiver may detect a '1' instead, which is why I would like to record all bits received.
11  Using Arduino / Networking, Protocols, and Devices / Reading Stop and Start Bits on: October 23, 2012, 03:04:55 am
Hi,

I want to do a bit error rate analysis over a particular serial channel. I can easily send the bytes using my laptop. The issue is to receive ALL the bits, including the start and stop bits (in this case there is one of each with no parity). This is to able to check whether there was an error in those bits.

The problem is that the regular Arduino digitalRead is way too slow and misses most of the bits. I wanted to know if anyone would know how to maybe modify the software serial library to somehow feed me back the start and sop bits, or any kind of interrupt method (I have been trying to use interrupts but to no avail.

At first I'm trying to read the bits at 19 200 baud, but would love to read them at 57 600.

I would be very grateful for any input!

Thanks,
Mark
Pages: [1]