Show Posts
Pages: 1 ... 404 405 [406] 407 408 ... 591
6076  Development / Other Software Development / Re: QUUBmon - yet another monitor program on: September 03, 2011, 12:04:19 pm
Hmmm, I wish I had another Mega.

See how you go tonight, I might try to swap my Arduinos around and see how the Mega goes as a client. Maybe there's an issue there.

______
Rob
6077  Using Arduino / Programming Questions / Re: Computing the Time it takes for indivdula instructions to excute? on: September 03, 2011, 11:59:43 am
Quote
Then, to get the timing you wiggle a pin hooked up to your external equipment
just before and just after the piece of code you
want to time.
I use these two macros
Code:
// some debugging aids used to trigger a logic analyser
#define PULSE0 asm("sbi 5,0\ncbi 5,0");  // PORTB  bit 0, 328 Arduino D8
#define PULSE1 asm("sbi 5,1\ncbi 5,1");  // PORTB  bit 1, 328 Arduino D9

Or variations. Used like this

Code:
PULSE0;
somecode();
PULSE0;

Almost no impact on the running code.
______
Rob

6078  Development / Other Software Development / Re: QUUBmon - yet another monitor program on: September 03, 2011, 11:45:37 am
Is that the last source I posted, it's not the same as what I'm looking at, maybe I uploaded the wrongs files. I've just redone them.

Should look like this on the client

Code:
#ifdef CLIENT_ATmega2560
//////////////////////////////////////////////////
// general definitions and pins used when running
// on a 2560-based board and using the standard
// SPI pins.
#define CLIENT_PROCESSOR "ATmega2560"
#define AVRMON_PORT 'B'
#define AVRMON_PORT_PIN_MOSI 2
#define AVRMON_PORT_PIN_MISO 3
#define AVRMON_PORT_PIN_SCK 1

#define AVRMON_ARD_PIN_MOSI 51
#define AVRMON_ARD_PIN_MISO 50
#define AVRMON_ARD_PIN_SCK 52
#endif

and this on the server (DUT)

Code:
//////////////////////////////////////////////////
// general definitions and pins used when running
// on a 2560-based board and using the standard
// SPI pins.
#ifdef RUNNING_ON_2560
#define SERVER_PROCESSOR       0x2560
#define AVRMON_PORT       'B'
#define AVRMON_PORT_PIN_MOSI   2
#define AVRMON_PORT_PIN_MISO   3
#define AVRMON_PORT_PIN_SCK    1

#define AVRMON_ARD_PIN_MOSI  51
#define AVRMON_ARD_PIN_MISO  50
#define AVRMON_ARD_PIN_SCK   52

#define AVRMON_ARD_PIN_DEBUG 53
#endif

I'm up for another 15mins or so.
______
Rob


6079  Development / Other Software Development / Re: QUUBmon - yet another monitor program on: September 03, 2011, 11:18:56 am
I only have one Mega so in my case the other Arduino is a 2009. It should work with two Megas, but but a lot of things should work smiley

Wiring is a 6-way ribbon cable between ISP headers. Otherwise just like signals to like signals, MISO->MISO etc. And don't forget GND.
SS on the client has to be pulled low with a wire.

______
Rob
6080  Topics / Product Design / Re: Design issue - How to do? on: September 03, 2011, 11:14:20 am
You could use solid state relays (like the CPC1014N), they come in a 4x4mm package but only 400mA capacity.

That's why I asked the questions above.

______
Rob
6081  Topics / Product Design / Re: Design issue - How to do? on: September 03, 2011, 10:48:45 am
Another question, how important is it that another combination is NOT selected?

You can control the relays with 4 Arduino outputs but if it's a big problem say for A to be connected to 2 then I may add some logic because it's easy to stuff up the programming.

_____
Rob
6082  Topics / Product Design / Re: Design issue - How to do? on: September 03, 2011, 10:42:11 am
You can use transmission gates like the 4066, they will work with digital or analogue but as Crossroads says, need more info.

Voltage levels.
Current levels.
Analogue/digital.
Speed of signals.
Speed of changing from one setup to another.

and probably some other stuff I haven't thought of.

EDIT: Crossed there, you need 4 SPST relays.

A only ever goes to 1 (SPST)
B only ever goes to 2 (SPST)
C can go to either   (2 x SPST)

_____
Rob
6083  Development / Other Software Development / Re: QUUBmon - yet another monitor program on: September 03, 2011, 10:15:11 am
Just in case someone is interested, here's a working transaction between the two Arduinos.

