The Catweazle

I have built most of the things one could build on the AVR platform.
Besides being a really good learning start I've reached the roof.

It can work as a PLC and do step by step control of anything.
It can do audio realtime processing. With good programming it can do a realtime filter.

It can do video in realtime.
I've done it in color without difficulty.

But it still has a limit, speed.

So I'm currently doing the same with an NXP LPC812 ARM Cortex M0+ MCU
Thats in the same size as the 328. 16K flash, 4K SRAM, 18 GPIO.

But it's a 32-bit CPU doing a 32x32 multiplication in a single cycle.
And it runs 30MHz on its internal oscillator without external components.

So I put together the Catweazle.

So far it has run all of my projects posted on the Arduino forum without problems.

It ran Mike's 6502 emu code at 4MHz unmodified.

It is as simple as the Arduino to work with but with so much more features.

And it can make the Kessel Run in less than twelve parsecs. 8)

Got a picture or anything?

CrossRoads:
And it can make the Kessel Run in less than twelve parsecs. 8)

Got a picture or anything?

http://www.hackster.io/janost/catweazle-mini?offset=11&ref=explore&ref_id=recent_
but I hate to put it here since I fear it will be removed.

I don't have anything against the Arduino.
I'm even using the 328 as a GPU/IO controller so I think is has a place here.

Don't be afraid to use something else than the Arduino.
I bet all of you use C or C++ and none Assembler.

So using any platform is easy.

So few IO tho.

CrossRoads:
So few IO tho.

Yes, everyone wants lots of IO.
For what?

The Arduino has 14 digital IO.
The LPC812 has 18.

Your little chip only has 6 IO. First thing every will need to do is add some external parts to read buttons, drive LEDs or motors or displays or whatever.

Arduino has 20 digital, 6 of which may also be analog inputs.

CrossRoads:
Your little chip only has 6 IO. First thing every will need to do is add some external parts to read buttons, drive LEDs or motors or displays or whatever.

Arduino has 20 digital, 6 of which may also be analog inputs.

Yes, the LPC810 is like an ATtiny with its 6 GPIO.
The LPC812 is like an ATmega328 and has 18 GPIO.

Both MCUs have a switch matrix so any GPIO pin can be SPI, I2C, UART or any other of the onboard functions.

I've done a bit of assembler...but usually C++ is good enough if you mess around a bit and look at the disassembly.

The next step up in "Arduino" world would be a Due. There's also things like the teensy, but they're all very expensive compared to Pro Minis, etc.

Jan and I had this discussion via email over a week ago and I must admit that I was pretty frosty to the idea too... but, I have soften some over the past few days re-thinking the concept.

Essentially it is a 32-bit 'tiny'. As with the 8-pin tiny85, I/O is always a premium, but I still find myself pulling out one every now and then because it is the right chip for the work.

With the 8-pin ARM chip, one has to consider "code density" and the efficiency that could be gained. This does not mean that every program will benefit from the 32-bit instruction set, but in some cases the under $1, this little chip may be just right. I am definitely going to get a few to play with... like Momma always said, "If you don't taste your food, how'd you know you don't like it?"

Ray

Yes, these chips are fun to play with and doesnt reqire an ISP programmer.
Plain UART works with the internal bootloader.

Its also 5v tolerant even if it runs at 1.8 - 3.6v

The only pain is the LPCXpresso IDE that runs Eclipse which can be a bit overvelming.

I would like to add the LPC to the Arduino IDE to make it a bit more simple.
It already has support for ARM compiling because of the DUE.

The blink demo compiles to 764bytes including the wiring.h to be able to use Arduino style IO.
So the 4K flash can contain quite a bit of code.

janost:
The only pain is the LPCXpresso IDE that runs Eclipse which can be a bit overvelming.

One of the big problems with those chips is the toolchain, yes.

I changed the internal core clock to 40MHz.
And the core runs stable at Vdd=3.3v

The internal flash access time is 24nS and can run with zero waitstates at 41MHz core clock so its technically not overclocking but it might require the Vdd to be 3.6v

A 32-bit MCU at 40MHz is a quite powerful platform.

