Thread: Raspberry Pi
Hybrid View
-
27-09-2012 #1
I had a bit of a leap backwards when I discovered the STM32F103 doesn't take ARM instructions, it's all THUMB-2 and relative, icky pooh, so I'm now writing in C.
I had a bit of a leap forward when I discovered the port bit set reset register GPIOx->BSRR
It's a 32 bit register for a 16 bit port, set a bit in the top half and you set a pin, set a bit in the bottom half and you reset the pin. Fiendishly useful if you are sharing the port with other peripherals you don't want to touch.
The port control registers come in Low and High GPIOx->CRL GPIOx->CRH with 4 bits per port which is conveniently one digit in Hex so you can see what you are getting in the way of inputs and outputs at a glance. For example:-
GPIOB->CRL = 0x22222222; Gets you 8 push pull outputs b0-7 on Port B
Much easier to see what is going on a glance.
I have a rudimentary 4 axis stepper written, now I need to get data in to it. I've bought a 4Gb micro SD card. If I can dump the entire cut into it then I can stop worrying about drip feeding and comms errors, just have it send reports on a timer tick so I can do fancy graphics on the PC. Watch out, SD cards come with a "Class" number which is the transfer rate in MHz, if you don't see a Class number assume it's slow, I got a Class 4.
-
27-09-2012 #2
Running my Pi(s) on 16Gb class 10s now (yes my second Pi arrived), courtesy of SavaStore, cheap and improves performance and memepory issues are a thing of the past. 2.9Gbyte for the OS and 12Gb+ for a step buffer - can't see any job needing more than that! But other things are taking my time now so this is stalled a while.
-
05-10-2012 #3
Took me a while but I now have it stepping
Not usefully stepping, just moving back and forth in 4 axes at 4 different speeds, over and over again. Looking good.
I am running everything on one timer interrupt. The interrupt collects 4 absolute co-ordinates from the buffer, along with a couple of speeds. It moves there. It comes back for more. Simples.
I was thinking to make the Z and W axes optional but there is no point it's so blooming fast. 40kHz step rates look easy, I could probably wind it up to 70kHz mid line. I usually run at 3kHz top whack.
These ARM Coretex processors may have a bit of a vertical learning curve but are well worth the effort. They have so many built in goodies I am barely scratching the surface.
-
05-10-2012 #4
-
05-10-2012 #5
Fiction is far more plausible when wrapped around a thread of truth
Nothing great was ever achieved without enthusiasm.
Ralph Waldo Emerson
-
06-10-2012 #6
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
cnc print a raspberry
By george uk in forum General DiscussionReplies: 7Last Post: 13-06-2014, 01:13 PM -
Raspberry Pi as a PC + Mach3 .. very possible
By Fivetide in forum General ElectronicsReplies: 2Last Post: 05-09-2012, 11:18 PM
Bookmarks