Welcome! Log In Create A New Profile

Advanced

Software phase, ARM Cortex_M3 STM32 based highly integrated control board.

Posted by grael 
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
June 02, 2009 03:37AM
Nothing like exposing your code to the world to make you aware of it's short comings... Have just edited smiley faces out " B ) " (without the space),
tidied up my SteppinOut routine, and then converted a * 4 operation to a << 2 operation !
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
June 02, 2009 04:50AM
If you want it to look pretty put code and /code tags around it in square brackets to prevent the whitespace being stripped and smileys appearing.


[www.hydraraptor.blogspot.com]
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
June 09, 2009 06:15AM
After some frustration with inconsistent startup behaviour with the PWM timer settings, that seems to change depending on whether I do a clean reset to flash code, or a bootloader reset to the same flash code, I decided I needed to work on another important step, which happens to be useful for diagnostics smiling smiley the LCD !

I found a demo LCD project on the net, that was for another ARM micontroller, and in C. After I/O pin and port modification to match my hardware, I found that although it was well written, the C syntax used didn't work on my build environment, so I spent some time massaging the code until it compiled without errors.

Finally I got it working tonight, so I tested it on a Jaycar 16 char x 2 line back lit display (slower, had to adjust the time a bit.), and then put it back on a spare 20 char x 4 line display I had in storage.

I have to do some simple code to get the display to show Hex, and at some stage, some more complicated code to have it show decimal. But at least I have a window into the unit now smileys with beer
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
June 09, 2009 09:07AM
I have now "blogified":
[grael-minifactory.blogspot.com]
smiling smiley
jbb
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
June 11, 2009 01:46AM
Hi guys

A few years ago I did a microstepping driver in C using an AVR. I've subsequently lost the code, but it turns out to be quite easy to do....