Since my Catweazle protoboard (yes, I have ordered PCB :slight_smile: ) will contain a 2Mbyte flashchip I'm going to prove the raw DSP and processingpower of the NXP LPC8xx.

I'll write an analog synth and sampleplayer on the chip with filters and envelopes.

It could be done on the ATmega aswell but it's much easier with 32-bits and 40MHz.

I coded a simple Delta-Sigma 44.1KHz 16-bit DAC on a single digitalpin with an RC-filter on it.
It can even do stereo 16-bit on 2-pins without a sweat.

It's coded as a reverse state machine.
Main() is used to run the PDM DAC at 1.3MHz and a 44.1KHz ISR is updating the sample data.

while(1) {
    	   if(DAC >= err) {
    		   digitalWrite(3,HIGH);
    	   err += 65535-DAC;
    	     }
    	   else
    	     {
    		   digitalWrite(3,LOW);
    	     err -= DAC;
    	     }
       }

1-bit PDM DAC on the LPC.
16-bit 44100Hz resolution.

Nemas problemas :slight_smile:

Yes, you can do this on ATmega but there won't be any CPU time left over to update the samples.

1-bit PDM DAC on the LPC.
16-bit 44100Hz resolution.

Impressive. What's next?
I still think that for the traditional Arduino dude and dudett out in the Ether, that the Catweazle needs to be tied into the Arduino world via a mini-shield or I2C and used as a co-processor... I/O over on the Arduino side and the LPC doing something that would put the Arduino into a deep sweat. I betcha a really decent MP3 decoder could be a reality.

Ray

mrburnette:

1-bit PDM DAC on the LPC.
16-bit 44100Hz resolution.

Impressive. What's next?
I still think that for the traditional Arduino dude and dudett out in the Ether, that the Catweazle needs to be tied into the Arduino world via a mini-shield or I2C and used as a co-processor... I/O over on the Arduino side and the LPC doing something that would put the Arduino into a deep sweat. I betcha a really decent MP3 decoder could be a reality.

Ray

Nice idea.
I'll think of something.

Now with the PDM mainloop written in assembly the bitstream runs at 3.6MHz

Still with a 44.1KHz samplerate and 16bit resolution.

asm volatile(
"        mov	r0,r3 \n"
"        mov	r1,#0xA0 \n"
"        lsl    r1,#24   \n"   //r1=0xA000
"        mov	r2,#0x10   \n"
"        lsl    r2,#8    \n"
"        add	r2,#0x0C   \n" //r2=0x100C
"        add    r1,r2     \n"  //r1=0xA000100C LPC_GPIO_PORT->W0[3]
"        mov	r6,#0xFF   \n"
"        lsl    r6,#8    \n"
"        add	r6,#0xFF   \n" //r6=0xFFFF
"        mov	r5,#0x01 \n"
"        lsl    r5,#16   \n"   //r5=0x00010000
"loop%=: ldrh   r7,[r0,#0]   \n"
"        add	r2,r7 \n"  //r2=phacc
"	 mov	r4,r2 \n"
"        and	r4, r5 \n"
"	 str	r4, [r1] \n" //LPC_GPIO_PORT->W0[3]
"        and	r2, r6 \n"
"	 b	loop%=        \n"
: [dac] "=m" (DAC)
);

mrburnette:

1-bit PDM DAC on the LPC.
16-bit 44100Hz resolution.

Impressive. What's next?
I still think that for the traditional Arduino dude and dudett out in the Ether, that the Catweazle needs to be tied into the Arduino world via a mini-shield or I2C and used as a co-processor... I/O over on the Arduino side and the LPC doing something that would put the Arduino into a deep sweat. I betcha a really decent MP3 decoder could be a reality.

Ray

It could be done in 2 ways.

Either you upload code the LPC shield through the ISP interface in which case it will remain between boots.

Or create a sketch on the LPC that uploads code to the 1K SRAM and executes it.
In that case you could have some reduced instruction set DSP code to just do your task and return the result.

SInce I've sacrificed the reset pin for an extra GPIO, the only thing that can reset the chip is toggling the power.
So it may be better to run code in the internal sram?