The server pulses CLK 40 times to get 5 bytes from the client.

Code:
0x02        Read command
0x31,0x02  address 0x231
0x00,0x00  not used

it parses the command then pulses CLK another 16 times to return two bytes of data

Code:
0x49   the value at address 0x231
0x50   the value at address 0x232

The RD command only displays one byte at present but the code returns data from two consecutive memory locations, one day I'll implement a RDW (read word) command or some such. In this case location 0x231 is the start of the IPC (Inter Processor Communications) area, a part of target RAM used to communicate between the client and server.

The IPC contents default to "IPC scratch RAM" and the 0x49/50 == 'I' and 'P'. The following shows the monitor finding the IPC scratch area then dumping the first 16 bytes of it.

Code:
Server online.
QM> ipc ?
................................................................
Found @ 231
QM> ipc
 0231:  49 50 43 20 73 63 72 61 74 63 68 20 52 41 4D 00    IPC scratch RAM.


The transaction takes 85uS and one transaction is allowed per WFT interrupt, ie every 16mS, so that's 5% of the target Arduino's time used for the monitor. This could be improved by not having a fixed transaction length, eg for a RD command there's no need to send data (the 4th and 5th bytes) as well as address.

Latest code

www.robgray.com/temp/AVRmon_server.pde
www.robgray.com/temp/AVRmon_client.c
______
Rob

6084  Using Arduino / Programming Questions / Re: Servicing an I2C device from an ISR... on: September 03, 2011, 10:05:33 am
Sorry, didn't mean to teach you how to suck eggs. That's true, if the ISR is for a UART for example then yes you should get and save the character as you say.


_____
Rob
6085  Development / Other Software Development / Re: QUUBmon - yet another monitor program on: September 03, 2011, 09:47:15 am
Another one of those "Doh" moments. After spending half the day on this I just realized that as well as well as connecting the two Arduinos with the ribbon cable the slave (client) has to also have SS pulled low. So although I did fix a couple of things that wire was all that was stopping it from working.

Doh.

_____
Rob
6086  Using Arduino / Programming Questions / Re: smoothing analog input with watch dog timer on: September 03, 2011, 08:44:37 am
What has the WDT got to do with that code?

______
Rob
6087  Using Arduino / Programming Questions / Re: Servicing an I2C device from an ISR... on: September 03, 2011, 08:40:40 am
As Lefty said, with interrupts you won't miss a short event, with polling you can easily miss them.

______
Rob   
6088  Development / Other Software Development / Re: QUUBmon - yet another monitor program on: September 03, 2011, 08:30:19 am
In this case the master (aka server) is the chip being debugged as the whole deal has to be at it's discretion because it's running application code whereas the client has nothing better to do. So the master bit bangs on MOSI and the slave (client) returns a command/data on MISO using its SPI port. Then the server responds with two bytes on MOSI. So we have the following data flow for evert transaction.

Code:
MASTER(server)   SLAVE(client)
           <--- CMD    (on MISO)
           <--- ADDR   (on MISO)
           <--- ADDR   (on MISO)
           <--- DATA   (on MISO)
           <--- DATA   (on MISO, not used yet)
RESP1 --->             (on MOSI)
RESP2 --->             (on MOSI, not used yet)


At present the first 5 bytes (on MISO) are all 0xFF and I think I'm never entering the SPI ISR on the slave, but as I said this used to be working code so I don't know why it's broken.

______
Rob
6089  Using Arduino / Project Guidance / Re: Programing Z80 cpu, DOS or MK6116N with a Mega? on: September 03, 2011, 08:18:05 am
Quote
replacing a 555 + NAND gate
ATtiny85 + 0.1uF cap, total cost about $2.50 smiley

______
Rob
6090  Development / Other Software Development / Re: QUUBmon - yet another monitor program on: September 03, 2011, 05:24:24 am
I've spent a lot of time on the monitor today with no luck, given that this was working code that I was using I don't know what's going on. And to make matters worse my logic analyser is playing up which makes it almost impossible to debug things.

Below is a trace from one of the occasions when the LA worked. I have two Arduiinos connected with a 6-way ribbon cable between the two ISP headers.

This shows the server (the Arduino being debugged) generating 5 bursts of clock pulses to get a command and up to 4 parameters from the client (the Arduino running the monitor).

The 6th byte is 0x15 (NAK), meaning that the server didn't like the 0xff command.

So some things are working but it seems that the client is not transmitting data. It's only 18:30 here so I'll persevere for a while.

______
Rob

 
Pages: 1 ... 404 405 [406] 407 408 ... 591