I ended up using an ISR and a few static variables. The basic idea is shown below (almost certainly won't work as is, though):

flash unsigned int LUT [] = [SINEWAVE TABLE];

ISR()
{
static unsigned int step = 0;

if (pos < target)
step = (step + 1) % NUM_MICROSTEPS;
else if (pos > target)
step = (step - 1) % NUM_MICROSTEPS;

PWM_reg_A = LUT[step];
PWM_reg_B = LUT[(step + NUM_MICROSTEPS / 4) % NUM_MICROSTEPS];
}

The speed was adjusted by changing the timer settings to get different interrupt periods. If you want to be able to adjust the average current you can multiply the LUT result by some suitable scaling factor. As an added trick, the LUT can contain a distorted sinewave to counteract non-ideal microstepping curves.

jbb
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
June 11, 2009 03:17AM
Hi JBB,
I'm using a very small array structure already for the PWM for each axis, so that's very easy to extend.

At the moment though, I'm irked that serial bootloader boot mode is leaving the chip in a different condition than a full reset. I can boot load, and have the chip seemingly dead, or only doing part of my set functions, or boot in flash, and it works.

I have quite a bit of work to do yet on the motion control, layering the functionalities, and synchronising the positions of each axis over time to achieve 3, or even 4D motion smoothly.

Coarse control, or following a list of coordinates at low speed would be a simple extention of what I've done so far, but I'm going to have to build a bit of a mathematical snake, to follow the curves.
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
June 16, 2009 07:29AM
Not much progress at all for the last week.
I've been having issues that I think are related to the default Raisonance Linker, and trying to figure out what I need for a link file that will work reliably for me.
Some discussion on my problem in this thread:
[www.stm32circle.com]

It's a bit discouraging to development when you know that despite your best efforts, something is likely to go wrong beyond one's own control.

Hopefully I'll sort out a proper link file this week, and then I'll be back into proper development.

The other basics I want to get operating are servo position setting, Power output control vis PWM, Piezo commands to send beeps of various pitches, and get the analogue to digital converter busy converting my chosen channels.
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
June 20, 2009 09:06AM
Some success,
notes added to my new blog (below)

Almost time to start on G-code processing and file transfer protocols, I have a little more I/O that I'd like to get running first though, ADC, keypad, axis limit testing, and at some stage I want to have the USB operational. I have Linux and Windows, I'll see what the python support is like for USB on the front end, else I might even dabble in C for the front end... radical, since I've only used python, VB/other basic or assembler before.

I had a good run of programming today.

[grael-minifactory.blogspot.com]

Edited 1 time(s). Last edit at 06/20/2009 09:08AM by grael.
can we have have access to individual pins like we do have in atmel
like PA9 =1 ;????????/
and if yes then how to find address of them.
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
July 04, 2009 08:49AM
ankit jain Wrote:
-------------------------------------------------------
> can we have have access to individual pins like we
> do have in atmel
> like PA9 =1 ;????????/
> and if yes then how to find address of them.


The pins on STM's STM32 ARM Cortex are arranged into 16 bit wide ports.
I have been using the firmware libraries, which makes some things easier, but some more challenging. I think easiest way to do what you want, is to define a macro to manipulate that specific port and pin, and then to use that macro, which may be defined in a device specific header.

Or are you asking for something more ?
actually i want to access individual pins to read encoder
and i dont have knowledge of arm and by going throgh datasheet i am getting that i have to access full port by gpio->idr. cant we just access single pin of the port
#define S3 0x2000 // PC13: S3
i also found this on net
how they got address of PC13
by this i may have access on each individual pin.
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
July 04, 2009 07:26PM
There's no assembler library for the ARM cortex that I'm aware of.
That's why, for the first time in my life I've switched to using C for embedded programming.

In C, all you need do is something like this:

If (GPIO_ReadOutputDataBit(GPIOx,PinNo) != 0 then {your required action}

However, you need to search on STM's website for the "STM Firmware Library".

If you're using an ARM Cortex made by someone else, then look up their documents. Your question is entry level, there's a lot more to do to make an encoder work.

Do a search on encoder inputs for microcontrollers, you will want to use interrupts to achieve any speed.


ST use 16 pins per port, I think Luminary or NXP use 32 pins per port on their ARM cortex
As a software engineer this is highly interesting to read. I'm approaching this from exactly the other side - I've just started to assemble parts for a repstrap with an LPC ARM from Philips (LPC2106 for main cpu) and I'm exploring what to do with electronics, making mistakes that even ten minutes later seem really stupid.

There was one small thing that I considered interesting:

if (phase & 2)==2
{
if (phase & 1)==1
action(3);
else
action(2);
}
else
{
if (phase & 1)==1
action(1);
else
action(0);
}

}

Why not

action(phase & 3);

? That should translate to three-odd instructions on any ARM and be as quick as any similar assembly, whereas the if/elseif construction would be interpreted as an attempt to make it exactly like that and probably be a bit slower and use much more instructions.
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
August 21, 2009 08:22AM
Hi Peter,

I'm still inexperienced at C programming.
How do you create the jump table that your "action(phase & 3);" would presumably refer to, and do you need an alligned vector table ?

The case statements in C aren't as good, timewise.

--------------------------------------

Anyone following this, I've taken over a month holiday from the Software, I started a very small RC jetboat design, moulded a couple of hulls, got some brushless motors and speed controllers from Hong Kong, and now I'm making a jet unit to suit... that's what this is for ultimately though, to CAD design and extrude my own.
Adding to that time out, my mother almost died last week, she contracted bacterial menningitis, and has been very lucky to appear on the way to a full physical as well as mental recovery.
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
August 23, 2009 07:07AM
Hope your mom is getting better quickly!

As for the STM32 Cortex M3, i'm really looking forward to see more of your progress here. I am still in the stage of planning details of my first repstrap, and i was actually already playing with the idea of making my own controller-board with an STM32 too. I am not familiar with these Arduino/Sanguino chips used in the original repraps. I am way more familiar with the Renesas 16- and 32-bit family and at work i am currently at a project with the STM32 M3 cortex. I do however use the Keil toolchain and the RTX OS from Keil, because that's what my boss told me to use. winking smiley

Hope to read up more progress reports to see how you get along with this controller.
Don't give up. I might help you some with the code. One piece of advice - use MOSFETs + MOSFET drivers for new board.
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
September 07, 2009 07:09AM
I haven't given up, just been slow.
I agree about the mosfets, but I want a compact solution for the stepper drivers.

I've been working on a couple of RC jet boats, this one's my latest:
[www.rcuniverse.com]

Brushless motor/speed controller and LiPo batteries have unbelievable power to weight ratios. This is my second brushless jetboat design, the first one was very overpowered.

I will be back developing this in due course...
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
September 27, 2009 06:34PM
Interesting project

I have been also looking at using an arm to build a cnc controller with a gcode interperter.

Is this project open source?

Can I get involved?

Cheers DeWayne UK
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
September 28, 2009 03:17AM
Dewayne,

I'm about to get started again, after seeing some youtube videos of sodium silicate sand core moulding it's got me quite excited about leveraging the power of a CNC machine to real world production tasks.

I've not made a decision yet about open sourcing the project, there are pros and cons on both sides.

So far, I've borne all the cost of the development. I feel I have a good pin assignment of the chosen microcontroller, and that I chose the right microcontroller for the task.

Where I'm struggling, is with the implementation of the "Mass Storage Device" protocol on my hardware implementation, and I'm unsure if it's a bug in my massaging of the sample code to fit my hardware, or that I have not done the STM version of the USB connection schematic, which is, to my mind, certainly not as simple as is a serial port with a MAX202 variant and it's charge coupling capacitors.

The pros to me, for releasing to open source, would primarily be in acceleration of time to production, and some standardisation on hardware configuration of compatible machines, with options to share custom code. I'm not too bothered about achieving fame, I'm already a legend in my own minddrinking smiley

However, as those of you here have seen, open source hardware has a habit of going to commercial manufacture, and whoever has the best manufacturing plant has the ability to leapfrog past those who've actually done the work. That's the whole reason I got into developing with microcontrollers in the first place, as they offer the equivalent of "trade secret" protection versus for example, the great global industrial patent fiasco.

At this stage, I'm not certain that I want to make the commitment to be a CNC machine manufacturer either! I like technical challenges, not beauraucratic ones.

So, anyone wanting this project to become open source, state your case, and let's see how it shapes up!smiling bouncing smiley

Graham Daniel
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
March 07, 2010 07:14AM
I've been busy with other things for some months, and just noted the Kartik M. Gada Humanitarian Innovation Prize.

Odds of winning it, split betwwen No of teams entering... whether professionals tweak their own products to grab it etc.

Naturally it occurs to me that my efforts could be a start for any other people wishing to be part of a team.

So, there's a bit more incentive for everybody involved.

Areas I'm good on: hardware.
I used to be very good on software, but I'm inexperienced in ARM and C, so this one has been a double whammy for me. I haven't checked out ST's toolchain for revisions in last several months... the raisonance one was/is? very quirky, a bit incomplete.
I'm also pretty innovative.

I'm not methodical. I fit the ADD with hyperfocus character type, rather than normal methodical, or Aspergers etc. These personalities all fill real world ecosystem niches, and likewise, they all fit into development teams.

If you're interested, private or public message me, and we might have a chance at building an awesome machine, minor fame, and a prize, or part of one. Apparently the prize is based on contributions, not necessarily one final package.

At some stage, I want to do a first revision of the board, and would welcome suggestions.smileys with beer

Graham.


My CNC/extruder creation: [grael-minifactory.blogspot.com]
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
March 07, 2010 01:32PM
grael Wrote:
-------------------------------------------------------

> At some stage, I want to do a first revision of
> the board, and would welcome suggestions.smileys with beer

I think that we should go with cheap and powerfull (than actual AVR Arduino) ARM Cortex M3. NXP LPC have a few ones, ST also. Xduino is a Arduino using ARM Cortex from ST :-)

Why can't we develop our hardware and put the PCB on selling like on shops like BatchPCB?

We have a lot of problems because Makerbot is the only source for electronics and they don't have in stock the boards!!! :-(

Let's go and define and make our electronics, to be cheap and let after the online shops sell it for us :-)


---
New cutting edge RepRap electronics, ARM 32 bits @ 100MHz runs RepRap @ 725mm/s:

[www.3dprinting-r2c2.com]
Re: Software phase, ARM Cortex_M3 STM32 based highly integrated control board.
March 08, 2010 02:38AM
casainho Wrote:
> I think that we should go with cheap and powerfull
> (than actual AVR Arduino) ARM Cortex M3. NXP LPC
> have a few ones, ST also. Xduino is a Arduino
> using ARM Cortex from ST :-)
>

Cost is often a function of volume. There are many STM ARM cortex-M3 variants, with varying pricing. Personally, I don't consider this chip to be expensive, however, it remains to be seen how the foundation will determine public cost, how is a machine to be marketed, and yet free from markup? Who volunteers to keep the hardware current with current technology?


> Why can't we develop our hardware and put the PCB
> on selling like on shops like BatchPCB?

Certainly that's possible, commercially though, there ought to be some long term win for the developers. In the case of Ubuntu for instance, the win is in technical support for companies.

If people associate you with the product, then you may be able to make a living as a consultant. Or, you can switch to being a designer/operator.

In any case, to run large scale production efficiency, there has to be someone/s managing production tasks, and sales.

> We have a lot of problems because Makerbot is the
> only source for electronics and they don't have in
> stock the boards!!! :-(
Case in point, Zak was preeminent on the reprap.org hardware design team for some time. This sort of cycle can repeat, some different people, different product. Zak said their stuff is all open source I believe... so unless their policy changed, you could set up your own production.


> Let's go and define and make our electronics, to
> be cheap and let after the online shops sell it
> for us :-)
Still needs overseeing the processes. Give it to someone advanced, and they improve the product, self brand it, and it looses it's open source nature.
avr
December 15, 2010 01:58PM
hi
every body my name is saeid kamali .
just i start to studied avr . if you know abut dc ampermetar & rc brushless speed control based avr software & hardware , please help me.
sakamali44@yahoo.com
Sorry, only registered users may post in this forum.

Click here to login