StartOS

AnatoliyBesplemennov
Hello!

 Meet StartOS. (Hope you like it)
It's small OS which is working with SD Card up to 2GB with FAT32.
It gives users API  (Text, Graphic, Uart, ADC, TouchScreen,..)
And can Load&Run your progs from SD. (Any in BIN format)

Please look at http://www.youtube.com/watch?v=IWbghZRn3uM (draft video)

NewComers
Hi Anatoliy,

I want to make program like this, what should i prepare? Please advice.

regards,

AnatoliyBesplemennov
Hi NewComers, glad to see you.

 This work was began with No OS Application at March,2011.
( http://www.youtube.com/watch?v=DTvWTj6NwBg )
 I offered this device to one Italian Firm. Then I say I can start
programming it. And Italians are thinking...
 I continued my work and next was STARTOS. It does all duty work.
 You should prepare: Inatialization of All components: PLL, MMU, Ports, LCD
ports, mode & ScreenBuffer, IIC, UART. Working with SD Card as described in
Samsung S3C2440A UM. Then FAT32 specification. Finelly, User Prog must do
system calls to OS procedures. It was done via SWI mechanism. (I dont like
the way how it done in ARM - I saw much better). And you must combine and
compose all this in one organizm.
 Before doing so, my advice: think twice or even more - may be it NOT
needed to anyone!
 I hope to get some money for my work and develope it, but now I think
-nobody is interesting, my time was wasted...
Regards,

AnatoliyBesplemennov
NewComers,
 little remark: if you will use STARTOS programming became so easy, that
could be done even by teenager. Source code of Step Motor control is
includded as Demo Example.

Anatoliy Besplemennov
Now I think this Forum is DEADZONE!

 Nobody is interesting of nothing.

ELCouz
Just look at the forum system...useless big guestbook
Limited support and community..

At least they should have a ENGLISH forum like arm9home.net

I would be more interested to contribute here if forum get improved...

davef
ELCouz,

?? The ENGLISH link on arm9home.net appears to bring you back to here.

Anatoliy Besplemennov
I said such about this forum because many people ask about standalone
applications, and when I try to give it them, they don't answer.

 Formula is: User Prog + StartOS = Standalone Application.

 People became lazy and glamouros - they want GUI doing all work for them.
 They want someone like Android man (it look like Teletubes for kids in my 
   sigt). And glamour magic and NLP works!

Anatoliy Besplemennov
// Simpliest Example - Running String

char txt [5]={"Hello"};  

void Main(void)

{  int  i;

  for  ( i = 136; i > 8; --i )
  {
    //  X   Y  String
  Print_String (  i,  150, "Hello, World!");
  Print_String (  i,  170, txt);
  Delay  (20);    // Delay 20 mS
    
  }

  Exit  ();    // Exit to OS

}

Ferite
Excellent Work!. Impressive video.

If it wasn't for my limited skills in C, it were an interesting OS to
explore.

Anatoliy Besplemennov
Hello Ferite!

 Thank You for support! You are the First who liked it.

 You may not belive, I started with C on March,2011.
 Also I say in C++, C#, I understand Nothing! It looks like Musical note
with diez sign for me. So I'll NEVER learn Linux. (Windows too).

 Reading ADC in Linux - you have to read Driver, read Pipe, then read array
with Data. In real time Object will Fail!

 Compare with StartOS: 
    ADC_data = Get_ADC(0);      // Only one comand it took ~50 uSec
    Set_Font ( 1, Yellow, 20);  // and Print it OR Control smthg
    Printf( 50, 70, "ADC Channel 0 = %03d", ADC_data);

 Ferite, main is your Desire. And you will programming in C during weeks!
 It's easy like Basic. There are lot of programs! You can only adapt them.

 By now I not decided where to store StartOS files. So if you want I'll
send them to your e-mail.
 You'll see by yourself how it is easy.
 Regards!

Ferite
Do you mean you built an OS from scratch in 4 months without previous
knowledge of C?. It's amazing. Where did you learn the neccesary skills?.

I think you should make a small site for your project, like some people
have did it here. For instance, this guy developed a program to download OS
images to the board from  64 bit PCs:

http://mini2440.netyxia.net/viewtopic.php?f=11&t=2

or this guy that have helped many people with his drivers and tutorials:

http://www.domodom.fr/spip/index.php?lang=en

I think Google Code is one of the best hosting choice for your site and
your project files:

http://code.google.com/hosting/

My last advice is that you should talk about your project in other site
more community and hobbyist oriented. I dont know why, I have the notion
that most persons enter to this site to solve a particular problem they
should fix for their works, so there is not time or interest in
contributing in a project like yours. But it would be a shame that such
great work like yours, were wasted only becouse your audience on this forum
is not the right one.

Thanks and best regards.

Anatoliy Besplemennov
Ok, Ferite nice meet you again. There were times early. First time I saw C
in 1985 on DEC PDP-11. It's sintaxis I found complex. There was Age of
Assembler. I learn it very well as RT-11 - the real time system from A to
Z! Then was Assembler IBM PC (Intel x86) and MS-DOS. Motorola ASM and
PalmOS, Atmel AVR ASM and now ARM. Assembler for ARM I'll learn too.
 C languige is simple indeed. Lot of good books. You can try it, I can help
providing examples. C++, C#, Jawa I just start (some Progs for Mobile
phones). They aren't for me. I always needed total control over Computer.
 Thank You for advice, I feel that Site is needed, just want be shure that
my work is interesting for someone.
 In few days I will post STARTOS somewhere. (There is some problems with
Floating numbers output - Code Worrior's system function vsprint works bad
and need be replaced. Or I'll do alter way for print it.)
 

 Thanks and Good Luck!

Anatoliy Besplemennov
Download StartOS you may here:

http://code.google.com/p/startos/

(Thank to Ferite)

oro06
great, more than interesting
thanks & regards
OR

Ben
Hi Anatoliy,

At first, thanks for making your software available to the public.

I would like to try it, but reading the StartOSen.pdf it says to unpack
STARTOSx35.BIN and flash it to the Mini2440.

However, I can not find the STARTOSx35.BIN, there is a file STARTOS.bin but
I would like to make sure that is the right one for a 2440 with W35 screen.


The address to flash the startos.bin to, is it the same for 1 GB Nand
Mini2440 ?

I did run into many problems getting my Mini2440 to run what I want to that
I hope I can get your software to work.

(Consider a Paypal Donate button on your code.google.com page....)

Kind regard,

Ben

Anatoliy Besplemennov
Hi Ben,
 I'm sorry. STARTOS.bin is exactly for mini2440 with Sony X35.
 I bougt them 3 pcs - at all of them Startos work fine. If anybody have T35
or NEC35 I can change binary for them.
 Load address is 0x33D00000. First, for testing you may load in SDRAM with
[d] command. If everything world be Ok, perform [a] for burning in NAND.

 Also I have 7" A70 display. And 1 GB board. Today I will test 1GB board
with x35 LCD. And tell results. I think - it's no difference for load.
 Then (if anybody needs) I change system to fit A70.
 You can copy your NAND to Hard Disk.

 Ben, this work just began. I want to know what people say about it.
 So, you quistions and opinjon is very important for me.

 I dream to continue and develop it.

 My best wishes,
 Anatoliy

Anatoliy Besplemennov
Ben,
  I was tested System on board with 1 GB NAND Flash.
  It works Ok. I think at any sizes of NAND it will be good.

  In Downloads I placed STARTOSx35.bin. (To exclude misunderstoods)

  (it's good idea to save your NAND on Hard Drive by DNW command [u])

 Thanks for kindness,
 Anatoliy

 P.S. Excuse me for orphograf. mistakes.

Anatoliy Besplemennov
Hello Ben,

 I just found what is W35 LCD.
 It has width 320 and heigt 240 pixels.

 While Sony X35 has vice versa.

 So I need time to rebild Screen timing parameters.
 Also may be string output must be turned.

 I'll buy this LCD on eBay.

 Anyway you can try it with DNW [d] command (in SDRAM). It's safe!

 Let's some time wait...

 Anatoliy

Ben
Hello Anatoliy,

I did give it a try. I do use the USB loader in combination with Putty on
an Ubuntu 11.04 system. I boot the Mini2440, get Supervivi. Use f to
format, then load ram at the given address, and start the USB upload from
another terminal session with 

pe2bz ~/s3c2410_boot_usb:$: sudo ./s3c2410_boot_usb STARTOSx35.bin
csum = 0x8eff
send_file: addr = 0x33f80000, len = 0x00009a80
Sending Chunks..........
Sent: 39552 bytes

Downloading complete, no errors

Then I think I should be able to start the "STARTOSx35" with the command go
0x33D00000 but as you can see below an error message appears:

Supervivi> load ram 0x33D00000 39552 u
USB host is connected. Waiting a download.

Now, Downloading [ADDRESS:33d00000h,TOTAL:39562]
RECEIVED FILE SIZE:   39562 (38KB/S, 1S)
Downloaded file at 0x33d00000, size = 39552 bytes
Supervivi> go 0x33D00000
go to 0x33d00000
  argument 0 = 0x00000000
  argument 1 = 0x00000000
  argument 2 = 0x00000000
¨HøFailed initailizing heap region
Sorry. We can not run vivi


Am I taking the wrong steps ?
Thanks for your time and support,

Kind regards,

Ben

Ben
Hello Anatoliy,

it is getting better: If boot the Mini2440 and use Q to enter Supervivi I
can choose d (= download and run) and then start the upload from another
terminal screen. After uploading I get a message that it is uploaded to
33f80000 and the Mini2440 boots and shows me a screen to calibrate.

As expected it is in the wrong orientation but I can see a part of the blue
dotted screen.

I hope you can make another version of the loader with 320 width and 240
height. 

At least now I see the time and date on top of my screen ;-)

If I do a load ram 0x33f80000 39552 u and upload the file and start it with
go 0x33f80000 I get the same error as in the message above.

I am considering to start a forum subject somewhere so it is possible to
edit posts and add screendumps....

Kind regards,

Ben

Anatoliy Besplemennov
Ben,
 In case of Windows all is simple.
 No need to perform formatting. 
 In Archive STARTOS.rar is DNW.exe utility for Windows (XP or 7).
 1. Turn off power.
 2. Connect USB cable and COM cable to Board simultaniosly.
 3. Move switch S2 in NOR position.
 4. Run DNW.exe on Desktop or Notebook/Netbook.
 5. Turn on Power by S1.
 6. On DNW window in Congiguration Option Set: Com1, 115200 kBod, and
address    0x33d00000. (They must be already there)
 7. On DNW in Left Upper corner [Serial Port] Press Connect.
    Now your Computer plays terminal role.
 8. Press [Enter] or [d] on Desktop Computer Keyboard.
 9. Program must start immediately.
  (then usially do [a] command but your LCD is NEC W35 with other params)
    I had already order mini2440 with W35. When I get it, I'll adapt OS.
  We will do it. Thank you very much! 
 P.S. Tell me please you preffer Landscape or Portrait orientation of LSD?

Anatoliy Besplemennov
I disconnect LCD from board.
 When STARTOS runs it produces short beep onto piezospeaker.

 No matter, with [d] command it launched, or after power on (when it seats
in NAND by [a]).

 If it tweets, prog works.

 (Now I can do test prog. Even without any LCD it will play some sounds.
 It may be writed on SD card, with name START.BIN and will be launched
automatically.)

Ben
Anatoliy,

I will give it another try tomorrow with Windows and DNW.exe

For now, it does work in the download and run mode from Linux PC, try to
flash it to NAND afterwards.

I prefer Landscape, but if it's not a big problem for you I would consider
creating 2 StartOS versions one for Landscape and one for Portrait.

Best regards,

Ben

Anatoliy Besplemennov
How istall StartOS when Desktop PC is Windows driven.

http://www.youtube.com/watch?v=kDQFkJJ4IL8

oro06
Hi Anatoliy,

any chance to have this working on mini6410 ?

Anatoliy Besplemennov
Hi oro06,

 I think - Yes!

 But now I'm in Sorrow - few people are interesting.

 Yesterday I ordered mini2440 with NEC W35 LCD.

 Soon I'll transfer OS on mini2440 with A70 LCD

 If it will be needed, of coarse, I get mini6410. It attracts me.

 Also I have lot ideas for developing OS.

Ben
Dear Anatoliy,

I tried to send you an email with a StartOS question but nothing to do with
the Mini2440. I used the mail address from the google code page which I
assume was long tolk at g mail dot com and then without the spaces.

Can you give me your email address ? Or if possible, send me a message at
eigenwys at binik.nl 

Kind regards,
Ben

Anatoliy Besplemennov
e-mail me freely on:

 anjulu@mail.ru
 longtolik@gmail.com

sanjeewa
hi All ,
Im new to this field.i have 2440 core board.its OS was "Qtopia" but no any
documents there, so could any one guide me how to get start with this
board.
thank you.

vib
Hi Anatoliy,
I am interested, would you send me a copy of the OS please?
My email is vibnwis@yahoo.com

Anatoliy Besplemennov
Hi sanjeewa,

If you want to program it in C easy, you can begin with StartOS.


Look at:

code.google.com/p/startos

If you want only to play with it - try Linux and Qtopia, you have it
already.

dezso
I'm interested to for 6410 porting

Steve
Hi Anatoliy is StartOS open source? I have the T35 screeen and I wanted to
compile the code for that, but there is no source code :(

Anatoliy Besplemennov
Hi dezso,

if I'll be shure that people are needing - of coarse, I'll do porting to
6410. Also I'll port it to STM32. And onto very interesting board coming
soon from Friendly ARM.
What I need? - I need to buy Boards and time. (And during this work I need
some money for living. I already spent lot of time but didn't get one
single dollar...)

So, in case of success on mini2440 platform, I immediately will work with
mini6410...

Please write your opinions, I need them!

Anatoliy Besplemennov
Hi Steve,

I've put the file for T35 to code.google.com/p/startos.

Please tell me results - if it works wrong, I must remove it from
Downloads.

What about open source - I was planned this work will be one of my
permanent works. I can do so much for developing...
But if I'll post source code - I'm afraid nobody even say me Thanks.

If I will find sponsor(s) or companion(s) and we'll decide some politics we
may publish it.

armarm
Hi Anatoliy
I have few questions if you don't mind,
you developed your OS in ADS1.2 ?
and the applications for your OS are also supposed to be developed in
ADS1.2 ?
The point is that the ADS is kind of old and limited IDE
and I don't like to use it.
I'd like to use IAR for example or something like that.
can you give an advice about this ?

thanks

Ann R. (Russia)
Hi, Anatoliy!
Are you Russian?

--
Best wishes,
Anna Rassudova
Tomsk, Russian Federation

Steve
Thank Anatoliy, I had tried and did not work I follow your video,
http://www.youtube.com/watch?v=kDQFkJJ4IL8

I press d , load bin file, it restarts by itself(I know because the USB
gets disconnected), but nothing shows on the screen,

Anatoliy Besplemennov
Armarm,

I lanched different binary (.BIN) files.

I have Keil and will download IAR and try them both.
At very beginning I was tried Keil, but if it produce error - it is very
hard to recover it. Support almost absent.
Also I'm planning to make an example in Assebmler.

I'll try remastering examples in IAR and place them in download section.
Ok.

Anatoliy Besplemennov
Hi, Anna!

It's very pleasant surprise to meet you here!
Yes, I'm Russian and live in Vladikavkaz.
This place practice English so if you want - you may write on
anjulu@mail.ru or longtolik@gmail.com

Regards!

Anatoliy Besplemennov
Steve, 
I placed StepT35.bin you can test load and run it. And new variant of
StartOS for T35.
Sony X35 and TopPoly T35 have almost the same timing. You can try X35
version too.
I bought mini2440 on March and June and there were different sizes of
EEPROM.
First, please try StepT35.bin. It don't use EEPROM for store Screen
calibration Data and must work.

Then try STARTOS_T35P.bin. Now it uses EEPROM from 0 address.

Tell me please what size of SDRAM has your mini2440.
StartOS you can load from 0x33D00000 or 0x30000000 with [d] command. But
after loading it moved itself from NAND to 0x33D00000 in SDRAM. So, if you
have less then 64 MB it cannot work. (I can lower down the Address of
loading).
Thank for patience. If we continue, we'll win it.

vnb
Anatoliy, have you been here ?
http://roboforum.ru/forum96/

Steve
Anatoliy, thank you it works!! :)  I have 128 MB DDR SDRAM 
,TopPoly T35 and it did what you said

Now, Downloading [ADDRESS:33d00000h,TOTAL:39606]
RECEIVED FILE SIZE:   39606 (38KB/S, 1S)
Downloaded file at 0x30000000, size = 39596 bytes

Anatoliy Besplemennov
Thank Steve!

I'm glad too.
If you have any questions feel free to contact me.

Now you may load it in NAND Flash with DNW [a] command..

Anatoliy Besplemennov
vnb,

yes, I'm registered there.

new
Hello everyone
I am new to mini2440 and do not have any experience in this field. I a
working on NO OS application. Can anyone plz tell me how to display a text
on the mini2440 lcd screen. In the 2440 test provided, a bitmap image is
displayed. but no idea how to display any text
please help...

Anatoliy Besplemennov
Hello new,
1.You can produce BMP file with Letters images in Paint for example. Then
with this file you can get C source. And finely depending of symbol code
you can out corresponding part of bitmap as rectangle 8x16 or any other
size. You can find out this technology in Hello2 and Stepmotor examples on
code.google.com/p/startos.
2.You can use Font editing program (evafont.exe or GLCDFontCreator.exe) for
making dotted font: 1 Bit = 1 dot. 8x8 font will be 2048 Bytes. Then output
 corresponding dots onto LCD with ADD, OR, XOR, etc. operation with LCD
memory.
3. You can download StartOS, learn examples, make your own Program, name it
START.BIN, write it on SD card. And it will be launched after 5 seconds
since Power is On.

Ehsan Zargar
hi AnatoliyBesplemennov ,
this is a great work,
I am very interested in expanding it, is it possible to download the source
code of StartOS?
i need to add some drivers such as ethernet stack or writing files on SD
card.

Anatoliy Besplemennov
Hi Ehsan Zargar, thanks!
At present I don't plan to publish sources because I want this work became
my business in IT field and give me some money.
I want to develop it by myself when it'll bring me some benefits.

You can easy add functions ("drivers" in your notation) into StartOS.c.

It will be better then implant them in kernel. Because when user program
will use them - they will be added to program. In other case - not.

Writing files is simple but writing records in FAT32 occupies lot of
memory. So I've remove it from OS. (And keyboard too...)

OS don't limit user - you can install ISR, write into ports, work with DMA
MMU...

Icarus
Hi Anatoliy,

Came accross this thread while searching for some other No-OS information.
I am yet to try your binaries, but plan to do so, since it looks quite
promising. A very basic question is, from a developer standpoint how does
one use StartOS for further application development ?

You seem to have hosted the files on Google-code portal and cited GPLv3
license. That is for what part of your work ?

Maybe, you could consider a dual-license strategy to make some money and
also ensure some level of community contribution to carry this work
further, making sure that this doesn't lose steam.

Cheers,
Icaru

Anatoliy Besplemennov
Hi Icarus,

for further application development everyone can add his own code to
StartOS.c.  For example, in this manner I added function printf().  So, if
User program will use printf() this function will be added. If not -
nothing will blow up nor user program neither StartOS kernel. (vsprint as
part of printf occupies 9 kBytes - one quarter of StartOS.bin)

 Working with Keyboard also may be done in StartOS.c but not in Kernel. 
Next would be User's Fonts 16x9 and so on. Send/receive data to/from
Internet as Server and/or a Client. Loading BMP, JPG, WAV (MP3) files.
Speech synthesizer which user can rebuild for his language. And
multitasking.

 Thank you for advice. I was on administrative work more than 11 years. Now
I quit those business and want return to programming and engineering. I
don't know about those licenses so now I put "other type". I've only
registered this program on my name in Russia.
 What is it "dual-license strategy" and how I can make some money I don't
know. I would be like to get money for life and continue some kind of IT
work. But at present I have nothing (even no comments).
 I respect community and want to discuss how it will be better for all. 

 Regards,
 Anatoliy

Icarus
Anatoliy,

Thanks for the explanation. Looks like there'd be a lot of work for me to
get a micro libc type implementation before I can start doing other
interesting stuff on StartOS.

As for "Dual-License Strategy" it is quite simple. You permit people to use
StartOS under GPLv3, where in they cannot make proprietary derivates.
Whatever enhancements/changes are done, need to be contributed back as
GPLv3 back to the community. This way, folks who are not averse to GPLv3
can contribute and StartOS can grow/mature faster. However, people who do
not want to share the derivative work, can pay you license fee, and acquire
StartOS under a paid proprietary license, and do not have to contribute
back their changes to community. This is how many (I might say all)
commercial ventures with open-source at their heart, are operating today.

regards,
Icarus

Technicavolous
Anatoliy

I would suggest you go the dual license as Icarus suggests. We are very
interested in working with your OS and support the OpenSource philosophy.
We encourage developers like you to pursue the dual license route as we can
learn and contribute to your cause, and purchase if we decide to
commercialize ourselves.

I think you're on the right path! Great "start" ;]

Anatoliy Besplemennov
Thanks!

ahmet
hi everybody
 I can use gpio control in console but ı don't know to use gpio in Qt
widget project. I need some tutorial and example project.
other problem how I count gpio number.
(I set up rootfs in my mini2440,)

Daniel
Hi Anatoliy,

Im a engeneering student here in Brazil, and start with ARM. I have some
doubts about StartOS, follow:
- At english manual, you said that assume we are using "Metrowerks
CodeWarrior for ARM suite v 1.2", but I cant find it for download at
internet, only newest and paid versions, can I use other one with StartOS?
If affirmative, do you have a tutorial for this?
- My 2440 kit use the W35 LCD, I read above that there isn't a OS version
for this, am I correct? How can I use OS and then?

Please, I know that my questions are very basic, but if you can help me,
I'll so glad for you.

Regards

Daniel

Mesih
Hi Anatoliy,

I have problem with startos.I loaded startos_n35.bin in nand flash by using
dnw.when i boot mini2440 (with nec 3.5" screen) i get calibration screen
but when i tap screen it always says getsd beep and white screen, endless
loop.

I am sory for my bad english.I hope that I make myself clear :)

Regards

Mesih

Anatoliy
@ahmet: I met difficulties with Qt, thus I made startos. It's simple.

@Daniel: you can try to search ADS 1.2 on DVD shipped with mini2440. It's
old program and I don't know where to buy it. Also you can download trial
versions of Keil and IAR (free of charge for code limit <32kB).
You may download StartOS for W35 LCD at:
http://code.google.com/p/startos/downloads/detail?name=Start_W35.bin&...
it named Start_W35.bin.
It came from the Portrait 3.5" version so some design work is needed.
When I'll have time I want to redraw all interface and add functions.

@Mesih: I don't have mini2440 with N35 LCD and cannot buy it anywhere. Some
people said that they tried to load STARTOS_N35.bin 2 or 3 times to force
it work. Try to load STARTOS_X35.bin for Sony LCD. Then load
STARTOS_N35.bin again. You can use first DNW [d] command to load it in RAM.
Finely it must work.
 Also please perform 2440test and lunch EEPROM test - it clears mini's mind
 You have good English, I'm sorry for my own one - I live in Vladikavkaz
near Georgia and not far from Turkey :)

 In case of problems, let me know, please!

Mesih
Thanks for instructions Anatoliy.I made it work :)
EEPROM was the problem.I used 2440test for EEPROM and problem solved but
now problem is touch screen :) Although i made the calibration right, touch
screen doesn't work properly.I have to press right upper for red g button
but it is not problem :) Thanks for startos I couldn't control gpio but now
i can and it's so simple to use my own programs :)

Anatoliy
Mesih, thank you for kind words.
It seems like that touchscreen had changed it's resistors ends.
Maybe when calibrating you tap another corners (instead upper left tap
upper right or lower right and so on).
And EEPROM test will clear calibration data so you can start again.
My best wishes.

Nanda Fathurrahman
Hello Anatoliy,

i want to make a project that display text on LCD VGA (1024x768).. is your
StartOS could help me?
I use KEIL as my IDE..

Regards,
Nanda

Anatoliy
Hello Nanda,

  you can try uCosII - it's good for this purpose.
7" LCD A70 is working slightly slower then 3.5" LCDs when outputting the
whole screen. VGA will be slow too.
I don't have such adapter but I can generate version with VGA timing
parameters.
  Also VGA don't has touchscreen, so we need to think about input device
(if it's needed). Variants are: the Palm portable keyboard connected via
RS-232 port, COM Mouse or IR receiver from TV set. Even from Internet or
SMS.

  Will be better if I'll buy the adapter, but it'll take up to 30 Days for
delivery form China.
  Currently startos has 8x8 normal and bold fonts. For VGA must be at least
9x16 or bigger. Or Graphic font as in Hello2 example.
  Please think and let me know about it.

Nanda Fathurrahman
Hello Anatoliy,
thanks for the response

I already have the Mini2440 with the LCD to VGA adapter(i dont have the 7"
LCD nor the 3.5" LCD). i have make my project from several source like the
2440test source code and uCOS source code.
To access the LCD(1024x768) I use the function and library from 2440Test.
I can acces the LCD but only limited to put pixel and create rectangle.
I search some library or tools to make me can display "Text" so I find uCOS
demo for the LCD(1024x768) displayed the counter of clock and date, so I
begin to copy its functions to my project but I get confuse how it really
works...

my goal of this project is to display the CD card contents to LCD(1024x768)
by using low level programming in C.

Nanda Fathurrahman
correction : not 'CD card' --> I mean 'SD Card' :-)

Nanda Fathurrahman
one more wish, could you send me the starOS with VGA timing version to my
email:

nanda.fr07@gmail.com

Thanks.

Anatoliy
If you can put pixel - that's all you need to put all.
Ok, I'll write to email.

Nanda Fathurrahman
Attachment: Main.c (12.27 KB)
it's true that my code is able to put pixel (my code is on attachment), but
for put pixel to form a Text it's totally new for me..
I don't know how to do that, do you have any suggestions?

I have tried your LEDs.rar and I tried to run it on Mini2440 from supervivi
menu [d] but nothing happen.
Am i have to put the .Bin file to SD card first?
Am i have to install StartOS on Mini2440 first?

Thank you

brox
To display arbitrary text you should have font data. For example, if it is
8x8 matrix font you can have array of 256 chars of 8 rows and 8 columns
each. It is convenient to describe each row with 1 byte, then each column
will be represented with correspondent bits of that byte. When the font is
defined you have most of dirty work done. Then your program should address
some piece of font array using character code as index (multiplied by 8, of
course). Then just put all nonzero pixels in the appropriate screen places.
Thats it)

Nanda Fathurrahman
Attachment: Font_Libs.c (1.58 MB)
Hi brox,
thanks for replying

Actually i have the Font data (i put it on the attachment), is that what
you mean?
I still confuse to write down the program, did you have any example for
that?
 
Regards,
Nanda

Anatoliy
Nanda, first you must load startos binary in RAM [d] or in NAND [a].
Then write LEDs.bin (or other .bin) on SD and put it in mini2440.
When you turn mini On, Startos will launch it from SD.
What about Fonts? You have two choices:
1. Write Char as rectangular area on LCD. This is described in Hello2
project.
2. Write Char bit-by-bit, If bit=1 - dot color=Forecolor, else dot
color=backcolor
In this case Font 8x8 and 256 char/codepage will have 2048 bytes only, 8x16
- 4096 and so on
You can use utils for preparing as Evafont, GLCD_Font_Creator, etc.

Proc is simple:
void  Print(int x0, int y0, char *txt);

void Print(int x0, int y0, char *txt)  // txt - pointer on char string
{  int x,y,z,s,p;
  int w=8;  // Width
  int t=8;  // Height
  y0=y0-t;

  for(s=0; txt[s]!=0; s++)
  {
  x0=x0+w;  // moving to right along the screen
  z=txt[s];  // get symbol code

  p=z*8;     // pointer to char definition in buffer onto next
  
      
  for(y=0; y<t; y++)
  {  for(x=0; x<w; x++)
    {
      if  (font8x8[p+y]&(1<<x))
        {  
          LCD_BUFFER[y0+y][x0-x]=Fore_Col;
        }
    }
  }
}
const unsigned char font8x8[] = {
   // 8x8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //  000
0x7E,0x81,0xA5,0x81,0xBD,0x99,0x81,0x7E, //  001
0x7E,0xFF,0xDB,0xFF,0xC3,0xE7,0xFF,0x7E, //  002
0x6C,0xFE,0xFE,0xFE,0x7C,0x38,0x10,0x00, //  003
0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00, //  004
.................................................
};

andromeda
hi,

i have lcd 7" innolux for mini2440, startos work with this lcd ?

if yes, where can i download startos for mini2440 lcd 7" ?

thanks in advance.

AnatoliyBesplemennov
Attachment: S_A70L.bin (38.62 KB)
hi, andromeda,
  for a while please try file in attachment. It's not polished in design
and screen calibration parts.
  I plan to remaster the program and add functions and wikis.
  If you'll find it useful it'll give me force to continue.

andromeda
thanks. I'll test it and I'll let you know.

andromeda
i can't test because i have windows 7 64 and drivers SEC S3C2410X don't
work in win7 64. may be one day, drivers will be create for windows 64.

Thanks.

wingston
andromeda, the drivers that are there on the latest cd install for windows
7 64bit.. when i connected, it found the required drivers on windows
update. keep the mini2440 powered onto nor, connect usb and wait for
windows 7 to finish. if requuired go to device manager and try updating
manually.. it works

andromeda
driver 100ASK JTAG and 100ASK Serial Port is ok but drivers for usb host
connected to mini2440, SEC S3C2410X Test B/D is no ok.
i attempt to download cd mini2440 20110421 and test it.

thanks.

Vikram Tamboli
I tried S_A70L.bin but it gives me nothing on the screen.
Just a beep.
Is it mandatory to copy the programs on SD card and insert that SD card
into board.

andromeda
i installed windows 7 x32 and loading this file in my micro2440, but
nothing, the screen is black, dscard is inserted with a file example.

AnatoliyBesplemennov
Attachment: S_A70L.bin (39.01 KB)
Please excuse me - don't checked I've posted wrong file.
  The file in attachment works. Need to be speed up and designing.

  Important: if as the results of wrong tapping while doing screen
calibration you'll find problems with calibration you may perform EEPROM
part of 2440test.
  Note: occasionally I found out that  2440test_A70.bin don't work, don't
worry, you may use ANY 2440test for any LCD due it works via COM Port. -
Simply load&run it with DNW [d] command, in menu press [7] and it'll flush
the EEPROM.

  My best wishes

andromeda
now is ok for programm, i have blue screen and in the bottom left
G and abc, but sd card don't work.
i have formated the sd and put two files hello1.bin and hello2.bin.
and reboot board micro2440 but nothing appear, i have tested too formating
sd in fat16.

my sd is transcend 4 go

andromeda
I have message No/Slow SD in bottom right screen.

Anatoliy
The 4 GB SD card is SDHC I think. Mini2440 and it's SoC Samsung S3C2440A
don't supports SDHC. It only accepts SD cards up to 2 GB. I tested startos
on 1GB standard size SD and about five micro SDs form different vendors and
being formatted with FAT32. Also they show different speeds. Please read
brief User manual from code.google.com/p/startos
 Thanks for patience.

andrey
Hi Anatoliy! A want to ask you about multitasking. Can StartOS support more
than one thread ?

anatoliy
@andrey,
 right now - not. In future I plan to perform it, but time is needed.

 It's not a trivial theme, for instance if you are working with Keil you
can include it's RTOS in your project. You'll define Task1, Task2, etc. and
compile them with Keil's OS. You can use FreeRTOS, NutOS and others in such
manner. You'll get the binary file, write it on SD card and give it to
startos.
 Sometimes it's more easy to manage your tasks by yourself. RTOS may bring
you head ashes.
 Two-three Tasks may be running simultaneously without OS at all. Device
can generate interrupts and set up Flags and your main loop can analyse
what device need to be serviced. Even when device hasn't interrupt
capabilities, you can program one of timers for interrupts and periodically
look what happens in physical level.

 P.S. Years ago on IBM PC (with experience from DEC PDP-11 in RT-11) I've
done SCADA program. It was mighty to control Board for multiplexing
channels, gather sensors' data (60 pcs) and 60 manually inputted by
operators, write data on HDD, transfer them via Ethernet, translate Speech
via SoundBlaster when parameters run out of the limits, produce lot of
texts and graphics. Also it's kernel worked in TSR mode. There was an OS or
no? Now I look at some RTOSes - there are the same.
  Now it is attractive to make such OS in which tasks appears, look at
situation, perform necessary acts then disappears. Pieces of code are
stored as records in Database and blocks of data control the code's
behavior... Sorry for wasting your time while reading.

brox
andrey,
There is nice realtime OS with multitasking support, and it is already
ported for mini2440. I mean uCos-II, of course. It has beautiful
documentation and working examples for each type of LCD. The only con -
currently you need ADS1.2 for developing your applications, which is
outdated ages ago. Right now I'm transferring uCos2 to use modern Keil
ARM-MDK toolset. As soon as I have first working build I'll share the
project with community.

anatoliy
uCos cannot launch programs from SD and some other things.
 Also the Micrium said: We start pricing with a Single Product license
http://www.micrium.com/page/products/licensing_pricing:
uC/GUI $9,000
uC/OS-II - $6,750
 Do you want to buy it? 
 It has about 30 fonts, but user needs 2..3 but good and means to build his
own font and so on.

brox
&#1058;&#1099;
&#1085;&#1072;&#1084;&#1077;&#1082;&#1072;&#1077;&#1096;&#1100;,
&#1095;&#1090;&#1086; &#1074;&#1079;&#1103;&#1074;
&#1080;&#1089;&#1093;&#1086;&#1076;&#1085;&#1080;&#1082;&#1080; Startos
&#1080;&#1079; &#1086;&#1090;&#1082;&#1088;&#1099;&#1090;&#1099;&#1093;
&#1080;&#1089;&#1090;&#1086;&#1095;&#1085;&#1080;&#1082;&#1086;&#1074;,
&#1080; &#1079;&#1072;&#1082;&#1088;&#1099;&#1074; &#1080;&#1093; &#1089;
&#1094;&#1077;&#1083;&#1100;&#1102;
&#1087;&#1088;&#1086;&#1076;&#1072;&#1074;&#1072;&#1090;&#1100;,
&#1090;&#1099; &#1087;&#1086;&#1089;&#1090;&#1091;&#1087;&#1080;&#1083;
&#1073;&#1086;&#1083;&#1077;&#1077;
&#1095;&#1077;&#1089;&#1090;&#1085;&#1086;?

brox
Oops, it looks like forum does not support cyrillic...
So you think it is more fair to create Startos from open sources (2440test
and ucos2), and close them afterwards? Moreover, you put it on Google code,
which is meant to serve opensource projects?

anatoliy
2440test I was used for learning purposes and parts in which there was not
Copyright notes. When you buy a Board, there must be some documentation or
not? For IBM PC there is a lot of docs about hardware, BIOS calls, DOS
calls, Windows. Also 2440test's sources contain errors everywhere. So I was
used Samsung S3C2440 User manual - it is open for public.
 ucos2 I didn't touch and read at all, it's protected.
 From code.google.com I'll go out soon.
 And I get no one single dollar.

andromeda
my sdcard it was sdhc, i have buy 2go sd and now is ok.
thanks.

guest
There is one more project http://code.google.com/p/rt-thread/ which can be
used on mini2440. It is open source and has much more interesting things.

anatoliy
B.t.w. still don't understand: how one can build OS from tests (they suit
for device drivers), then hide it (how it's possible, all is open!), why
someones interest startos sources and don't look at tests instead. :)
 Startos' sourse contain some know-hows, had passed expertize in Russian
patent organization and is registered.
 It was offered to the Micrium, so it can not contain uCos code by default.
 At code.google startos became project not about the StartOS, but about
sketch-by-sketch learning programming with using it and with source codes.

 Rt-tread is serious real OS, recomend it.

 What for me- to exclude insinuation talks I don't want to use copyrighted
sources.
 I think so: or someone give sourses as gift, free of fee, or don't publish
them at all.
 ARM SDKs copyrighted the Startup codes. What we get? When you write
program in SDK it's impossible not include startup, and you automatically
must pay to SDK's owner. So I did independent Init codes w/wo interrupts.
I like Samsung, it says: Copyright (c) 2003 SAMSUNG Electronics.
 # However, Anybody can use this code without our permission. 

 Suppose you want to connect FA to Internet. You can use DM9000.pdf,
DM9000 uP/ISA MAC Programming Guide, or ENC28J60.pdf from Microchip, WIZnet
iEthernet W5100 with embedded TCP/IP stack. Last costs ~$9 and you don't
need to pay for programming license...

brox
I'll try to explain why I was suspecting StartOS to be derivative of
2440test.
I disassembled Startos binary. Its easy - just 30K of code. I see almost
exact startup code as in test sources mentioned. What is different - you
added SWI handler as syscalls dispatcher. This might be know-how, I agree.
As for drawing graphic primitives like rectangles and lines... They are
definitely not know-how :)
SD card support code may become know-how, as soon as you'll implement real
filesystem.
Please, no offense :) You did a good deal of work, but it is far from the
point you can gain money of it

anatoliy
It's Ok brox,
 no unusial and quet explainable with startup. In this forum in topic
"FriendlyARM and Hiteg" was said: "FA boards are based on the Samsung
Development Board." Samsung was first who provided startup code. FA added
some hardware and corrected startup too.
 Devices are initialized accordingly their Datasheets, thus there is often
only one way. But I still want to reduce code. SDKs offer their own start
up codes for boards.

 30 K is my proud. It is easy to build big program and hard to optimize it.
Now startos is the seed, embryo. And may be porting for instance, on
Arduino Due,  LPC or STM32 boards.
 Regards

Anatoliy Besplemennov
Hello Anatoliy Besplemennov,

It is amazing that I know the StartOS here. I am planning to buy the
Tiny6410 board for software development. There are many discussions on FA
product in Chinese but not very much in English. I believe that the problem
came with the FA English Forum is not know for most English-speaking users.

May I know that whether your StartOS still works for Tiny6410 FA board?


Eric
PS: I had used PDP-11 before when I worked in an old-well logging company.

anatoliy
Hello Eric,
  I'm sorry, but I don't have Tiny6410. I still have much things to do for
mini2440, but have no time - need to think about other works.

Dex
Hi anatoliy,
            Great work with StartOS, i have written a number of OS
including one for mini2440, using 100% assembly (fasm)
One thing you will not get, is much in the way of thanks, most just want to
rip your code :(.

The best way to make money, is to sell the dev boards along with a manual
and code to teach coders to code for embedded sys.
There is a good demand for that in the UK, if done right.
Keep up the good work.
Regards Dex.

brox
Anatoly,
I can't get one thing you mention in the manuals: "To  transmit  width  and
 height  as  function’s  parameters  is  impossible  due  SWI  (SVC)
mechanism limitations. It uses only up to 4 registers for interchange data
between System and User layers"
Does it actually mean "due to StartOS SWI implementation"? (Because ARM
architecture itself does not have such limitation, of course. You can use
stack for extra parameters; also you can pass a pointer to structure of
parameters, or in the laziest case you can combine Uint16 bitmap dimensions
into 32 bit registers)
Best regards

anatoliy
Ok Brox, there are no limits.
First I thought so reading books about ARM.
Pointer is used when reading touch screen coordinates. First is flag, then
X, then Y. Also your advice to use Uint16 is good. I plan to polling X&Y
and to transfer them in one 32-bit word.
  Good luck!

Vernon
/tmp/ccF2Xukk.s:48: Error: unrecognized relocation suffix -- `bl
SWI(_Print_String)'

I attempted to compile the StartOS.c file with the arm-linux-gcc compiler
on Ubunto. This so I could modify one of the Hello word examples and
compile my owm application. The compiler did not like the _Print_String and
one other asm statement (error above). I took those out and it compiled.
Any suggestions ?

I don't have the board yet, it is on its way, but I am trying to get a head
start with StartOS. 

What would be the procedure for building an executable binary modified from
Hello2.c ? At first I would just change the message. Do I have to link
Hello2.c with StartOS.c somehow ? What do I need for a make file ? 

As you can tell - I am new at Linux and FriendlyARM. Did HS12 assembler on
a PC previously.

Wingz
Vernon, 

i think startOS is mostly aimed at a windows based development environment.
It is compiled on Keil uvision or ADSv1.2 (from the examples on the blog).
And it is a very good bit of programming by Anatoliy (kudos to you mate). I
learned a lot about the mini2440 when i was working with the startOS code.
But it has its limitations if you want to do some serious development. The
limitation being theres only one person working on it! 

Both of these (keil and ADS) are proprietary compilers from ARM. Why dont
you go FOSS? If you are running an ubuntu box why dont you check out the
ptxdist mini2440 BSP project. Its has a very nice support system for
newbies and the quickstart they provide you with itself can get you up and
running. Its a little more work than just compiling code, but i feel that
its really worth the time you put into learning embedded linux!

anatoliy
Vernon tried to compile wrong stuff. All example projects are ready to use
and modifying. I'll give him step by step instructions via email.
 @ Wingz thanks. I think to continue development. StartOS lets the user do
all things with hardware on their own demands. But people want to be
provided with more system functions. And they will get some of them.

Vernon
I was able to get ADS1.2 running and compiled and built the Hello2 example.
I then made a modification (added a couple of lines) and noted that the
size of the resulting binary changed - so it is working. Now I just have to
wait until the board gets here and then practice installing and running
binaries. 

I will probably try two paths - a Linux application and a StartOS
application. 

Anatoliy - I appreciate both the help and the OS !

anatoliy
Vernon, please don't forget to write your binaries onto SD card 1-2Gb and
FAT32. Good luck!

Vernon
I have a book coming on ARM assembly language because I want to set up
registers to use the SPI. As far as the setup in StartOS - are you using
Bigendian or Littlendian mode ? ARM or Thumb ? What modes are operative
when it gets to my main.c program ? 

Do you plan on adding SD card file utilities ? I would like to open a txt
file for storing data at some point. 

I am still waiting for the board - should be here around xmas.

Vernon
I noted that the factory test code has the following file 2440addr.h. This
gives a list of definitions that correspond to peripheral addresses for the
SPI module and so on. Do you have such a file for StartOS ? Can I include
2440addr.h in a program for StartOS so I can use these references to set up
the SPI or other feature ?

brox
Vernon,
StartOS itself operates in ARM mode (including call to Main() function),
but you still can use #pragma thumb in your C code. 
As for SD card utils I recommend you take a look into ChaN's FAT file
system implementation: http://elm-chan.org/fsw/ff/00index_e.html
If you going to program in arm assembly language, use ARM mode, little
endian. And yes, everyone is using 2440addr.h :)

DexArm
@Vernon, StartOS is made up of the code from 2440test with like bits added.

DexArm
Also i have written a simple ASM ver of my OS for the 2440, i can dig it
out if you want.

Vernon
Yes, I would like to see your .asm file. I have been thinking about a
construct to configure the timer. I believe that I should use the following
general method appended to the StartOS.c file. The #defines are copied from
2440addr.h and are shown here just for reference, since they are already in
the h file they would not actually appear in my code. Is this the right
syntax to use in configuring a peripheral ? 


#define rTCFG0  (*(volatile unsigned *)0x51000000)  //Timer 0 configuration
#define rTCFG1  (*(volatile unsigned *)0x51000004)  //Timer 1 configuration
#define rTCON   (*(volatile unsigned *)0x51000008)  //Timer control
#define rTCNTB0 (*(volatile unsigned *)0x5100000c)  //Timer count buffer 0
#define rTCMPB0 (*(volatile unsigned *)0x51000010)  //Timer compare buffer
0
#define rTCNTO0 (*(volatile unsigned *)0x51000014)  //Timer count
observation 0
#define rTCNTB1 (*(volatile unsigned *)0x51000018)  //Timer count buffer 1
#define rTCMPB1 (*(volatile unsigned *)0x5100001c)  //Timer compare buffer
1
#define rTCNTO1 (*(volatile unsigned *)0x51000020)  //Timer count
observation 1
#define rTCNTB2 (*(volatile unsigned *)0x51000024)  //Timer count buffer 2
#define rTCMPB2 (*(volatile unsigned *)0x51000028)  //Timer compare buffer
2
#define rTCNTO2 (*(volatile unsigned *)0x5100002c)  //Timer count
observation 2
#define rTCNTB3 (*(volatile unsigned *)0x51000030)  //Timer count buffer 3
#define rTCMPB3 (*(volatile unsigned *)0x51000034)  //Timer compare buffer
3
#define rTCNTO3 (*(volatile unsigned *)0x51000038)  //Timer count
observation 3
#define rTCNTB4 (*(volatile unsigned *)0x5100003c)  //Timer count buffer 4
#define rTCNTO4 (*(volatile unsigned *)0x51000040)  //Timer count
observation 4

// the following would be added to StartOS.c to configure the timer
// prescaler and the same syntax used for the rest of the timer control
// manipulations. These are example values.

// Prescaler desired value = 128 for timer 0 and 1
// 0x80

// Same for timer 234 0x80

// no dead zone 0x00

// no reserved 0x00

// value is therefore 0x00008080

*rTCFG0 = 0x00008080;

// the above places the right value in TCFG0

Vernon
In addition to setting up the timer I am interested in adding a timer
interrupt FIR to StartOSinit.s (as used in the stepping motor example) this
routine would read an A/D and store values in an array. If anyone has any
assembler code that does this sort of thing I would appreciate 
looking at it. Alternatively - if anyone has written an interrupt service
routine in C - that would also be good to look at. 

I am still waiting for my assembly language book that I hope will make
things clearer (I am used to HS12 assembler).

AnatoliyBesplemennov
Attachment: ARM.jpg (150.98 KB)
From what startos was made we already discussed. 2440test was used for
reference example at early stage - why not study it? (Let's make OSes from
tests). And I want to write it in Assembler too.
 @Vernon, you can read settings in any Example project as shown in picture
in attachment.
 What about "open a txt file" - by now I have not time for it. (Also, open
for what? reading, writing? This operations may be with waiting or with
putting request to queue.). If simple read/write - they don't demand much
time for programming.

To get 1 mS interrupts you can assume PCLK=20

#define  PCLK  20

 void Init_Timer4(void)
{
  rTCON &= 0xff8fffff;
  rTCFG0 &= 0xffff00ff;
  rTCFG0 |= 0xf00;  
  rTCFG1 &= 0xfff0ffff;
  rTCFG1 |= 0x10000;
  rTCNTB4 = PCLK;  // 1mSec Interval value   
 
  rTCON |= 0x200000;
  rTCON &= 0xff8fffff;
  rTCON |=  0x500000;

  pISR_TIMER4= (int)Timer4_ISR;
  rINTMSK &= ~(BIT_TIMER4);  //  EnableIrq(BIT_TIMER4);
}
  ASSEMBLER BOOK SEARCH IN ADS DOCs! It is there.
  Any time want understand how it works - Right Click on the File in ADS,
choose Disassemble and you'll see an Assembler text!

brox
Anatoly, PCLK is frequency in Hz, its typical value is 50000000, not 20Hz

anatoliy
There are changes in other numbers...
 PCLK in mine notation is only the NAME of variable. If you don't like it -
just rename it as you wish.

  rTCNTB4 = 20;   // this is better?

  This works and gives me 1 ms intervals. From them I can produce 1 sec
intervals or any other.

  I wanted to help Vernon and for him is hard to have a deal with PLL
turning.
  I'll not read any texts except S3C2440A User manual and all values will
pick with experimental way....

brox
PCLK is APB Bus clock signal, as defined in the S3C2440A User's Manual. Of
course you can write in your code:

for(int PCLK = 0; PCLK < 8; PCLK++)
  printf("Hello\n");

but this is very misleading to others.
Also, Vernon was asking about isr, not initialization code

anatoliy
I know about it. I wanted to remove it from the User code.
 Instead of it I pick up numbers for getting 1 mS interval.
 It was produced months ago, but I still don't clear garbage from code.

 This is ISR:

static void __irq Timer4_ISR(void)
{  int i;
    timer1ms++;

  if(++MiliSecCount==1000)
  {
    MiliSecCount = 0;
    timerSec++;
    second = 1;
    
  }

  rSRCPND |= BIT_TIMER4;    //Clear Source of Interrupt
  rEINTPEND |= (BIT_TIMER4);
  rINTPND = (BIT_TIMER4);    //Clear Interrupt Pending// 
ClearPending(BIT_TIMER4);


}

Vernon
Thanks ! This will be designed to feed the algorithm below. I wrote this on
a PC and it generates its own set of samples to test the result. The idea
is to sample every 22.5 degrees of two 60HZ waveforms (a power system
voltage and current) and then essentially do a rectangular to polar
conversion of data samples that are 90 degrees apart. The angles are
subtracted for each set of samples to produce a relative phase angle. The
actual interrupt will be every 1041 microseconds and will read a 16 bit A/D
converter (that I will connect to the camera port) - the results will be
loaded into the sample array instead of the calculated values in the test
program below. 


#include <math.h>
#include <stdlib.h>


float AMPS[32];
float VOLTS[32];
float XANGLE[32];
float IANGLE;
float VANGLE;
float XVANGLE;


float ANGLE;
float parameter= 0;
float degree = 0;

float x  = 0;

float q  = 0;
float qa = 0;
float a  = 0;
float b  = 0;
float c  = 0;
float ct = 0;
float vt = 0;
float at = 0;
float xzat = 0;
float iw = 0;

int j = 0;
int i = 0;
float convert = 0.0174532925;
float radian = 0;

unsigned int f;
int iquad = 0;
int vquad = 0;

float y(void);

dtor (float x)
{
    
  float y = x * convert;
    return (y);
}



int main ()

        


{ 
        while (1)
        {
           
        system("cls");
        printf("ENTER PHASE ANGLE\n");
        scanf( "%f", &parameter);
        xzat = parameter;
        
        
  
        
        
//1 degrees = 0.0174532925 radians
         q = convert * 0;
         AMPS[1]= sin(q) * 5000;
         q = convert * 22.5;
         AMPS[2]= sin(q) * 5000;
         q = convert * 45;
         AMPS[3]= sin(q) * 5000;
         q = convert * 67.5;
         AMPS[4]= sin(q) * 5000;
         q = convert * 90;
         AMPS[5]= sin(q) * 5000;
         q = convert * 112.5;
         AMPS[6]= sin(q) * 5000;
         q = convert * 135;
         AMPS[7]= sin(q) * 5000;
         q = convert * 157.5;
         AMPS[8]= sin(q) * 5000;
         q = convert * 180;
         AMPS[9]= sin(q) * 5000;
         q = convert * 202.5;
         AMPS[10]= sin(q) * 5000;
         q = convert * 225;
         AMPS[11]= sin(q) * 5000;
         q = convert * 247.5;
         AMPS[12]= sin(q) * 5000;
         q = convert * 270;
         AMPS[13]= sin(q) * 5000;
         q = convert * 292.5;
         AMPS[14]= sin(q) * 5000;
         q = convert * 315;
         AMPS[15]= sin(q) * 5000;
         q = convert * 337.5;
         AMPS[16]= sin(q) * 5000;
         q = convert * 0;
         AMPS[17]= sin(q) * 5000;
         q = convert * 22.5;
         AMPS[18]= sin(q) * 5000;
         q = convert * 45;
         AMPS[19]= sin(q) * 5000;
         q = convert * 67.5;
         AMPS[20]= sin(q) * 5000;
         q = convert * 90;
         AMPS[21]= sin(q) * 5000;
         
         qa = (-22.5 + (360 - xzat));
          
         q = convert * (qa + 22.5);
         VOLTS[1]= sin(q) * 25000;
         q = convert * (qa + 45);
         VOLTS[2]= sin(q) * 25000;
         q = convert * (qa + 67.5);
         VOLTS[3]= sin(q) * 25000;
         q = convert * (qa + 90);
         VOLTS[4]= sin(q) * 25000;
         q = convert * (qa + 112.5);
         VOLTS[5]= sin(q) * 25000;
         q = convert * (qa + 135);
         VOLTS[6]= sin(q) * 25000;
         q = convert * (qa + 157.5);
         VOLTS[7]= sin(q) * 25000;
         q = convert * (qa + 180);
         VOLTS[8]= sin(q) * 25000;
         q = convert * (qa + 202.5);
         VOLTS[9]= sin(q) * 25000;
         q = convert * (qa + 225);
         VOLTS[10]= sin(q) * 25000;
         q = convert * (qa + 247.5);
         VOLTS[11]= sin(q) * 25000;
         q = convert * (qa + 270);
         VOLTS[12]= sin(q) * 25000;
         q = convert * (qa + 292.5);
         VOLTS[13]= sin(q) * 25000;
         q = convert * (qa + 315);
         VOLTS[14]= sin(q) * 25000;
         q = convert *  (qa + 337.5);
         VOLTS[15]= sin(q) * 25000;
         q = convert * (qa + 0);
         VOLTS[16]= sin(q) * 25000;
         q = convert * (qa + 22.5);
         VOLTS[17]= sin(q) * 25000;
         q = convert * (qa + 45);
         VOLTS[18]= sin(q) * 25000;
         q = convert * (qa + 67.5);
         VOLTS[19]= sin(q) * 25000;
         q = convert * (qa + 90);
         VOLTS[20]= sin(q) * 25000;
         q = convert * (qa + 112.5);
         VOLTS[21]= sin(q) * 25000;
         
// the above creates the simulated array of sampled values for algorithm
test
// signal processing is below         
         
         ct = 0;
         vt = 0;
                  
         for ( i = 1; i < 17; i++ )
            {
              
             a = AMPS[i] * AMPS[i];
             b = AMPS[i+4] * AMPS[i+4];
             c = a + b;
             c = sqrt(c);
             ct = ct + c;
// Pathagorean theorem gets peak value from samples 90 degrees apart
             AMPS[i]=AMPS[i]+1;
             AMPS[i+4]=AMPS[i+4]+1;
             VOLTS[i]=VOLTS[i]+1;
             VOLTS[i+4]=VOLTS[i+4]+1;
// add one to avoid divide by zero
             IANGLE = atan(AMPS[i]/AMPS[i+4]);
// get angle in radians
          if (AMPS[i] >= 0 & AMPS[i+4] <= 0) 
                   {    
                   IANGLE = 3.14159 + IANGLE;
                   }
          if (AMPS[i] <= 0 & AMPS[i+4] <= 0) 
                   {    
                   IANGLE = 3.14159 + IANGLE;
                   }
          if (AMPS[i] <= 0 & AMPS[i+4] >= 0) 
                   {    
                   IANGLE = 6.28318 + IANGLE;
                   }
             a = VOLTS[i] * VOLTS[i];
             b = VOLTS[i+4] * VOLTS[i+4];
             c = a + b;
             c = sqrt(c);
             vt = vt + c;
             VANGLE = atan(VOLTS[i]/VOLTS[i+4]);
          if (VOLTS[i] >= 0 & VOLTS[i+4] <= 0) 
                   {    
                   VANGLE = 3.14159 + VANGLE;
                   }
          if (VOLTS[i] <= 0 & VOLTS[i+4] <= 0) 
                   {    
                   VANGLE = 3.14159 + VANGLE;
                   }
          if (VOLTS[i] <= 0 & VOLTS[i+4] >= 0) 
                   {    
                   VANGLE = 6.28318 + VANGLE;
                   }
             ANGLE = IANGLE - VANGLE;
             ANGLE = ANGLE * 57.2957795;
          if (ANGLE <= 0)
                 ANGLE = ANGLE + 360;
// pi = 3.14159 
             XANGLE[i] = ANGLE;
             }
         
         ct = ct/16;
         printf("AMPS %4.2f\r\n", ct);
//gets average of 16 calculations to reduce noise in actual system         
         vt = vt/16;
         printf("VOLTS  %4.2f\r\n", vt);
         at = 0;
         for ( i = 1; i < 15; i++ )
               {
                if (XANGLE[i] >= 359.9)
                   XANGLE[i] = 0;
                    
                at = at + XANGLE[i];
               }
         
         at = at/14;
         printf("ANGLE %4.2f\r\n", at);
         printf("TYPE any number and enter key to repeat\n");
         scanf( "%f", &parameter); 
          }
             
}

Vernon
I put some comments in to describe my understanding of how it works. To me
it seems that this PCLK value should be around ~ 814, not 20. I guess the
important thing is to get it working, toggle a GPIO bit and then verify
with a freq counter. 

#define  PCLK  20

 void Init_Timer4(void)
{
  rTCON &= 0xff8fffff;
// this appears to mask out timer 4, shuts it off

  rTCFG0 &= 0xffff00ff;
// mask out prescaler for timer 2,3 and 4
  rTCFG0 |= 0xf00;  
// or in, set prescaler to 15
  rTCFG1 &= 0xfff0ffff;
// mask out mux 4 - set to 0 
  rTCFG1 |= 0x10000;
// or in to set to divide clock by 4
  rTCNTB4 = PCLK;  // 1mSec Interval value   
 
  rTCON |= 0x200000;
// turn on update for timer 4
  rTCON &= 0xff8fffff;
// mask it off again 
  rTCON |=  0x500000;
// timer 4 auto reload on, no manual update, 
// timer runs. 
// Timer input clock Frequency = PCLK / {prescaler value+1} / {divider
value}
// = 781250 so each count is 1.28 microseconds. I think I should define the
PCLK
// above to some other name - maybe XCLK - to prevent confusion. It would
seem
// that the value for rTCNTB4 should then be 814 to get the right sample
interval. 

  pISR_TIMER4= (int)Timer4_ISR;
  rINTMSK &= ~(BIT_TIMER4);  //  EnableIrq(BIT_TIMER4);
}
  ASSEMBLER BOOK SEARCH IN ADS DOCs! It is there.
  Any time want understand how it works - Right Click on the File in ADS,
choose Disassemble and you'll see an Assembler text!

//below is interrupt service routine

static void __irq Timer4_ISR(void)
{  int i;
    timer1ms++;

  if(++MiliSecCount==1000)
  {
    MiliSecCount = 0;
    timerSec++;
    second = 1;
    
  }

  rSRCPND |= BIT_TIMER4;    //Clear Source of Interrupt
  rEINTPEND |= (BIT_TIMER4);
  rINTPND = (BIT_TIMER4);    //Clear Interrupt Pending// 
ClearPending(BIT_TIMER4);


}

brox
Vernon,
When you target for ARM CPU, try to avoid floats. ARM processors don't have
floating point support. Also try to avoid divisions (there is no such
instruction) and standard math functions. Write your own fixed point
library. Use precalculated tables - and your procedure can be 100 times
more effective.
Happy coding)

Vernon
I will probably change some of those to integers - but, I used integers and
tables on the current 16 bit, 16 MHZ HS12 and was hoping I could do some
serious number crunching at 32 bits and 400 MHZ. 

Horsepower is really not that critical. I will sample for 2 HZ of the 60HZ
signal and then as long as it calculates and updates the screen in the
third cycle (16.6 milliseconds) I will be more than happy. 16 milliseconds
is a long time at 400 MHZ. A few updates a second is just great.

DexArm
@anatoliy,
         Do not miss understand me, i am not saying theres anything wrong
with using 2440test code, thats what it there for.
And you have turn them into something very useful :).
DexArm

anatoliy
@DexArm,
         thanks, it's Ok. test2440 is a very good school. I think without
them it's impossible to know how to work with devices thus they have custom
design and connecting schematics. Startup code is standard enough too.
  What about OSes (you plan to make one of them) - it's interesting but one
man made OS in several tens lines of assembler code. It is mykeRTOS
described in "Handbook of Microcontrollers" by Myke Predko. His OS also is
multitasking! And there are sources in CD with the book.
  Regards,
  Anatoliy

DexArm
Thanks anatoliy, i will see if i can get "Handbook of Microcontrollers" and
take a look.

When my new board comes (dropped the old one), i will code some FasmArm
demos, to run from your StartOS.
Regards DexArm.

Vernon
I should get the FriendlyARM next week ! I was wondering about the image
data in the stepping motor program. Apparently it takes two bytes to
provide the color info for each pixel. What is the format for this ? Which
bits control what colors ? I made a 24 bit color Windows bitmap and ran a
program called image2code.exe but it insists on making an 8 bit per pixel
grey scale result. - all the byte data is the same for a solid red bitmap
(or any other color). What is a good tool to use for this picture to C
array conversion ?

AnatoliyBesplemennov
Attachment: BMP2H.rar (638.24 KB)
Vernon, there's the Graphic Example on code.google.com/p/startos (and BMP2H
is there too in the Archive STARTOS_X35P.rar)
here is piece of it:

//(0x1F<<11)|(0x3F<<5)|(0x1F) ) R G B
#define Yellow  0xFFE0  //  R=F800, G=07E0, B=0000, 
#define White  0xFFFF  //  R=F800, G=07E0, B=001F
#define Red  0xF800  //  R=F800, G=0000, B=0000
#define Green  0x07E0  //  R=0000, G=07E0, B=0000 
#define Blue  0x001F  //  R=0000, G=0000, B=001F 
#define Yellow  0xFFE0  //  R=F800, G=07E0, B=0000,
#define Black  0x0000  //  B = 0,  G = 0,  R = 0
as you can see there're 5 bits for Red, 6 bits for Green and 5 bits for
Blue = 16 bits total

to convert 24 bit BMP image use BMP2H Utility (I found it on DVD for
Friendly ARM and send you in attachment)
You only need to find out proper Buttons (1-st is Open BMP and so on). If
not find - I can try to break it on resources, translate and assemble.
It'll be in English.
 Next you can to edit source you get looking at Examples.

And the Important note:
Some users report when they first time try to load StartOS it's cycling and
rebooting while the Screen Calibration.
In this case please run once test2440 in EEPROM part. Then StartOS must
work.
I think it's because possible differences in hardware made in various
years.
Also StartOS writes the Touch Screen calibration data in EEPROM with
another methods then test2440 (do it fast).
 P.S.In your Board with A70 LCD corresponding test2440 may not work at all
(as in mine case) - don't worry, try to launch test2440 for ANY LCD, any
way test use PC as the terminal via COM Port.

DexArm
@Anatoliy, Do you have any support implemented for VGA in StartOS ?, as
that's the ver i just bought.
As i would like to test it.
Thanks.

Vernon
Thanks ! BMP2H would probably work if I knew what buttons did what.

Vernon
Ok - since I didn't know what buttons did what I devised a method that I
will try. I downloaded an image editor called GIMP 2.6.2. I have Bloodshed
Dev-C++ on the PC. The GIMP program lets you draw (or import) your bitmap
and save it in 16bpp 565 format. I then wrote a program that will import
file C:\ARM\convert.bmp and output a file C:\ARM\convert.c. 

http://www.cttestset.com/convert.bmp (this is a sample bitmap that I used)

http://www.cttestset.com/bitmap.exe (this does the conversion)

Below is the first few lines of the result - it is formatted as 20 columns
in Notepad (that is the reason for the line feeds here). It does the whole
file in case you want the header info and then points to image
start. You would just copy and paste everything after that into your C
array. When the board gets here and I get StartOS loaded I will know if
this works. 


0x42,0x4d,0x46,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x38,0x00,
0x00,0x00,0x50,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x01,0x00,0x10,0x00,0x03,0x00,
0x00,0x00,0x00,0x32,0x00,0x00,0x13,0x0b,0x00,0x00,0x13,0x0b,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,
 0xe0,0x07,0x00,0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  IMAGE START->>>  0xff,0xff,0xff,0xff,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,

Vernon
I had to adjust the output by one byte (I uploaded fixed exe). I made a
blue bitmap in paint, loaded it into GIMP, saved it as 16bpp 565, and ran
bitmap.exe to produce the following. Note the color is blue after "Image
Start". 

0x42,0x4d,0xbe,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x38,0x00,
0x00,0x00,0x54,0x00,
 0x00,0x00,0x53,0x00,0x00,0x00,0x01,0x00,0x10,0x00,0x03,0x00,0x00,0x00,0x78,0x36
,0x00,0x00,0x13,
 0x0b,0x00,0x00,0x13,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0xf8,0x00,0x00,
 0xe0,0x07,0x00,0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,
  IMAGE START->>>  
 0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f
,0x00,0x1f,0x00,
 0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00
,0x1f,0x00,0x1f,
 0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f
,0x00,0x1f,0x00,
 0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00
,0x1f,0x00,0x1f,

Vernon
Made a tool to convert windows "Paint" 24 bit bitmaps to an array - so
there is no need to have GIMP. 

http://www.cttestset.com/bitmap24.exe

http://www.cttestset.com/mapx.bmp

The above is a red test bitmap and I tested it with white and the principal
colors. 

Below is the first few lines of the program output. You can delete or
comment everything before image start. 

PROGRAM CONVERTS 24 BIT WINDOWS BITMAP T0 
 16 BPP (BITS PER PIXEL) 5 6 5 FORMAT 
 Red = 0xF800, Green = 0x07E0, Blue = 0x001fF 
 Use data after IMAGE START->>> as C Array 
 
 FILE HEADER
 0x4a,0x1d,0x02,0x80,0x00,0x00,0x30,0x00,0x00,0x05,0x00,0x00,
 0x02,0xa0,0x50,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0xb0,0x0a,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  IMAGE START->>>  
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,
 0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,0xf8,0x00,

Vernon
Note:

You need a directory C:\ARM and the bitmap must be named mapx.bmp and be in
that directory. The output will be in convert.c in the same directory.

AnatoliyBesplemennov
Attachment: 2Vernon.rar (107.22 KB)
Vernon, you've done very good deal for all.
One thing I want to ask: please take in consideration that before bytes
wich correspond the graphic image
there must be four bytes

     from stopped_as_char.c file (from attachment):

// The first pair of two bytes represent width of image (w=0033), first
byte is LSB, second byte is MSB
// The second pair of two bytes represent height of image (h=0006), first
byte is LSB, second byte is MSB
// these bytes must be includded in source and define width and height of
outputting image area
  char stop[] =// w=0033, h= 0006
{33,0,6,0, 
0x54,0x14,0xff,0xf0,0xff,0xf0,0xff,0xf0,0x00,0x00,0xff,0xf0,0xff,0xf0,0xff,0xf0,

0x00,0x00,0x54,0x14,0xff,0xf0,0xff,0xf0,0x00,0x00,0x64,0x96,0xff,0xf0,0xff,0xf0,

0xff,0xf0,0x00,0x00,0x54,0x14,0xff,0xf0,0xff,0xf0,0xff,0xf0,0x00,0x00,0x54,0x14,

0xff,0xf0,0xff,0xf0,0xff,0xf0,0x00,0x00,0xff,0xf0,0xff,0xf0,0xff,0xf0,0x00,0x00,

0x54,0x14,

     and from bigger fon.c file (from attachment):
// The first pair of two bytes represent width of image (w=0240), first
byte is LSB, second byte is MSB
// The second pair of two bytes represent height of image (h=0320), first
byte is LSB, second byte is MSB
// these bytes must be includded in source and define width and height of
outputting image area

// w = (240)+(8<<0) = 240
// h  = (64)+(8<<1)   = 320

#define WIN32
  //  240x320  in 4 Bytes    64  +  1*256  =320
char fon[] = {  240,  0,  64,  1, 

   /* scan line 1 */
   
#ifdef  WIN32

  there're 2 BMP files and prodused source files in attachment. They may be
used as "experimental rabbits"

 More graphics is stored in Pictures folder of the project in
code.google.com/p/startos

 I agree that all this makes users' life complex and try to find good
strategy to load&show BMP files from SD by system means.
 But now all needed files are already  in memory and user only show them
when needed.
 And if they will be loaded from SD card one by one, it'll  bring
additional delays.

AnatoliyBesplemennov
DexArm,
  at moment I don't have the VGA shield. And without having it it's almost
impossible to make the program.
  Also I'm not sure about graphic speed - it became slow down even at A70
LCD.
  Mini2440 with touch screens gives people total solution. Otherwise
mini2440 with VGA demands custom approach to system building. I mean - what
will serve as the Input device?
  I planned to connect the Palm portable Keyboard to mini2440 via COM Port
or use infrared remote control from TV set. It's easy to do.
  Or maybe use the Mouse? Serial mouses were good - I read 3 coordinates
and 3 buttons easily. Laser mouses were with quadrature output first. It
gives me ability to read X and Y in hard real time and I made the Encoder
on this but needed 4 wires to connect to uC. Next mouses have SPI interface
and may be connected via SPI or I2C. They've loose real time property
because they send packets and how to distinguish moment of time when one
single pulse was arrived? USB works with packets too and need programming
work to use it.
 So I think that mini with VGA is most suitable for connecting to big TV
screen for shows, output text&graphic and sounds using 3G modem as input.
 That's why I not decided to buy VGA yet...

brox
Anatoly,
your gfx is slow because you use 

for(y = 0; y < h; y++)
  for(x = 0; x < w; x++)
    LCD_BUFFER[y][x] = color;

all the time.
Remember, your LCD_BUFFER is global 2D array. You can speed up access to it
significantly this way:

for(y = 0; y < h; y++)
{
  unsigned short *p = LCD_BUFFER[y];
  for(x = 0; x < w; x++)
    p[x] = color;
}

anatoliy
thanks, Brox,
 I know it. Pointers I used too. As well as working with physical addresses
in memory.
 The best way - look like it works in Assembler level. Smart C compiler can
produce (or not) good machine code.
 All the system need to be remastering, including design.
 
 And access may be improved even better using 32 bit words with byte
aligning on borders...

DexArm
@Anatoliy, Thanks for the input, yes that was one thing i was worry about
(SPEED).
If i can get a network stack implemented, i am them thinking about go
headless and controlling it through a web browser.
DexArm.

Vernon
Thanks Anatoliy - I planned on manually entering the height and width after
pasting in the image data. The source to the 24 bit version is below in
case anyone wants to add inputs for that information, remove or comment the
superflous data, and produce a ready to use C file. I might work on that
myself. This compiles in the Bloodshed Dev-C++ Windows PC compiler. 

#include <cstdlib>
#include <iostream>


using namespace std;



int main()
{
          FILE *fp;
          fp=fopen("C:\\ARM\\mapx.bmp", "r");
           
          FILE *fx;
          fx=fopen("C:\\ARM\\convert.c", "w+");
          
          if ( fx == 0 )
              {
              printf( "Could not open C file\n" );
              }
              
          if ( fp == 0 )
              {
              printf( "Could not open Bitmap file\n" );
              printf( "You must have a path C:\\ARM \n" );
              printf( "With a file in that directory named mapx.bmp \n" );
              printf( "The program will attempt to open C:\\ARM\\mapx.bmp
\n" );
bigerror:              
              goto bigerror;
              }   
          fseek(fp, 0L, SEEK_END); 
//find end of file           
          int sz;
          sz = ftell(fp);
          printf( "Opened 24 bit bitmap NAMED mapx.bmp for conversion %d
bytes\n", sz );
// reset pointer           
          fseek(fp, 0L, SEEK_SET); 
          printf( "PROCESSING 24 bit BITMAP\n");  
          
// Red  0xF800  //  R=F800, G=0000, B=0000
// Green  0x07E0  //  R=0000, G=07E0, B=0000 
// Blue  0x001F  //  R=0000, G=0000, B=001F 
   

          unsigned int x;
          unsigned int y;
          unsigned int q = 0;
          int t = 0;
          unsigned int color = 0;
          unsigned int lowcolor = 0;
          fprintf(fx, "\n ");
          fprintf(fx, "PROGRAM CONVERTS 24 BIT WINDOWS BITMAP T0 \n");
          fprintf(fx, " 16 BPP (BITS PER PIXEL) 5 6 5 FORMAT \n");
          fprintf(fx, " Red = 0xF800, Green = 0x07E0, Blue = 0x001fF \n ");
          fprintf(fx, "Use data after IMAGE START->>> as C Array ");
          
          fprintf(fx, "\n ");
          fprintf(fx, "\n ");
          fprintf(fx, "FILE HEADER");
          fprintf(fx, "\n ");
          
            
          for (y = 1; y <= sz; y++)
                {
                   
                x = fgetc(fp);
               
// divide all bytes by 4 RGB
         switch (t)
                {
         case 1:
                
                x = x >> 3;           
// indicates red byte - red mask is f8 hex
                x = x << 11;
                color = (color | x);                
                t = t +1;
                break;
         case 0:       
// indicates green byte  mask = 7e
                
                x = x >> 2;                    
                x = x << 5;
                color = (color | x); 
                t = t +1;
                break; 
          case 2:
                x = x >> 3;
// indicates blue byte  - blue mask is 1f hex            
                color = (color | x);  
                t = 0;
// need to split color into two byte values
                lowcolor = color & 0x00ff;
// low byte in lowcolor 
                color = color >> 8;                
                fprintf(fx, "0x%02x,", color );
                fprintf(fx, "0x%02x,", lowcolor );
                
                color = 0;
                break;
                }
// reset to red for next byte                
             
                                    
 
                if (y == 55) 
                 {
                q = 0; 
                t = 0;     
                fprintf(fx, "\n  IMAGE START->>>  ");
                fprintf(fx, "\n ");
                  }
// make the data 20 characters wide for readability                
                q = q + 1;
                if (q >= 20)
                    {
                    q = 1;
                    fprintf(fx, "\n ");
                    }
                  
              
                
                }
                
          fclose( fp );
          fclose( fx );
          printf( " \n");
          printf( "PROCESS COMPLETE\n");
          printf( "you may view convert.c in Notepad\n");

endless:
          int z;
          goto endless;  
          
}

Vernon
Well - I got the FriendlyARM and it works great - but my file conversion
thing does not. It only writes the first ~ 900 bytes and then puts out ff.

brox
Vernon,
fp=fopen("C:\\ARM\\mapx.bmp", "rb");

Vernon
http://www.cttestset.com/friendly1.JPG

Fixed the file conversion program - will upload it later. 

It is not really friendly, the USB download driver crashed the PC but,
after some difficulty, I managed to wipe Linux and load StartOS. 

I then had a buffer problem with the Windows tool I wrote to reformat
bitmaps. It would quit after writing 1K odd bytes. I got that worked out
and wrote some code to present said bitmaps, write my name on the screen,
and send my name out the serial port (to TerraTerm) at 9600, N, 8, 1. 

That is where I am now. Next is reading the touch X and Y co-ordinates and
writing those values in boxes on the screen. 

Picture shows screen - it is kind of blurred because I could not use flash
but it really looks good. I used the knob from the steping motor demo - but
I might switch to a slider type control.

Vernon
The touch screen coordinates are a mess - I get random numbers when I touch
the screen.

anatoliy
Try to press with more force applying.
 The screen coordinates may be mismatched (ADC measured errors) but they
cannot be random... While calibrating in one pair of corners we get errors
in other pair.
 Screen calibration procedure on 7" LCD must work with another algorithm. I
think to divide the Screen on parts.
 And some design changes I'll try to do urgently.
 When I say about speed I mean some pixels flashing when text is outputted
on the same place about 100 times per second. - Needed to correct it.
Sometimes (mostly) recommended screen parameters doesn't fit...

anatoliy
@DexArm,
 about networking
 I got the Arduino Ethernet Shield on eBay. It works perfect as the Client
and as the Server. Have on board W5100 chip with TCP/IP stack embedded. You
can connect it to mini2440 via SPI.
 Years ago on IBM PC I connected computers to Ethernet network on physical
level (sources are on Assembler and free). Short program (~800 Bytes total)
was mighty to Init net chip (similar with DM9000 - it's for ISA bus too),
Receive Packets, Send Packets (broadcasting or for certain MAC address).
this all without any protocols.
 In future I think to make such initialization for DM9000 chip according
it's Datasheet for Friendly ARM  and write R/W packets functions.
 Then I plan to sold wire to Ethernet Shield and intercept Data it sends
and receives when connecting to Sites.
 Next I'll modelling such packets and mini2440 will be able to connect to
Internet...
 Good luck!

Vernon
Got the touch screen working. Also worked on the Windows Bitmap converter
and got the colors right. Pictures now look good.

Vernon
What is the correct usage for Uart_GetKey() ? It stops loop execution
plcaes a -DABT- on the screen and I understood that it just checked for a
character and continued.

brox
DABT means you got data abort exception - probably you just read/wrote
unaligned word or accessed outside of allowed memory

saurabh
Hi Anatoliy,

This is one of the nice work i ve seen on the net.I hope this OS will be
having  all the necessary components like USB,Ethernet by time.

I will definitely give it a try for serious project in future :-)

and Best of Luck and Please Don't Stop

anatoliy
Vernon, I'm sorry - can't find a time. Soon I'll correct it and also the
screen will be better.
 Saurabh, thank you very much and my best wishes to you too!

Vernon
That is OK - I can work around it. One thing that would be good is to have
a version where the backlight is not turned on until the application
program starts. If you could just take out the backlight that would be
awesome.

Vernon
http://www.youtube.com/watch?v=bi9cT1iOz64&feature=youtu.be

Video of what I have done so far ...

anatoliy
Good start! (I mean the video).
  First thing I planned to do - make the touch screen sensitive for moving.
Not it uses interrupts - when you tap screen -the interrupt occurs. But
then polling touch screen ADCs is needed.  I made this in the Step Motor
demo without OS. (You can load and try it). But funny that it works good at
low half of the 3.5" screen and don't work at upper half.
  About LED back light - when system loads it is uncontrollable. You may
name you program as start.bin then it will work immediately. (Please try
that method maybe it's solution). And in your program you can control LEDs
even with a PIR sensor. Or please give me your algorithm.

AnatoliyBesplemennov
Attachment: Vernon.rar (147.44 KB)
What is in attachment:
  S_A70.bin   - startos for A70 LCD
  StartOS.c   - replace old file with that new one

  GetChar, GetKey, GetStr - ADS projects. They where form root C:\
  Right Click mouse and compile each source file or perform your usual
methods.
   Place binaries on SD and they work.

   (I've just forced UART channel number (early it was by default))

Vernon
Thanks ! Another question - would it be possible to have linux be one of
the programs you could load from the SD card ? Like say you had a test
instrument that ran on bare metal, it saved results in a file, and then the
operator could load linux and email the file and ect.. would that be
possible with StartOS ?

anatoliy
Good idea, theoretically but practically I think - no.
 It's better to add networking to startos.
 We'll can send email in future.

Ronan Guilly
Great work. Keep the good work!

Milan Mladenovic
Great work.
Networking is the only thing that's missing in startos.

brox
Anatoly,
I just managed to run StartOS in emulator!
1. Take windows Qemu here:
http://rt-thread.googlecode.com/files/RT-Thread_mini2440_demo.zip
2. In 2440init.s comment out all the code between "; Clear SDRAM Start" and
 ";Clear SDRAM End"
3. Rebuild StartOS and place .axf file to qemu dir
4. Make corresponding change in batch file
5. Run, enjoy)

anatoliy
Thanks to all! Now I feel some responsibility to make steps forward from
draft version (this is really only skeleton). First to finish this stuff
and then think about strategy and possible divide it into two parts: BIOS
by itself and the Shell with GUI in various appearances - ascetic, glamour
etc.

Vernon
http://www.youtube.com/watch?v=e23hwYvPZl0&feature=youtu.be 

Early development of CTMP 2012 test set. 400 MHZ ARM9 (FriendlyARM with 7"
touch screen) with knobless servo variac control ! Movie shows ratio test
with servo variac installed and operating. Shows movement of variac. I
turned the exposure down and the movie looks better but you still can't
make out letters and numbers. 

Present test set at www.cttestset.com

AnatoliyBesplemennov
Attachment: Vernon.rar (72.38 KB)
Hello Vernon,
 the work is continuing - please use files in attachment.
 There're new binary file for 7" LCD, the Draw sketch and the StartOS.c
with Read_TS function. So please make your Sliders smooth!

 In my single 7" LCD everything work fine, if you'll discover any
flickering or dancing dots please report in which conditions they occur or
send me the binary for testing.

 Regards,
Anatoliy

P.S. Of coarse everybody who has 7" LCD can use this...

DexArm
All i can say is great work to both of you.
I made the mistake of buying the VGA ver, it very slow because of screen
res (as Anatoliy pointed out).
I thing i will order 7 inch screen and use that.
But keep up the good work.

Vernon
Thanks Anatoliy - your OS is awesome !

anatoliy
@DexArm
maybe use 256-color mode?  It is palletized, 16-bit per pixel and 24-bit
per pixel are non-palletized as S3C2440.pdf says. Eight red levels can be
selected among 16 possible red levels, 8 green levels among 16 green
levels, and 4 blue levels among 16 blue levels.
 Design rules demand that our screen must be defined in one pallete. Taken
from one pallete 256-colors will look good.
 Years ago I had done automatiz. project. Program was in Assembler IBM PC
and for Graphics I'd used the PCX Utils which supported 256 colors.
Everyone was satisfied...

DexArm
Thanks anatoliy, i will have a go at that mode and see how i get on, i Will
post any demos i get working.
Regards DexArm.

AnatoliyBesplemennov
Attachment: S_VGA.bin (33.54 KB)
Hi DexArm, if you'll have time and desire you can test S_VGA.bin (in
attachment). If it'll work you can take Hello2.bin, rename it as start.bin,
write it on SD card and put it into the board. Next, if it'll work too and
with acceptable speed, we can think how to control the board (for example,
send commands via COM port).
 I had made new generation of binaries and placed them on
code.google.com/p/startos.
 S_A70P.bin for 7" LCD works fast so I decided that VGA will work too...
But I haven't the VGA module and work in blindness.
 Good luck!

DexArm
Thankyou very much Anatoliy, i have a free day tomorrow and will give it a
full test, and report back with any findings.
Its not easy coding when you do not have the right module, if we can get
the speed, i will be more than happy to donate a VGA friendly ARM board to
your project.
Regards DexArm.

DexArm
@Anatoliy, Hi, i thought i would give you a update, sorry its took so long.
But i have run into a problem, i only have one lcd screen ( the crt stoped
working :( ).
So i have had too ordered one offline, i am waiting for it to come and
first thing i will do is test it and report back.

The only other device's i have are laptops, without com ports.
Regards DexArm.

herlanwert
Hi Anatoly,
I want to program with the Mini2440 a stand-alone application in C.
I am an experienced C-programmer, but so far only with 8-bit
microprocessors.
With the STARTOS, I want to program the key modules of the Mini2440:
LCD display, SD card, camera, voice recording, voice playback, RTC
My development PC is Ubuntu Linux with the gcc C-compiler.
Please send me an example of compiling a C-source for STARTOS
with LINUX using gcc.
Unfortunately I can not really English. This is a translation
from German to English using Google translator.

Thanks in advance
herlanwert

Anatole
Hello herlanwert,
OK, I'll try to do something with the Ubuntu Linux (I use Windows).
Also I want to say that ADS work fine even on Windows 98 and Pentium 233
(i.e. if you have for instance an old notebook with Win98, it's enough). 
All you need - is compile C-source to .OBJ pointing ARM920T core or
S3C2440A SoC and to produce .BIN file with loading and starting address
0x30000000 (as standard).
Regards,
Anatole

Bill Zimmerly
I bought my Mini2440 a little over a year ago and after playing with it for
a while, I shelved it.

Yesterday, I pulled it out of the dust pile, fired it up, and was listening
to a few MP3s while browsing this forum.

When I came upon THIS thread, I was thrilled! You've really added *A LOT*
of value to my Mini2440, Anatoliy, and I am looking forward to downloading
your StartOS and playing with it.

I read about your frustrations at the apparent lack of interest that people
have had in your work, but this is understandable - it takes time to build
a following. Hopefully, things are rolling well now!

Anyway, this is just a note of thanks ... and I have my work cut out for
me.

Sincerely,
- Bill

Anatole
Dear Bill,
 thank you very much! Your words support my spirit well.
 Now I'm thinking how to help herlanwert with getting the binary file using
GCC compiler under Ubuntu Linux (I only use Windows and ADS).

 You can get it at code.google.com/p/startos
 There're still so much things to do!

herlanwert
Attachment: start.bin (18.48 KB)
Hi Anatoliy,
First attempt to compile the Main.c source, Graphic Y = SIN (X)
for Stratos with gcc under Ubuntu.
I made the following adjustments (see Appendix)
1. In Main.c #include <StartOS.c>
2. void main(void) instead of void Main(void)
3. In StartOS.c adaptation to the gcc ARM assembler
4. Definition of an init section in accordance with start.s
   a constructor is also not running

The compilation is error-free with
arm-linux-gcc -lm -o SRC/start.bin SRC/Main.c

start.bin save to SD card and insert it into MIN2440
After switching from MINI2440 get the message
bottom left: RE.-UCode-
*** Obviously invalid instruction code ****

What I have understand:
After switching on the MINI2440 starts Stratos
and does the following:
1. Determining whether it is appropriate (2GB) SD card is present
2. If so, is there a file on the SD card start.bin ?
3. If so, the file start.bin loaded into the RAM .
4. Starting the program in RAM, the functions of SWI
    the Stratos calls.

In the appendix: StartOS.c Main.c start.bin

regards
herlanwert

herlanwert
Attachment: Main.c (2.09 KB)
Hi Anatoliy,
We can obviously only attach one file.
So once the file Main.c

herlanwert

herlanwert
Attachment: StartOS.c (6.51 KB)
Hi Anatoliy,
We can obviously only attach one file.
So once the file StartOS.c

herlanwert

Anatole
Hi herlanwert,
thanks a lot, you've impressed me with your energy and the will to win!
From my side I try too. I'm totally novice in Linux. The were problems with
finding&installing but now I have Ubuntu 10.11 working on experimental PC.
 Your work is very right and important for non-Windows users.
 If all thing will be good, in future it's possible to make an C-compiler
on Board. There was an excellent open source project OnBSuite for PalmOS.
 Other idea - to make compiling on special Site - people will send sources
and the Bot on this Site will compile it and send the .BIN file to user.

 Ok, what we have now. - I plan to begin with smallest project - Hello1.
It's also good that it don't use interrupts. So assembler file may be
excluded (I was afraid about GCC Assembler).
 In Start.s init file: first 3 lines just fill SWI routine address with the
startos one. Earlier it was done by one line of C code in the main(). But
as we have deal with interrupts, must be Init Asm file any way and these
lines were moved into Start.s. Next 4 lines change the Mode so we have
interrupts enabled in SVC mode. So, the first 36 bytes of binary code are
common for all programs.
 It isn't necessary to name your program start.bin. Other names you can
launch by tapping the screen. (Note: for calibration just press the screen
for 5 seconds).
 UCode means "unknown code", you're right. Something wrong with code
produced. Maybe instead __asm("SWI 190"); must be somewhat like SVC 190.

 I have watched your start.bin with Hex viewer/editor. It begins with:
ELF          (    &#1040;&#1107;  4  ..... and so on.)  It isn't a
binary file!

-------------------------------------------------------------------
 What people say:
"You can choose from compiling to linux(GNU/Linux) or to bare metal(EABI).
Mini2440 comes with linux.

Under linux, after you downloaded the toolchain you can compile sources
with "toolchain_directory/bin/arm-none-***-gcc" where *** could be
"linux-gnueabi" or "eabi" depending what you chose at download stage.

Some useful flags for gcc when compiling to mini2440: "-msoft-float
-mcpu=arm920t -mtune=arm920t -march=armv4t"

Sharp"
---------------------------------------------------------------------
some information is here: http://www.mikrocontroller.net/articles/Mini2440
http://friendlyarm.googlecode.com/svn-history/r181/wiki/Links.wiki

Also there are the Linux folder on DVD shipped with the board. I saw there
some examples how to produce .BIN files exactly for mini2440 under Linux.

 Thank you, herlanwert, good luck!

 P.S. I'll try too but I cannot promise getting fast results.
 Anatole

Milan Mladenovic
Dear Anatoly,
Is there a way to control the GPIO using StartOS.

Best Regards 
Milan Mladenovic

Anatole
@herlanwert:

Please try this simplest example first:

#define rGPBDAT    (*(volatile unsigned *)0x56000014)  //Port B data
register

void main(void)
{  int  i;

  while  ( 1 )
     { 
       rGPBDAT |= 1;
    for  (i=0; i<100000000; i++)  ;
  
        rGPBDAT &=~1;
    for  (i=0; i<100000000; i++)  ;
  }
}
It's very simple, after compiling it must be about 104 bytes in BIN file.
It uses nor SWIs, neither startup code. But it works, it produces the sound
tone ~1000 Hz via piezoelectric speaker telling that it's OK.
If you will get it working - all other work will be done easily. Somewhere
you must point Architecture type, processor type while compiling and
download&start address 0x30000000 while linking. I also want to try the GCC
for Windows.


@Milan
Yes, of course, it was made for this goal! Please take a look at supplied
examples (sketches). Also users can add functions a la Arduino style, i.e.
digitalWrite (Pin9...) and analogWrite via PWM.
Also I have in plans to make some drawings for connections using the
Breadboard in Fritzing.

kuriel
Hi Anatoliy, 
i also made an-"OS" like this about a year ago (actually Windows Manager,
the kernel itself still based on uCOS2 though i planned to write my own
kernel and APIs also using SWI).
http://www.youtube.com/watch?v=oVWbvZNFEDc
but i halted my projects for some reason.
anyway great works for creating StartOS and knowing that we're creating OS
around the same time.

Sincerely
Agus Purwanto

Anatole
Hi Agus,
your work is Great, it's very sadly that you don't continue...
(My work appeared little by little and is primitive).

 There are words at http://www.ubuntu.com/ubuntu :
"What is an operating system?
An operating system is what makes your computer work, running all your
programs and managing your hardware..."

Programming as creating activity can make people happy and they are
satisfied when all thing are clearly understandable. That is why I like
simple systems.

Regards,

Swami
Attachment: UP1.PNG (1.77 MB)
Hi Anatoliy,
Im interested in poring non OS to mini6410.
I went through your steps, but i am stuck at a point.
As said in STARTOSen.pdf i downloaded S_A70.bin (as it is specified as LCD
Type on my arm)
then you said it should run, but it is not running, the screen fills up
with multi-colored pixel lines.. thats it nothing happens after that.

Please help me.

I have attached picture of what i have done till now...

Anatole
Hi Swami,
this version is for the mini2440 board, sorry.
I can get mini6410 for porting but if I'll be sure in sense of this work.
Also I want to say that mini2440 is very good and fast board for most of
applications (with proper programming approach).
What to suggest - try to learn non OS examples for mini6410 and make you
own program, it's not too difficult. Or buy mini2440...
Regards,

Swami
Hello Anatole, thanks for replying quickly...

i just want to show a picture on screen of mini6410 thats it..

i tried to install only logo of winCE via sd card, but it requires
bootloader

but bootloader loads os.

so is there any bootloader for no os... i dont know, my question may be
stupid...

just tell me way to show picture on screen of mini6410..

Thank you.

Anatole
You can modify non OS program on your DVD shipped with the board. I don't
have such DVD but there must be something like test6410 on it. Try to
launch it, then remove all unnecessary parts and compile again.

same
Startos is very good small os 

do you think it is possible
  to access the internet for the weather as there is for mobile phone
as a widget

Anatole
Yes, sir, sure!
Thanks for interesting.
I have embedded the Server and Client functions.
Projects will be posted soon.
In the Server part you'll be able to view sensors connected to your
mini2440. Also, you'll put parameters in the Browser line like that:
http://192.168.1.17/?parameter. Depending of the Parameter or it's value
you can control your board - turn something On/Off, playing sounds, etc.
Parameter (value) can be displayed on LCD.
Example:
//  WEB Server  / startos

#define  U32 unsigned int
#define  U16  unsigned short
#define  U8  unsigned char

///////////////////////////////////////////////////////
U8  macaddr[6] = {0xAA,0xAD,0xBE,0xEF,0xFE,0xED};    // Assign MAC to your
Board

U8  mini2440_ip[4]  = {192,168,1,17};      // up to you
U8  strbuf[12]    = {1,1,1,1,1,1,1,1,1,0,0,0};  // fill with some stuff
ended with "0"

//  The Page Example
U8  page1[] =  "HTTP/1.0 200 OK\nContent-Type: text/html\n\n"
        "<meta http-equiv=""refresh"" content=""1"">"
        "<center><p><h1>The mini2440 Web Server</h1></p> "
        "<hr><br> <h2><font color=\"blue\">your board is connected to the
World!"
        "<br>now you can use the Internet of Things" 
        "<br>read the board's digital&analog sensors"
        "<br></font></h2>"
        "</center><hr><a
href=\"http://code.google.com/p/startos\">http://code.google.com/p/star...;;

//////////////////////////////////////////////////
void    Main  (void)
{  int    i;
  i = NIC_Init ( macaddr );  // init NIC
  if  ( i == 0 )    {   Print_String(0,50,"No NIC/Link");  Buzz (8000,10); 
}
  else      {  Print_String  ( 0, 30, "Connected at: " );
            if  ( i&1 )  Print_String(112,30," 10M h/dup");
            if  ( i&2 )  Print_String(112,30," 10M f/dup");
            if  ( i&4 )  Print_String(112,30,"100M h/dup");
            if  ( i&8 )  Print_String(112,30,"100M f/dup");    }

start:

    Server ( 80, mini2440_ip, page1,  strbuf );  // mini2440_ip as the
Server IP
  
    if  ( strbuf[0] == '?' )
    {
      if  ( strbuf[1] == '1' )    Buzz ( 9000, 5 );
      if  ( strbuf[1] == '2' )    Buzz ( 5000, 5 );

      Print_String (0, 50, strbuf );
      strbuf[0]=0;
    }

  
  if  (    !((*(int *)0x5800000c) & 0x8000)  )  Exit();  // if pen is
pressing the screen

  Delay  (100);  
  goto    start;            // cycle repeats
}

What you're asking for is the Client. Like that:
//  WEB Client  / startos


#define  U32 unsigned int
#define  U16  unsigned short
#define  U8  unsigned char
#define  BUFFER_SIZE    1518
///////////////////////////////////////////////////////
U8    macaddr[6] = {0xAA,0xAD,0xBE,0xEF,0xFE,0xED};
U8    mini2440_ip[4]  = {192,168,1,17};
U8    server_ip[4] = {192,168,1,5};
U8    buf  [BUFFER_SIZE+1];
U8  request[]   =  "GET /index.html HTTP/1.0\n"
        "Host:192.168.1.5\n"
        "User-Agent: startos\n"
        "Accept: text/html\n"
        "Keep-Alive: 300\n"
        "Connection: keep-alive\n\n" ;

int    res;
///////////////////////////////////////////////////////////
void    Main  (void)
{  int    i;
  i = NIC_Init (macaddr);  // init NIC
  if  ( i == 0 )    {   Print_String(0,50,"No NIC/Link");  Buzz (8000,10); 
}
  else        {  Print_String  ( 0, 30, "Connected at: " );
            if  ( i&1 )  Print_String(112,30," 10M h/dup");
            if  ( i&2 )  Print_String(112,30," 10M f/dup");
            if  ( i&4 )  Print_String(112,30,"100M h/dup");
            if  ( i&8 )  Print_String(112,30,"100M f/dup");    }

start:

  res = Client (  mini2440_ip, server_ip, request, buf );  // mini2440_ip
is the Client IP
  if  ( res )
  {
    Uart_SendByte ( '\n') ;  
    for  ( i=0x36; i < res; i++)    Uart_SendByte ( buf[i]) ;
  }
  else      {  goto    start;  }


  
  if  (    !((*(int *)0x5800000c) & 0x8000)  )  Exit();  // if pen is
pressing the screen

  Delay  (1000);  
  goto    start;            // cycle repeats
}
It gives result as:
HTTP/1.1 200 OK
Date: Tue, 10 Jul 2012 14:03:21 GMT
Server: Apache/2.2.22 (Win32)
Last-Modified: Sat, 20 Nov 2004 11:16:26 GMT
ETag: "c000000002021-2c-3e94ec1117680"
Accept-Ranges: bytes
Content-Length: 44
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

<html><body><h1>It works!</h1></body></html>

This was from the Apache Server I have Installed on desktop PC.
Editing the file index.html you will get not "It works!" but any other
text.
Now I'm doing the Font 4x6 for output the page onto 3.5" LCD.
DNS is not supported, so you must find the Server's IP - you can use ping
command: ping www.weatherserver.com and it will give you an IP address.
Getting the page, you can retrieve data.
And you can make simple PHP script on you own Server in the Internet. This
program will collect all data for your needs and send it to your
FriendlyARM board.

And last - this thing is interesting for playing with.
I even plan to do some toy project - the "Smart Doll's House".
It will control LEDs in the room, air fan, and show status on say your
iPhone or Notebook.

Note. DHCP not implemented so I connect my mini2440 to Router or Switch.
It's not a big problem - Internet service provider can assign you constant
IP address.
After this I will connect Wi-Fi module (I bought it on eBay for $34).
By now I can connect mini2440 to Neatgear wireless AP.
Regards,
Anatole

same
hi Anatole
to be after you said it's possible .. thank you.
I am beginner in C / C + + ... I buy one on ebay mini2440
like many people are on forums I think,
I tried SEVERAL way to start my project developer has (directs house
automation).
I watched with winCE ... Linux ... but this is complicated by the OS for
little beginner like me
Then I began to be studied 2440test supplied on CD with the card mini2440.
   I find StartOS by hazar on youtube and i was surprised, I still have
another possilité.we can do many things with StartOS.
Good finished the barvadages ..!  sorry my English is not great!!

I have commended man of humidity sensor temperature and pressure. presence
detector ..the time it arrived, I work with StartOS.(3week)
the screen 3.5 "NEC does not appropriate for me  .one gave me a screen of
5.6'' nec 640 * 480 screen and also a 4.3" 480 * 272, how can I use them
with StartOS
another small question: why did not you put a page of your OS like a
startup "Statos v1.0 " etc. .. but the boot is so fast ..

Anatole
Hi,
I have posted files with Server/Client projects on
code.google.com/p/startos.
Without LCDs I cannot make drivers...

mabg
where i can find startos source ?

Anatole
It's sad but it's proprietary project. Sorry.

same
hello 

how to change hello3 fonts for 32*32 fonts.
how to create it using GlcdFont creator 

thank's

Anatole
Hi, I'll try to make such a sketch soon.
Also I want to suggest you using the 7" LCD. It has some touch screen
dismatches but works awesome.

Anatole
I have posted the GLCDFontCreator V1.0.0 by Pocket MicroTecnics.
Last version - V1.20 from Mikroe.com in fact was unable to save the file
with the font edited.

In case you want the newest version, please try to download one at
http://www.mikroe.com/ and test it by your own risk.

Version 1.0.0 works fine and was tested even in Windows 8.

same
The  GlcdFontCreator 1.2 works well .i have courrier new 16*26
that what to change in hello3 for displaying fonts of 16 *26
I change w & t but it gives nothing

I ordered a 7 inch lcd happens in 5 days
it gets better correspond to what I do ..

anatole
Hi,
my sketch is almost ready - it works but now I need to edit the font in
text implementation. I took Times New Roman and made 32x32 pixels font.
I cannot save the font in V1.20 so I work with V1.0.0 of GLCD font creator.
It gives file in XML format, Then I replaced 16777215 with 1.
It looks like this:

   //"0"
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

(I have draw cute face with symbol code "0" you can see it - rotated CCW 90
degrees)
Removing "," we can get Binary number for each line but C compiler cannot
understand binary numbers. I don't want write macros for it.
So I decided to group bits in Hex form. I did it in Notepad.
Replace right part with left symbol
// 0 0,0,0,0,
// 1 0,0,0,1,
// 2 0,0,1,0,
// 3 0,0,1,1,
// 4 0,1,0,0,
// 5 0,1,0,1,
// 6 0,1,1,0,
// 7 0,1,1,1,
// 8 1,0,0,0,
// 9 1,0,0,1,
// A 1,0,1,0,
// B 1,0,1,1,
// C 1,1,0,0,
// D 1,1,0,1,
// E 1,1,1,0,
// F 1,1,1,1,

int  font32x32[]={

  //symbol code "0"
0x80000000,0x80000000,0x80000000,0x00000000,0x00000000,0x00000000,0x00000000,0x0
0000000,
0x00000000,0x003E0000,0x03E18000,0x0E004000,0x18002000,0x38801000,0x38800800,0x3
8C04800,
0x38024400,0x387E6400,0x38004400,0x38804800,0x38C00800,0x38801000,0x18006000,0x0
F808000,
0x00E10000,0x001E0000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x0
0000000,
 
 

};
Good text Editor make it automatically. It must have Macro Commands.

Please tell me - does your GLCD FontCreator save files in C source? It must
but I can't do it.

void Print32x32(int x0, int y0, char *txt)    // txt - pointer on char
{
  extern      int  font32x32[];
  unsigned short    *LCD_buffer;
  int      LCD_X;

  int x,y,z,s,p,m,sav_m;  // t= y*LCD_X+x
  int w=32;    // symbol width
  int t=32;    // symbol height
  y0=y0-t;    // move to the foot of symbol
  
  // getting the Screen buffer parameters
  LCD_buffer  = (unsigned short *)((*( unsigned *)0x4d000014) << 1);
  LCD_X    = (*( unsigned *)0x4d00001c);
  
  
  m  = y0*LCD_X+x0;            // starting point  
  
  for  ( s=0;  txt[s]!=0;  s++ )
  {
    z=txt[s];  // get symbol code

    p=z*(needed to calculate);  //z<<4 for 8x16       // pointer to char
definition in buffer


///////////////////////// Draw Chars ///////////////////////      
      sav_m = m;
      
      for(x=0; x<w; x++)
      {  m+=LCD_X;  // next Y
        for(y=0; y<t; y++)
        { 
        
          if  (font32x32[p+y]&(0x80000000>>x))  {*(LCD_buffer+m)=0xFFFF;
}// Draw Foreground
          else {  if  (Back_Col!=1)       *(LCD_buffer+m)=5; }

          m++;        // next X
          
          Delay(10);
        }
        
        m=m-w;          // restore X
      }
      m = sav_m;
      m+=w;            // next symbol position
  }
}

You must change X&Y too, not only w&t...
EvaFont in wich I made Hello3 gives rotated bits.

As you want 32x32 then I group them in 32-bit integers.

Also, feel free to e-mail me.

P.S. You have great results for novice :)

same
thank's

I'll test it soon ...

GLCD : actually yes ... with version 1.2 i can save the file
 but I have not tested the version 1.0

anatole
Hi Same,
I just have posted the Font32 sketch on code.google.com/p/startos
If you'll prepare an another font in C source, I can help you with
programming.

Good utility as I understand, must take the photo (image) of the font and
other work it must to do by itself. It must divide picture in pixels,
define bits and build the font. If I'll have a time I can write such a
utility program.
Use good text editor (I used Lexicon - old Russian program on one of my old
IBM Thinkpads- what are the Great things! It has Pentium 75 MHz. Lexicon
works momentary on it comparing with modern "Editors"...)

same
HI 
GOOD JOB and quickly

i'm going to try it
for my training  .

congratulation Anatole..!!!

anatole
Thanks Same,
this method processes pixel by pixel. Another one is considered
(approximally)in the Hello2 sketch.
As you have the Screen buffer address, now you are able to put the whole
Symbol's drawings as rectangle areas (BMP images).
And draw it not by pixels but as an Array of data. You can get more speed
and very beautiful pre-drawed symbols.
Draw the stripe:  [0][1][2][3][4][5][6][7][8][9[9][A][B][C][D][E]...... and
cut it into rectangular pieces. 
Also, you can change the symbols' color as the function of X or Y or
somewhat else (temperature sensor for instance).
You can define your own buffer and print symbols onto its memory, not in
the LCD screen buffer. Then just transfer this buffer with variable offset
onto the LCD buffer. Very long running string will be displayed... From
left to right, up to down or vise versa... All depends of your creative
fantasy.
I want programming return to art or science, be perfect and bring
pleasure...

anatole
The Font32, Hello* sketches are only bare schematic skeletons, they are for
easy understanding.
You may want to insert the screen boundaries checking, because if you write
for instance Print32x32(0, 20, "Text..."); (y0=20), upper part of symbol
will be written not in the screen buffer but in your code.
So, you may add: if (y0<32) y0=32; // limit y0 or print an error message...
if (y0>320) y0=320; // where 320 represents your screen's height.

The same is for 8x8, 8x16 - you must provide the letters will fit in the
screen area or otherwise check the input values with additional lines of
code.

Such symbols as BELL, BACKSPACE, LINE FEED, CARRIAGE RETURN may be
processed in your procedure as well.
Good luck!

Rob
Hi!

What is the current status of StartOS? Is the source available? I have a
project for which I could possibly use it if the source is available.
Otherwise I'll need to use one of the other OS's for which the source is
available.

Thanks,
Rob

anatole
I'm sorry but the source is not available at present time.

ruby
hello everyone
help ..!!!!
Put_Bmp don't work with keil
i tested Graph.bin for keil but it dont displayed nothing.

anatole
hi,
I just have wrote Graph.bin from Keil examples folder onto microSD card,
launched it and it works. It has size 3584 Bytes.
You can try Graph.bin for ADS1.2.
Long ago I used Keil, but it works with acceptable speed only on my home
two-cores Intel Desktop PC.
ADS1.2 works fast even on Notebooks with simple Pentium 233MHz.
Keil has startup files for 2440A and 2440 SoCs. But when you point to use
2440A, it puts startup file for 2440 in the Project folder. I found the
2440A file and place it in my folder.
I advice you use the ADS1.2 at least at the beginning. You can download
"Getting started with ADS1.2 from code.google.com/p/startos.
Later I'll try to install Keil again and check the Project for proper
compiling.

Now I plan to post the Sounds via PWM sketch.
Regards,

Sanjog Gandhi
Dear Anatoliy Besplemennov, 
    it's a really great work from your side. 
    I wish to read write some file on a flash card, can you provide those
functions.  This is required to store various files required for HMI and
also the data and settings. 
Please guide.

Thanks and regards. 

Sanjog Gandhi

Sanjog Gandhi
Dear Anatoliy Besplemennov, 
    Your work is really great ! can we work together for few of my projects
? 
Thanks 

Sanjog Gandhi
India
http://www.autovueelectronics.com

DermagraFX
Hi I want to give startos a try, but I cannot find CW for arm 1.2 anywhere.
Anyone tell me where I can find a copy, or what are you using to make your
bin files and programs to load on your arm 2440 boards?
Thanks

brox
If your host OS is Windows, there are several good options. Personally I
prefer Keil 4.
If you live in linux, then you stick to gcc cross-toolchain

anatoly
You can write me longtolik@gmail.com I think we'll resolve you problem.
Tastes differ. I began with Keil but later switched to ADS1.2.

bahman hodjativ
hello everyone
help ..!!!!
i can use labview mobile module on mini2440 by calling dll but 
cannot make 30 hz of port F .
i need dll for gpio read and write with up speed (100 or 200 khz)

i need book or document for gettin start with programing c++ with visual
stdio 2005 guide
plz help me

Gun Gun
Dear Anatoliy Besplemennov,
i try use uart example codeand modify to 9600 bpsas i seen in
startosen.pdf, 

Uart_Init(0,9600);
Uart_Select(0);

i use ADS1.2.
compile, build is ok, but when i run in my mini2440 its doesn work with
9600 bps, just working with115200 bps.

the other example code is working fine.
thanks for your great jobs.

plz help me.
i'm Gun Gun from Indonesia

anatoly
Dear Gun Gun,
thank you for using startos, thank for feedback and report.

Yes, I`ll help you! I can`t check the code right now, so I`ll do it later
but you may:

Please try to include the folowing lines in your program:

#define rUBRDIV0    (*(volatile unsigned *)0x50000028)  //UART 0 Baud rate
divisor


Uart_Select(0);
Uart_Init(0,9600);

// after this simply change the Divisor:

//  rUBRDIV0=26;  //Baud rate divisior register 0    FOR 115200 BOD
  rUBRDIV0=325;  //Baud rate divisior register 0    FOR 9600 BOD - try to
test 324 or 326 for fine tunning

//  it must turn it for 9600 Bod !!!
///////////////////////////////////////////////////////////////////////////


For testing the whole text for UART Sketch will look like:

// Uart  / startos

#define  U32  unsigned int
#define  U16  unsigned short
#define  U8  unsigned char

//(0x1F<<11)|(0x3F<<5)|(0x1F) ) R G B
#define Yellow  0xFFE0  //  R=F800, G=07E0, B=0000, 
#define White  0xFFFF  //  R=F800, G=07E0, B=001F
#define Red  0xF800  //  R=F800, G=0000, B=0000
#define Green  0x07E0  //  R=0000, G=07E0, B=0000 
#define Blue  0x001F    //  R=0000, G=07E0, B=0000 
#define Black  0x0000  //  B = 0,  G = 0,  R = 0

#define rUBRDIV0    (*(volatile unsigned *)0x50000028)  //UART 0 Baud rate
divisor

char  txt[30];
char  str[6]={"String"};
int  i,z;
char  k;

void Main(void)
{
  Buzz(8000, 10);      // Short Beep on Piezo
  Fill_Screen(10);      // Screen Fone Dark Blue

//   rUBRDIV0=( (int)(pclk/16./baud+0.5) -1 );   //Baud rate divisior
register 0, where PCLK=50000000   i.e. 50 MHz
//   rUBRDIV0=26;  //Baud rate divisior register 0    FOR 115200 BOD

   rUBRDIV0=325;  //Baud rate divisior register 0    FOR 9600 BOD

//  ( Bold  Fore  Back)  if Back=1 fon is Transparent
  Set_Font  ( 1,  White,  10  );
  Print_String(100,30, "UART Works");
  Print_String(40,50, "Please connect Terminal");

  Set_Font  (0,Green,10);
  
  z=123456;
  Printf(70,110,"Number Z =%d", z);
  Uart_Printf("Number Z =%d\n", z);
    
  z=0xABCDEF;
  Uart_Printf("Hex number Z =%x\n", z);
  Printf(70,130,"Hex number Z =%x", z);
  
  Delay(1000);
    
  for ( k=0x20; k<255; k++)
  {
    Uart_SendByte  (k);
  }
  Uart_SendByte  ('\n');

  Printf(80,150,"String");
  Uart_SendString(str);
  Delay(1000);
    

  Uart_SendString("Please type some Keys on Keyboard, then [Enter]\n");
  Uart_GetString  (txt);

  Uart_SendByte  ('\n');
  Uart_SendString(txt);
  Print_String(70,170, txt);

  Delay(3000);

  Exit();
}
///////////////////////////////////////////////////////////////////////////

Going further - please watch  below:

As startos let you do all things with hardware, you may change rates,
number of bits, parity and so on for any UART on the board.
(Refer to Samsung S3C2440A manual too).

In sources for 2440test you can find the file 2440lib.c with UART
initialization procedure

// UART
#define rULCON0     (*(volatile unsigned *)0x50000000)  //UART 0 Line
control
#define rUCON0      (*(volatile unsigned *)0x50000004)  //UART 0 Control
#define rUFCON0     (*(volatile unsigned *)0x50000008)  //UART 0 FIFO
control
#define rUMCON0     (*(volatile unsigned *)0x5000000c)  //UART 0 Modem
control
#define rUTRSTAT0   (*(volatile unsigned *)0x50000010)  //UART 0 Tx/Rx
status
#define rUERSTAT0   (*(volatile unsigned *)0x50000014)  //UART 0 Rx error
status
#define rUFSTAT0    (*(volatile unsigned *)0x50000018)  //UART 0 FIFO
status
#define rUMSTAT0    (*(volatile unsigned *)0x5000001c)  //UART 0 Modem
status
#define rUBRDIV0    (*(volatile unsigned *)0x50000028)  //UART 0 Baud rate
divisor

#define rULCON1     (*(volatile unsigned *)0x50004000)  //UART 1 Line
control
#define rUCON1      (*(volatile unsigned *)0x50004004)  //UART 1 Control
#define rUFCON1     (*(volatile unsigned *)0x50004008)  //UART 1 FIFO
control
#define rUMCON1     (*(volatile unsigned *)0x5000400c)  //UART 1 Modem
control
#define rUTRSTAT1   (*(volatile unsigned *)0x50004010)  //UART 1 Tx/Rx
status
#define rUERSTAT1   (*(volatile unsigned *)0x50004014)  //UART 1 Rx error
status
#define rUFSTAT1    (*(volatile unsigned *)0x50004018)  //UART 1 FIFO
status
#define rUMSTAT1    (*(volatile unsigned *)0x5000401c)  //UART 1 Modem
status
#define rUBRDIV1    (*(volatile unsigned *)0x50004028)  //UART 1 Baud rate
divisor
#define rULCON2     (*(volatile unsigned *)0x50008000)  //UART 2 Line
control
#define rUCON2      (*(volatile unsigned *)0x50008004)  //UART 2 Control
#define rUFCON2     (*(volatile unsigned *)0x50008008)  //UART 2 FIFO
control
#define rUMCON2     (*(volatile unsigned *)0x5000800c)  //UART 2 Modem
control
#define rUTRSTAT2   (*(volatile unsigned *)0x50008010)  //UART 2 Tx/Rx
status
#define rUERSTAT2   (*(volatile unsigned *)0x50008014)  //UART 2 Rx error
status
#define rUFSTAT2    (*(volatile unsigned *)0x50008018)  //UART 2 FIFO
status
#define rUMSTAT2    (*(volatile unsigned *)0x5000801c)  //UART 2 Modem
status
#define rUBRDIV2    (*(volatile unsigned *)0x50008028)  //UART 2 Baud rate
divisor


void Uart_Init(int pclk,int baud)
{
    int i;
    if(pclk == 0)
    pclk    = PCLK;  // it =50000000
    rUFCON0 = 0x0;   //UART channel 0 FIFO control register, FIFO disable
    rUFCON1 = 0x0;   //UART channel 1 FIFO control register, FIFO disable
    rUFCON2 = 0x0;   //UART channel 2 FIFO control register, FIFO disable
    rUMCON0 = 0x0;   //UART chaneel 0 MODEM control register, AFC disable
    rUMCON1 = 0x0;   //UART chaneel 1 MODEM control register, AFC disable
//UART0
    rULCON0 = 0x3;   //Line control register : Normal,No parity,1 stop,8
bits
     //    [10]       [9]     [8]        [7]        [6]      [5]        
[4]           [3:2]        [1:0]
     // Clock Sel,  Tx Int,  Rx Int, Rx Time Out, Rx err, Loop-back, Send
break,  Transmit Mode, Receive Mode
     //     0          1       0    ,     0          1        0           0
    ,       01          01
     //   PCLK       Level    Pulse    Disable    Generate  Normal     
Normal        Interrupt or Polling
    rUCON0  = 0x245;   // Control register
    rUBRDIV0=( (int)(pclk/16./baud+0.5) -1 );   //Baud rate divisior
register 0
//UART1
    rULCON1 = 0x3;
    rUCON1  = 0x245;
    rUBRDIV1=( (int)(pclk/16./baud+0.5) -1 );
//UART2
    rULCON2 = 0x3;
    rUCON2  = 0x245;
    rUBRDIV2=( (int)(pclk/16./baud+0.5) -1 );    

    for(i=0;i<100;i++);
}


Note. I did not use this procedure because all this mathematics will add
about 3.5 KBytes to the binary code.
So let`s use pre-calculated values and simply write them to register.

  rUBRDIV0=26;  //Baud rate divisior register 0  FOR 115200 BOD
  rUBRDIV0=325;  //Baud rate divisior register 0  FOR 9600 BOD

That`s all, in case of issues please let me know....

anatoly
Well Gun Gun,

I`ve successfully tested the code. It works with DNW.exe terminal window
configured to 9600 bps.

So, all you need to add - only two lines of code.

#define rUBRDIV0(*(volatile unsigned *)0x50000028)//UART0 Baud rate
divisor

Uart_Select(0);     // this line maybe not needed (default)
Uart_Init(0,9600);  // this line maybe not needed too
rUBRDIV0=325;  //Baud rate divisior register 0 FOR 9600 BOD

// ^ last line changes the Baud rate

Gun Gun
Ok, thankyou for the attention
i've been tested to, and it's work.
rigt now i'm try to intterupt from serial

i'm sorry my english is not good.
once again thankyou to anatoliy with startos.

roger
I have used a jtag for loading the S_W35.bin file
I am getting a screen listing sd card files but none of them
is executing when selected(The Bin Files).

Can anyone help please?

Thanks
Roger

anatoly
Hi Roger,
It's seems to me that you have not accurately made the screen calibration.
To perform it again just press the screen and hold for at least 5 seconds.
Totally remove the calibration data you can do by launching the test2440 in
EEPROM part. Or, otherwise, you wrote wrong binaries onto SD card.
Try for beginning check your stylus in some modes and please test for
instance, Hello1.bin and so on.
And one more: you can rename any binary file into START.BIN. After placing
it on the SD card, it will be running automatically without needing tapping
or something else.
Feel free to ask any question.

Karol
Hi
I bought smart210 module and i would like to do my first program. I am new
in android/ linux. I would like to use Windows CE but I feel sorry for the
money for the licenses so I prefer to use either an android or no-OS
(STARTOS) if possible.
Can You tell me how to get started with StartOs?
1) How to compile program?
2) How to write to NAND memory?
3) Where to download libraries for peripherals?
I will have to use GPIO, SPI, USART, 1-Wire, TouchPanel, EEPROM, 7-inch TFT
panel.

Best regards from Poland :)
Karol

anatoly
Hi Karol,
First, startos is for the mini2440 by now. Components are ready for porting
to mini210s (some will be improved) but strategically the decision isn't
made yet.
UM you can get at http://google.com/p/startos
Android works fine on 210's board, 3D graphics speed is somewhere in the
middle between ARM11 and Cortex A9 (Nexus 7).
FriendlyARM supply you with native I/O libriary for Android. It's good.
So, all your demands you may easily realize using Android.
Good luck from Alania, South Russia!

Tagore
Hi all, 
          Start Os is really good to work for with mini2440. I have a small
 problem while working with multiple interrupts. I am using UART Rx
interrupt and ADC interrupt for TouchScreen. Now my problem is when i
enable adc interrupt UART interrupt stops working. Below is the routine for
ADC interrupt for touch. Kindly let me know what can i do for this problem.

 void __irq AdcTsAuto(void)
{
    
  U32 saveAdcdly;
   
  // Uart_Printf("Touch Detected\r\n");
   
    if(rADCDAT0&0x8000)
    {
    
    //Uart_Printf("\nStylus Up!!\n");
    rADCTSC&=0xff;  // Set stylus down interrupt bit
    }
    //else 
    //Uart_Printf("\nStylus Down!!\n");

  rADCTSC=(1<<3)|(1<<2);         //Pull-up disable, Seq. X,Y postion
measure.
  saveAdcdly=rADCDLY;
  rADCDLY=40000;                 //Normal conversion mode delay about
(1/50M)*40000=0.8ms

  rADCCON|=0x1;                   //start ADC

    while(rADCCON & 0x1);    //check if Enable_start is low
    while(!(rADCCON & 0x8000));        //check if EC(End of Conversion)
flag is high, This line is necessary~!!
    
            while(!(rSRCPND & (BIT_ADC)));  //check if ADC is finished with
interrupt bit

            xdata=(rADCDAT0&0x3ff);
            ydata=(rADCDAT1&0x3ff);

   //YH 0627, To check Stylus Up Interrupt.
   rSUBSRCPND|=BIT_SUB_TC;
   ClearPending(BIT_ADC);
   rINTSUBMSK=~(BIT_SUB_TC);
   rINTMSK=~(BIT_ADC);
       
   rADCTSC =0xd3;    //Waiting for interrupt
   rADCTSC=rADCTSC|(1<<8); // Detect stylus up interrupt signal.

      while(1)    //to check Pen-up state
      {
       if(rSUBSRCPND & (BIT_SUB_TC))  //check if ADC is finished with
interrupt bit
         {
          //Uart_Printf("Stylus Up Interrupt~!\n");
          break;  //if Stylus is up(1) state
        }
      }  

  //  Printf(0,0,"count=%03d  XP=%04d, YP=%04d\n", count++, xdata, ydata); 
  //X-position Conversion data            

  rADCDLY=saveAdcdly; 
  rADCTSC=rADCTSC&~(1<<8); // Detect stylus Down interrupt signal.
    rSUBSRCPND|=BIT_SUB_TC;
    rINTSUBMSK=~(BIT_SUB_TC);  // Unmask sub interrupt (TC)     
    ClearPending(BIT_ADC);
}


i have take the above code from 2440test code

anatole
Hi,
The code above is very dirty, it's for reference only.
For instance, why is needed to lunch an ADC conversion in the interrupt
routine and then to have polling various bits.
An interrupt must occure when ADC is finished.
Please explain what your algorithm must do.
ISR must be as short as possible. Just because the processor may be in
several modes.
And startos already intercept the TS ints, but you may freely change it.
Try to clean up the code, I'll try to test them (ISRs) both.

Tagore
Hi Anatole,
            Thanks for your reply and sorry for the dirty code. My task is
to communicate with another controller (PIC) through UART and display the
data received on TFT and control the flow from touch screen. I have used
the Uart interrupt routine given by you and Read_TS() instruction to read
the touch data. I will be continuously interacting with the uart for data
transfer meanwhile if any touch is detected the defined action also needs
to be done. As i am going for the polling process for touch sometimes the
control is unable to return back after a touch is being detected and hence
the screen is not getting updated. Due to this problem i thought of using
TS interrupt and got this reference code from test2440 source. Kindly help
me to proceed further.

Thank you.

anatoly
States serves TS, UART, Timer interrupts. They work simultaneously.
But the strategy is - ISR set up the Flag and quickly returns back. User
program then can analyze this flag and perform some activity. 
If the ISR will be long, other interrupts may be loosed.
I think in your case you may just look at one bit in the data register. And
you will understand is the screen pressed or not.


  while  ((*(int *)0x5800000c)& 0x8000) //  Pen is Up

  Otherwise pen is Down.

  And why you don't want to clean the code by yourself? It launches the new
interrupt in interrupt service routine (ISR) and waits the interrupt flag.
Remove these lines and it will work.

I think the new 1-wire TS don't use the interrupts at all.

Tagore
Thanks for the info anatoly....Ill try it and let you know....

ERNESTO OCHOA
Hello Anatoliy Besplemennov
This is Ernesto from Mexico

I am using Startos in a MINI2440 for a X axie
with stepper motor. 
I m using Keyl software to compiling C code, but 
in some cases the printf("Speed= %d",speed)
doesn´t function well and the system crash, saying :  DABT
bellow in the 3,5" touch screen. 

Do you have any idea what should be wrong? 

I am not an expert in ARM, but I like it very much

For me, your StartOS is very, very good, it is a shortcut 
aside linux, etc..

I have download some examples, but my problem is I have only
Keyl software and the most are for codewarrior.

Acctually The simples example in key using printf("Speed= %d",speed)
function well. But When I try in my code, it doesn`t function.
The system crash with DABT; and thats it.


the same happens with the Uart_Printf("Speed= %d",speed)
Would you have any idea what would be wrong? 




Congratulation for your work, effort, time and don´t worry;
I know you finally will find what you are looking for; just wait 
a little longer; dont hesitate.
For me your work has been excelent.!!!
Congratulation again.

Hope you the best.

anatoly
Hello Ernesto!
Thank you a lot for warm words.
Making startos I just wanted to get some IT job for me. But users little by
little forgot it.
What about your case: yes, it's known that the printf function sometimes
don't work right (I thought in ADS1.2). As far as I know, in Linux there is
 separately written code. Startos have reduced/compact code, so I carried
out printf code in include file because it add some kBytes.
Printf consist of two parts: parsing and output by it's own.
Variants:
1. Try this:


void  Printf  (U16 x0, U16 y0, char *fmt,...)
{  va_list ap;
  char string[256];
  va_start(ap,fmt);
  vsprintf(string,fmt,ap);
  va_end(ap);
  Print8x8  (x0, y0, string); // here is just physical output
}
////////////////////////////////////////////////////////////////////////////////
////////
void  Uart_Printf  (char *fmt,...)
{  va_list ap;
  char string[256];
  va_start(ap,fmt);
  vsprintf(string,fmt,ap);
  Uart_SendString(string);
  va_end(ap);
}




2. Perform yours routines:

void  Uart_Printf2 ( char * format, ...)// Parsing example
{
  char c;  
  va_list ap;
    
  va_start(ap, format);
  
  while ((c = *format++) != '\0')
  {
    switch (c)
    {
      case '%':
        c = *format++;
        
        switch (c)
        {
          char ch;
          char * p;
          int a;
          char buf[100];
                  
          case 'c':
            ch = va_arg(ap, int);
            putchr(ch);
            break;
          case 's':
            p = va_arg(ap, char *);
            _puts(p);
            break;          
          case 'x':
            a = va_arg(ap, int);
            putint_hex(a);
            break;    
          case 'd':
            a = va_arg(ap, int);
            itoa(a, buf);
            _puts(buf);
            break;  
          
          default:
            break;
        }        
        break;    

      default:
        putchr(c);
        break;
    }
  }
  
}
///////////////////////////
void  putchr ( char c )
{
  if (c == '\n')  Uart_SendByte ('\r');
  
  if (c == '\b')
  {
    Uart_SendByte ('\b');
    Uart_SendByte (' ');  
  }
      
  Uart_SendByte ((char)c);
}
/////////////////////////////////////////////////
void  _puts ( char * s)
{
  while (*s)    putchr (*s++);
  putchr ( '\n' );
}
//////////////////////////////////////////////////////////
3. Increase your buffers, to prevent the data (strings variables) may reach

the code. When this happens, the program code will be overwritten with data
and you will get DABT (data abort exception)

ADS1.2 I like best. So, please say me if you have DVD shipped with the
FriendlyARM mini2440 board.

And last, I have almost all functions used in startos working with the
mini210s board, it have ARM Cortex-A8 SoC.
I cannot for a while managed code remapping for mini210 for software
interrupts. But anyway system calls may be done as subroutines. 
This means that if you spend time learning startos, you also will be able
to work with S5PV210s processor too in near future.

Thanks again!

Jones
hey guys, 
i want to make a phone using mini2440, so my mini can make a call, receive
a call, send and receive a text message, what do you think? is that
possible? how can i do that?

anatoly
Hi Jones,
It's possible but why to use mini2440?
Anyway you'll need a GSM module like this:
http://arduino.cc/en/Main/ArduinoGSMShield
or:
https://www.google.ru/search?q=GSM+shield&newwindow=1&es_sm=93&a...

Raj kumar A have made such a thing:
http://www.youtube.com/watch?v=7R0GXUwErck
(also, he mentioned startos...)

With mini2440 you may do more complex things...

ernesto
Hi Anatoliy.

Thanks for answer my message.
About my problem using mini2440, printf function and uart_printf


I tried your suggestion, but I don't succed!!

No. I don´t have the DVD shipped with my mini2440; actually it has been
very hard for me to get information about my board, because I purchased in
china, but I received only the board without anything else; so I have to
download some examples from friendly arm, and the Keil microvision 4
software. Info from here... from there until I get in touch with you and
the friendlyarm forum; and with a lot of trials I have advanced a litle
bit, but I know it is very hard and you have to spend a lot of your time
doing test again and again until you reach your target. 
I have downloaded the keil microvision 4 but It has a size limit in byte
when it compiles and link (I haven't purchased yet), because I am in the
way of learning.

Do you think the  ADS1.2 is the right for one  and the best? in order to
program in C my mini2440 ARM ?

if this is the case, do you think this site is ok to download the ADS1.2 ?
I would like to test it.

http://programarts.com/cfree_en/download.htm

do you know where can I get ADS1.2 ?

this is my email:
ingenieriaochoa@prodigy.net.mx


I will really appretiate any help. 
Thank you before hand for any information you can send me.



Well, I will be looking forward to hearing from you.


Best Regards.

anatoly
Hi Ernesto,

I'll send you e-mail message. You'll try it and make a decision.

Regards,
Anatoly

ernesto
Hi Anatoliy, How are you today??


I have succed with the ADS1.2 you sent me. Thanks you very much!!!!
I installed it and proveed with some examples and finally
with my simple application   printf()   and Uart_printf()
and they all worked ok.

Now I am trying to generate a square frecuency signal throught 
a digital bit output pin.
With some BMP butons from the touch screen I have to set the frecuency
between 1 Hz for minumum and  4 Khz maximum  in order to move a 
steeper motor; I mean, this signal will be the clock for the driver, so
once I have selected the frecuency, the signal frecuency must be very
steady without any noise. (As you know because the motor would cough)
Do you have some idea of how to get this??

My other challenge is how to attend an external interruption from
an incremental digital encoder signal. I would  read two signals,
 channel A and channel B; and the idea is to convert, through the 
mini2440, the incremental encoder to an absolute encoder. 
The encoder I am using is a 500P/rev and the speed of movement generate 
a frecuency between 1KHz up to 15 Khz,
So, I have to read  the two signals in 15 Khz; increment or decrement a 
16 bits counter, and strore it in memory.
Do you have some idea of how to get this??


Well, I will be looking forward to hearing from you.


PS. Thanks againg for your help.

Best Regards.
Ernesto

anatoly
Hi Ernesto,
Please, first try to learn the step motor sketch.
The interrupts examples are also supplied.
But I'm sorry, I have no such time to make your projects.
They aren't too difficult for you too.
Such things I've done using the Atmel's AVR ATtiny2313 working on just 4
MHz inner oscillator and assembler.
Regards,
Anatoly

ernesto
Hi Anatoliy.

Thanks anyway for your help and support.
It has been very usefull and rich your help.

I will try the application, and read the examples.



PS. Thanks againg for your help.

Best Regards.
Ernesto

Kumar
Hi Anatoly, 
            Your Startos is really awesome. It make ARM programming easy
for me. Now my problem is to interface Pen Drive to mini2440 so that i can
view the data present in it or at least write some data into a file in it.
kindly guide me to complete this task by your valuable suggestions and
experience too. 

Thanks & Regards, 
   Kumar

anatoly
Hi Kumar,
I'm sorry, but have not implemented such fuctionality (USB) yet.
What for me, I'm working with micro SD cards (SDHC in case of mini210s),
placing them into pen-sized card reader when connecting to PC.
My interest is a bit differ then providing people with OSes (and moreover,
for free).
I switched on the mini210s, cracked it totaly in non OS and try to
implement projects by now.
Here on the forum was Vernon Lermond, he attached the USB stack and FAT32
by himself. Results you may see at:
http://www.cttestset.com
So, for learning purposes just find and use the same stuff.
Regards.

Kumar
Thanks for the info Anatoly....

Ravi Kumar
Hi Anatoly,
              I recently brought mini2440 and while trying to program it
without OS i came across your Start OS which was really interesting. I have
downloaded your stuff and was trying with all the applications in it. I
want to interface a stepper motor and control it from mini2440 and for
which i have seen your stepper motor application. I was unable to
understand what kind of hardware interfacing you have use. Have you used
any specific Driver IC or controller outside the mini2440. Kindly help me
in this issue so that i can move forward in my Masters degree Project. 


Thanks & Regards, 
   Ravi Kumar.V

anatoly
Hi Ravi,
It was just demo for showing possible way of interfacing.
Of course, mini2440 board have weak signals.
You may use the Step motor and its controller depending of your needs.
I've implemented such as:
http://www.stepmotor.biz/fl86sth80.htm?gclid=CIrQtLSGrsECFWaQcgoduEIAMA
and
http://www.stepmotor.biz/smd.htm#smd42

There are lot of them:
http://www.ebay.com/sch/i.html?_odkw=FL86STH80&_from=R40&_osacat...

Even PCB from old Floppy Drive may be used.
Regards

Ravi Kumar
Hi Anatoly,

Thanks for the info. I will try to check that.


Thanks & Regards,
  Ravi Kumar.V

balasaidulu
hi AnatoliyBesplemennov,

i am using Resistive touch screen for my application till now. 
but as per the requirement i need to upgrade it to capacitive touch screen,
 can u suggest me what sort of stuff to change without effecting my regular
application operation , also i am ready to change or upgrade to any ARM
that could support capacitive touch screen 7 inch.

reply me soon.

balasaidulu@live.com

anatoly
Hi balasaidulu,

I didn't clear understand, are you using StartOS or what?

If capacitive touch screen you plan to use has standard 1-wire interface,
as in other FriendlyARM boards, it can be used. I'm not sure about
multitouch.
I don't have such touch screen to test it. Also, I don't have modern
mini2440 or mini2451 board with superboot and 1-wire touch screen.

Instead, I've bought Mini210s board with H43 LCD with 1-wire interface.
StartOS works fine on Mini210s, but I didn't implemented Ethernet stuff and
TCP IP stack yet and maybe will not do it.

I can suggest you to define the configuration: Board and LCD. Next, just
write program interface for connecting via 1-wire. It is not complex, 31
pin (as I remember) of LCD interface you can crack even using Arduino...

So, all you need - to switch to 1-wire.
I can not help here, because I don't have a capacitive LCD. Otherwise, I'd
try to connect it to Mini210s board which I already own.

Another advice - use NanoPC-T1 and Android.

balasaidulu
Hi anatoly ,

Thanks for your reply, i am using STARTOS for my application. presently i
am using 4 wire resistive touch screen for my mini 2440 board. 1 GB nand
flash. 

can u give some example program how to use gpio suing startOS. 
i have to interface few switches and relays to control motors and LEDs.

anatoly
Hi Balasaidulu,

Visit this link:
http://code.google.com/p/startos/
there're sketches in rar archives.
They work with buttons, LEDs, PWM, Timer (via interrupts too).
In SCADA (pick up for your LCD, i.e. 35L(Landscape) - for W35, 35P
(portrait) 70L - A70 LCD) you may find how to work with LEDs, sounds,
Internet and more)

For mini2440 I have resistive screens.
For mini210s I have 1-wire screen only.

More downloads for mini210s are here:
http://physicalcomputing.ru/articles_en/p_rt-210_en.html

If you will work with StartOS and mini2440 then you can easily to jump with
the same programs to mini210s.
Program it in ADS1.2 too.


Look at PWM 2-channel control for instance:


-----------------------------
//  PWM_out / startos
#define  U32  unsigned int
#define  U16  unsigned short
#define  U8  unsigned char

#define rGPBCON    (*(volatile unsigned *)0x56000010)  //Port B control   
*** Not necessary

//(0x1F<<11)|(0x3F<<5)|(0x1F) ) R G B
#define Yellow  0xFFE0  //  R=F800, G=07E0, B=0000, 
#define White    0xFFFF  //  R=F800, G=07E0, B=001F
#define Red    0xF800  //  R=F800, G=0000, B=0000
#define Green    0x07E0  //  R=0000, G=07E0, B=0000 
#define Blue    0x001F  //  R=0000, G=07E0, B=0000 
#define Black    0x0000  //  B = 0,  G = 0,  R = 0

int    pen_down;
int    x,y;
int    red,blue;



void Main(void)
{
  Fill_Screen(10);    // Dark Blue
  
  Set_Color( 0x7FF );
  Box( 0, 0, 239, 12 );  // x0, y0, x1, y1
  Set_Color( Red );
  Box( 228, 0, 240, 12 );  // x0, y0, x1, y1  
  Print_String( 230, 10, "X");
  
  Set_Color( Red );
  Box( 20,100, 220, 120 );  // x0, y0, x1, y1
  
  Set_Color( Blue );
  Box( 20, 150, 220, 170 );  // x0, y0, x1, y1
  
  Set_Font ( 1, Yellow, 1);
  Print_String ( 60, 10, "Move Sliders");
  Set_Font ( 1, White, 10);
  
  
Start:

  pen_down = Read_TS(&(x),&(y));  // Point X,Y addresses and Read_TS will
fill them with X,Y

  if  ( pen_down )
  {
    if  (   ((y>100)&&(y<120)) && ((x>20)&&(x<200))     )  // Red lane zone
    {  
      Set_Color( Red );
      Box( 20,100, 220, 120 );  // x0, y0, x1, y1
    //  Box( x-12,95, x+20, 125 );  // x0, y0, x1, y1
      red=x-20;
      red=red*255/180;
      Printf( x-12, 110, "%03d", red);
    }
    
    if  (  ((y>150)&&(y<170)) && ((x>20)&&(x<200))   )    // Blue lane zone
    {  
      Set_Color( Blue );
      Box( 20, 150, 220, 170 );  // x0, y0, x1, y1
    //  Box( x-12, 145, x+20, 175 );  // x0, y0, x1, y1
      blue=x-20;
      blue=blue*255/180;
      Printf( x-12, 160, "%03d", blue);
    }
  }


  PWM_out0 ( red );    // PIN31 at CON4  you can use rTCMPB0 = val;  for
speed once the function have been initialized
  PWM_out1 ( blue );    // PIN32 at CON4  you can use rTCMPB1 = val;  for
speed once the function have been initialized

  if  (  (y<30) && (x>200)  )  // Exit zone - so switch GBP from PWM mode
to Output
  {  rGPBCON &= ~3;      //set GPB0 as output [1:0]=11    *** Not necessary
    rGPBCON |= 1;        //set GPB0 as output [1:0]=01    *** Not necessary
  
    rGPBCON &= ~(3<<2);    //set GPB1 as  output [3:2]=01  *** Not
necessary
    rGPBCON |= (1<<2);    //set GPB1 as   output [3:2]=01  *** Not
necessary
    Exit ();
  }

  Delay (100);

  goto    Start;

}

balasaidulu
Hi anatoly ,

Thank you , for your quick response.

i am bit confused here.. to be specific please can you provide only GPIO
program with startOS.

input: 8 switches
output: 8 LEDs.

example program for this  please.

balasaidulu
LED should get ON and OFF when related switch is pressed.

push to ON, Push to OFF

anatoly
Attachment: Buttons.rar (32.8 KB)
Hi Balasaidulu,

I'm sorry but I don't have such time and possibilities to make a sketch.
In attachment there is very simple Buttons sketch. You will learn how to
read buttons.

Nothing complex here:

//  Buttons  / startos

#define rGPGDAT    (*(volatile unsigned *)0x56000064)  //Port G data

void Main(void)
{
    Buzz(7000, 10);
    Fill_Screen(20);
    Set_Font(1,0xFFFF,20);
    Print_String(40,30, "Buttons test example");    
    Print_String(60,50, "Press any Button");    

    Set_Font(0,0xFFFF,20);  // normal, white on blue




Again:

    if( (rGPGDAT&(1<< 0)) == 0 )  {Print_String(70, 80, "Key 1 pressed"); 
Buzz(1000,100);}
    
    if( (rGPGDAT&(1<< 3)) == 0 )  {Print_String(70,110, "Key 2 pressed"); 
Buzz(2000,100);}

    if( (rGPGDAT&(1<< 5)) == 0 )  {Print_String(70,140, "Key 3 pressed"); 
Buzz(3000,100);}
    
    if( (rGPGDAT&(1<< 6)) == 0 )  {Print_String(70,170, "Key 4 pressed"); 
Buzz(4000,100);}
    
    if( (rGPGDAT&(1<< 7)) == 0 )  {Print_String(70,200, "Key 5 pressed"); 
Buzz(5000,100);}

    if( (rGPGDAT&(1<<11)) == 0 )
    {  Print_String  (70,230, "Key 6 pressed, Bye!");
      Buzz(6000,100);
      Delay(1000);
      Exit();    }
      

    Delay(100);
    goto  Again;

}

anatoly
Attachment: LEDs.rar (32.38 KB)
Now learn how to light on a LED.
Project file is in attachment again.

//  LEDs  / startos

#define rGPBCON    (*(volatile unsigned *)0x56000010)  //Port B control
#define rGPBDAT    (*(volatile unsigned *)0x56000014)  //Port B data


int    i, data;




void Main(void)
{

  Buzz(7000, 10);
    
//set GPB0 as output [1:0]=01  [3:2]=01 ...
  rGPBCON = 0x155555;  //01010101...
      
     for  (i=0; i<16; i++)
     {       
       rGPBDAT = (i<<5);
       Delay(500);
  }


// Play with Piezo Speaker too

     for  (i=0; i<1000; i++)
     { 
       rGPBDAT |= 1;
       Delay(1);
        rGPBDAT &=~1;
       Delay(1);
      
       
  }




    Exit();
   
}

anatoly
Attachment: Keys.rar (41.42 KB)
And last, more complex example using interrupts (this part maybe not needed
for you at all).
In interrupt service routine just add lines of code which will light on
certain 
LED, and that's all.


//  Keys Interrupt Sketch  / startos

#define _ISR_STARTADDRESS   0x33ffff00 
#define rGPGCON      (*(unsigned *)0x56000060)        // Port G control
#define rGPGDAT      (*(unsigned *)0x56000064)        // Port G data

#define rEXTINT1    (*(volatile unsigned *)0x5600008c)    // Ext interrupt
control reg1 [EINT8...15]
#define rEXTINT2    (*(volatile unsigned *)0x56000090)    // Ext interrupt
control reg2 [EINT19]
#define rEINTMASK    (*(volatile unsigned *)0x560000a4)    // External
interrupt mask
#define rEINTPEND    (*(volatile unsigned *)0x560000a8)    // External
interrupt pending

#define pISR_EINT8_23  (*(unsigned *)(_ISR_STARTADDRESS+0x34))  //
ISR_ADDRESS for EINT8...23

#define rSRCPND       (*(volatile unsigned *)0x4a000000)    // Interrupt
request source
#define rINTPND        (*(volatile unsigned *)0x4a000010)    // Interrupt
request

#define BIT_EINT8_23  (0x1<<5)                // INTs 8_23 = [5] bit
#define rINTMSK         (*(volatile unsigned *)0x4a000008)    // Interrupt
mask control


  //  EINT8  -----( GPG0 )\
  //  EINT11 -----( GPG3 ) \
  //  EINT13 -----( GPG5 )  INTs 8_23 = [5] bit
  //  EINT14 -----( GPG6 ) /
  //  EINT15 -----( GPG7 )/
  //  EINT19 -----( GPG11)


int    i=10000,eint_number, key_data=0xF;
char  txt[10];  
void  Init_Keys (void);

static void __irq Key_ISR(void);




void Main(void)
{  Print_String (30,50,"Buttons Interrupt Test:");
   Print_String (30,80,"Please Press any Button");
  Init_Keys ();

Again:


  Printf(50,180, "Countdown %d ",i);




  Dec2Asc (eint_number, (char *)txt);
  Print_String(30,130,"EINT:");  Print_String(80,130, (char *)txt);
  
  if  ( (key_data&(1<< 0)) == 0 )  { Print_String(140,130,"Key 1");  }
  if  ( (key_data&(1<< 3)) == 0 )  { Print_String(140,130,"Key 2");  }
  if  ( (key_data&(1<< 5)) == 0 )  { Print_String(140,130,"Key 3");  }
  if  ( (key_data&(1<< 6)) == 0 )  { Print_String(140,130,"Key 4");  }
  if  ( (key_data&(1<< 7)) == 0 )  { Print_String(140,130,"Key 5");  }
  if  ( (key_data&(1<<11)) == 0 )  { Print_String(140,130,"Key 6");  }

  if  (i-->0)  goto Again;
  
  Exit ();

}
////////////////////////////////////////////////////////////////////////////////
//////
void  Init_Keys (void)
{
  // Turn General Purpoise G Control register so GPG to serve as
EINT8,11,13,14,15,19
  rGPGCON = rGPGCON & (~((3<<22)|(3<<14)|(3<<12)|(3<<10)|(3<<6)|(3<<0)))|  
 // Clear 2 bits
              ((2<<22)|(2<<14)|(2<<12)|(2<<10)|(2<<6)|(2<<0));    // Set 1
bit needed
             
  rEXTINT1 &= ~(7<<0);    rEXTINT1 |= (2<<0);    // EINT8  falling edge
  rEXTINT1 &= ~(7<<12);    rEXTINT1 |= (2<<12);  // EINT11 falling edge
  rEXTINT1 &= ~(7<<20);    rEXTINT1 |= (2<<20);  // EINT13 falling edge
  rEXTINT1 &= ~(7<<24);    rEXTINT1 |= (2<<24);  // EINT14 falling edge
  rEXTINT1 &= ~(7<<28);    rEXTINT1 |= (2<<28);  // EINT15 falling edge
  rEXTINT2 &= ~(7<<12);    rEXTINT2 |= (2<<12);  // EINT19 falling edge
  
  rEINTMASK &= ~((1<<8)|(1<<11)|(1<<13)|(1<<14)|(1<<15)|(1<<19));    //
Enable  EINT 8...19
  
  pISR_EINT8_23 = (int)Key_ISR;  // Set Interrupt Service Routine Address
  
  rINTMSK &= ~(BIT_EINT8_23);    // EnableExtIrq  8...23
}
////////////////////////////////////////////////////////////////////////////////
/////
static void __irq Key_ISR(void)
{    //  Don't use startos syscalls here !  //Buzz(9000,100);
  if(rINTPND==BIT_EINT8_23)
   {   if(rEINTPEND&(1<<8))  {  eint_number=8;  }
    if(rEINTPEND&(1<<11)) {  eint_number=11;  }
    if(rEINTPEND&(1<<13)) {  eint_number=13;  }
    if(rEINTPEND&(1<<14)) {  eint_number=14;  }
    if(rEINTPEND&(1<<15)) {  eint_number=15;  }
    if(rEINTPEND&(1<<19)) {  eint_number=19;  }
    
    rEINTPEND = rEINTPEND;  // set bits will clear bits in pending register
  }
  
  key_data = rGPGDAT;
    
  rSRCPND = BIT_EINT8_23;    // Clear Source of Interrupt
  rINTPND = BIT_EINT8_23;    // Clear Interrupt Pending
  
}
/////////////////////////////////////////////////

anatoly
To read 8 pins and turn on 8 LEDs you must also look at shem and found out
what pins are not in use and occupy them for your needs.

I suggest you to consider the camera interface for instance. If you don't
use the camera, its GPIO pins may be reprogrammed for implementing General
Purpose   I/O functions.

balasaidulu
Hi anatoly , 

Thank you for your co operation .

this really helps me a lot.

katalinna
5gujiku

Nagasai Boppudi
Hi guys! I am a newbie. Excuse me for asking this. Can mini2440 be
programmed using keil uvison 4?

anatoly
Yes!

Nagasai Boppudi
Is there any step by step procedure for programming mini2440 in keil?

anatoly
https://code.google.com/p/startos/downloads/list 
on the bottom of this page you may find some examples.

balasaidulu
Hi anatoly, 

can we interface lp104v2 - 10.4" LCD TFT to replace my 7" LCD with touch
screen? if there is a possibility, can u guide me how to do>>

thanks in advance.

Anatoly
Hi Balasaidulu,
I think it's possible, but we must find somewhere the timing parameters for
it. Next, I will embed them into StartOS and you will try how it works. And
I need to say that I have almost no time, will have a trip and will return
in the middle of January only.

balasaidulu
Hi anatoly, 

i am waiting for your response. thank you

Anatoly
Hi Balasaidulu,

I was waiting for your response too.
Why I was waiting? - Just because I don't have such LCD and thus I cannot
experiment with it. Also I want to say that StartOS is intended for
learning purposes, so 3.5", 4.3" and 7" LCDs, standardly used by
FriendlyARM are enough.

As you have another nonstandard LCD and you're interesting to connect it, I
can suggest you how you to do the following job.

First, connect the LCD and the Mini2440 board physically. I mean connect
them both with wires.

Here is FriendlyARM Mini2440 Pinout
LCD41P LCD Connector

 1  VDDLCD
 2  VDDLCD
 3  VD0
 4  VD1
 5  VD2
 6  VD3
 7  VD4
 8  VD5
 9  VD6
10  VD7
11  GND
12  VD8
13  VD9
14  VD10
15  VD11
16  VD12
17  VD13
18  VD14
19  VD15
20  GND
21  VD16
22  VD17
23  VD18
24  VD19
25  VD20
26  VD21
27  VD22
28  VD23
29  GND
30  LCD_PWR
31  GPB1
32  nRESET
33  VM
34  VFRAME
35  VLINE
36  VCLK
37  TSXM
38  TSXP
39  TSYM
40  TSYP
41  GND

And here is pinout for LP104V2 LCD (taken by Googling)

 1 GND    Ground
 2 CLK    Data clock
 3 Hsync  Horizontal sync
 4 Vsync  Vertical sync
 5 GND    Red data(LSB)
 6 R0    Red data
 7 R1    Red data
 8 R2    Red data
 9 R3    Red data
10 R4    Red data
11 R5    Red data(MSB)
12 GND    Ground
13 G0    Green data(LSB)
14 G1    Green data
15 G2    Green data
16 G3    Green data
17 G4    Green data
18 G5    Green data(MSB)
19 GND    Ground
20 B0    Blue data(LSB)
21 B1    Blue data
22 B2    Blue data
23 B3    Blue data
24 B4    Blue data
25 B5    Blue data(MSB)
26 GND    Ground
27 ENAB    Data timing signal
28 VDD    Power supply +5V
29 VDD    Power supply +5V
30 NC    No connection
31 NC    No connection

After them will be connected by wires, I suggest you to take test2440
sources and pick up the LCD parameters, such as: LCD width, height, pixel
clock, margins, pulses lengths and its polarities as shown below. 

After that LCD parameters will be found out, then I will implant them into
StartOS sources and will compile them, getting the binary file.

That's all for a while.

Regards,


#if defined(LCD_X35)

////////////////////////////////////////////////////////////////////////////////
/////////
#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define LCD_PIXCLOCK 4

#define LCD_RIGHT_MARGIN 25
#define LCD_LEFT_MARGIN 0
#define LCD_HSYNC_LEN 4

#define LCD_UPPER_MARGIN    6    //8
#define LCD_LOWER_MARGIN  4
#define LCD_VSYNC_LEN     3    //5  //9
#define LCD_CON5 ( (1 << 11)| (1<<0) | (1 << 8) | (1 << 6) | (1 << 9) | (
1<< 10))
////////////////////////////////////////////////////////////////////////////////
/////////

#elif defined(LCD_T35)
#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define LCD_PIXCLOCK 4

#define LCD_RIGHT_MARGIN 25
#define LCD_LEFT_MARGIN 0
#define LCD_HSYNC_LEN 4

#define LCD_UPPER_MARGIN 1
#define LCD_LOWER_MARGIN 4
#define LCD_VSYNC_LEN 1
#define LCD_CON5 ( (1 << 11)| (1<<0) | (1 << 8) | (1 << 6) | (1 << 9) | (
1<< 10))


#elif defined(LCD_L80)
#define LCD_WIDTH 640
#define LCD_HEIGHT 480
#define LCD_PIXCLOCK 2

#define LCD_RIGHT_MARGIN 67 
#define LCD_LEFT_MARGIN 40
#define LCD_HSYNC_LEN 31

#define LCD_UPPER_MARGIN 25
#define LCD_LOWER_MARGIN 5
#define LCD_VSYNC_LEN 1


#elif defined(LCD_N35)

#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define LCD_PIXCLOCK 4

#define LCD_RIGHT_MARGIN 36
#define LCD_LEFT_MARGIN 19
#define LCD_HSYNC_LEN 5

#define LCD_UPPER_MARGIN 1
#define LCD_LOWER_MARGIN 5
#define LCD_VSYNC_LEN 1


#elif defined(LCD_A70)
#define LCD_WIDTH 800
#define LCD_HEIGHT 480
#define LCD_PIXCLOCK 2

#define LCD_RIGHT_MARGIN 67
#define LCD_LEFT_MARGIN 40
#define LCD_HSYNC_LEN 31

#define LCD_UPPER_MARGIN 25
#define LCD_LOWER_MARGIN 5
#define LCD_VSYNC_LEN 1

#elif defined(LCD_VGA1024768)
#define LCD_WIDTH 1024
#define LCD_HEIGHT 768
#define LCD_PIXCLOCK 2

#define LCD_RIGHT_MARGIN 15
#define LCD_LEFT_MARGIN 199
#define LCD_HSYNC_LEN 15

#define LCD_UPPER_MARGIN 1
#define LCD_LOWER_MARGIN 1
#define LCD_VSYNC_LEN 1
#define LCD_CON5 ( (1 << 11)| (1<<0) )

balasaidulu.n
ok Anatoly,
 i will connect and try , let me have some time to figureit out and get
back to you soon.

anatoly
Hi Balasaidulu,
good luck with experiments.
Another issue will be the touch screen. It must be connected as resistors
in FriendlyARM LCDs. 
In RT-210 (analog StartOS for mini-210s I've implemented 1-wire interface
but not as FriendlyARM did and much simpler).

balasaidulu
Hi anatoly,

How are you, I bought a new mini 2440 with 7" lcd touch. As I had followed
the same procedure to make this board ready for running my code with
startOS, its not connecting with USB, dnw shows only serial connection ,
USB:x . I tried my level best to figure out, but I need ur help . Can u
suggest me how to do this by using superboot .

anatoly
Hi Balasaidulu,

I look here in rare cases, nobody is interesting in bare metal programming
as I see.
I have about 5 mini2440 boards with old uboot and for dnw.exe.
People consider that boards finishing production and buy mini2451 with
superboot instead.
Also, I have 4 mini210s boards with superboot. And ported startos there.
I've hacked their "proprietary" 1-wire touchscreen protocol. No need to
apply any CRC-coded tables as they have done :) So, startos for mini210s
works with new technology: superboot and 1-wire touchscreen.
I wonder now why FriendlyARM did not apply superboot early? They used uboot
and loaded programs via USB cable like first 8-bit computers.

So, please understand me right - I spent money, a lot (years) of time and
got nothing from these boards! How do you think - should normal man
continue this project?

What I can suggest to you?
1. Try to make non-OS programs, put them onto SD card and launch! Now
superboot will run your programs instead of startos. But superboot does not
provide the user's API. So, all work with devices will be yours.
2. Peoples replace superboot with uboot, find how at this forum.
3. Consider to switch to mini2451 or mini210s.
4. Apply Odroid or Android boards. Indeed, FrienlyARM boards are the same
as Samsung developer's board, Odroid is well documented.

If I had mini2440 or mini2451 with superboot I'd be able to port startos
there, but I think the FriendlyARM boards branch is dead end.
FriendlyARM's boards were good for bare metal applications and now all
became "proprietary"! To work with Android I use cheap Android phone!

You can make your projects using Android as a head device and MCU as
peripheral one.
For instance, take a look:
http://youtu.be/I7HYW9iIwuU
http://youtu.be/4dXfFiu7xEA
http://youtu.be/JPv1eqkueMQ
Control the CNC machine with Android or any other device via Bluetooth:
https://youtu.be/-k9ZY7N-zYE

Sorry, I can't help you directly porting startos to mini2440 with superboot
due the lack of such board and the absence of a wish to spend more time ...
I hoped that FriendlyARM may sponsored this work but nope.

anatoly
Forgot to mention:
Try to write StartOS fo 7" LCD onto SD card and launch it from SD card.
Hope it will work (but the 1-wire - need to resolder it on resistive mode
or use your own routines).

balasaidulu
Hi anatoly , 
               i had converted superboot to supervivi and entered into BIOS
mode. for your information, all my programs were running using STARTOS
only. Thank you for this wonderful OS . 

source for my knowledge: post of Ferdynand Naczy324ski / topic /261 
 and Post of lakshmikanth/ topic/ 5391
 thanks guys for your posts.

if any one wants how to upgrade from superboot to supervivi and enter into
BIOS, let me know.

anatoly
Hi Balasaidulu,
Thanks for good words and news.
But interesting (if you have another board with superboot) are you able to
launch startos (as any other binary user program) from the SD card using
the superboot?
Mini210s boards can run startos from SD card via superboot or if it is
burning to NAND memory too.
NanoPC T-1 does NOT have option in its superboot to launch user's bin file.
Mini2440 or mini2451 with superboot I did not accessed - I have not them.
As I think, you must place a file FriendlyARM.ini in root or "images"
folder (i.e. E:\FriendlyARM.ini or E:\images\FriendlyARM.ini where E: -is a
letter of SD card on your PC).
Contents of the file:
#This line cannot be removed. by FriendlyARM(www.arm9.net)

LCD-Mode = yes
LCD-Type = A70 (or yours here)
USB-Mode = No

Action = Run
#Action = Install
OS = UserBin
#OS = Android

Check CRC32 = no
Status Type = Beeper| LED

#User Bin part
UserBin-Image = startos.bin

userBinStartAddress = 30000000

Refer for docs for mini2440 superboot to adjust if needed.
Another issue will be touch screen. If it is resistive you can resolder
some part (see here in the forum or LCD schematics - about 5 resistors 0
Ohms as wires). 1-wire touch screen is good for capacitive TS). Is includes
Texas Instruments TS controller and 8051 compat. (but fast) 16-bit MCU.
They read X and Y then swap some groups of bits (I have not idea why!) and
send them to mini via non-standard 1-wire protocol).
I built my own routines for mini210s to retrieve X,Y and can send
brightness to LCD. They will not work with mini2440 unless I have new board
in my hands. Hardware registers differ in S3C2440A and S5PV210 (and next
Samsung's SoCs too) it's very difficult to have a deal with all this stuff
if you work alone.
And, the Mini210s is a Great board! I recommend it for your further
projects. All you programs for startos will work on new hardware.

Other option - you may read X Y using your own way via RS-232 or Bluetooth
via HC-06 module for instance.

Good luck!

balasaidulu
Dear Anatoly ,
                 thanks for your suggestions, 
i had tested my application with the new board(superboot Converted to
Supervivi) and it was working fine. but the problem is as you had said with
Touch screen. it was not responding with the 2440 board with startOS and
Win CE as well. i have not tested with other OS . 

can you suggest any type of modification that i need to do in the
touchscreen controller board. we are using resistive touch screen. 
 
if you have nay schematic in comaprision , welcome. 

thanks

anatoly
Hi Balasaidulu,
(Maybe with superboot it works? As I think put the startos binary on SD
card and it must be launched)
To work with touchscreen you may:
1. Resolder resistors, remove R11, R20, R21, R22 and install R6, R7, R8,R9
(look at schematics file attached). Maybe R30 (and even R23) must be
removed. All resistors represent just a short wires.
More information search here, on the forum...
2. Find somewhere sources for 1-wire - I saw them but they work using
timers and its delays, too complicated.
3. Crack 1-wire interface by you own and create your routines. Connect an
oscilloscope to 31 pin on LCD and watch. I thought that there're high
speeds but they work about 9600 Bod. I used Arduino to watch the signal.
4. Here on the forum was some Vernon Lermond. Days ago he posted on
Facebook that he successfully connected mini2440 to 7" A70 LCD via 1-wire.
Write him a message on FB and maybe he will help you.

As the 7" LCD is big then the calibration must be done at several points,
not just corners. So, I suggest you to use 1-wire TS. It's good and
accurate.
Command 0x40 means get XY
Command 0x60 means get Info
Other values will change brightness of the LED light.

Routines will be simple, I did it long ago for mini210s and can show draft
example (with comments left from Arduino code :) Just for reference and no
warranties, then I've polished the code, make xor / or groups of bits
combinations and used it in RT-210 (formely StartOS) for mini210s.

/  1-Wire LCD 210s / StartOS
//  © Anatoly Besplemennov
//  StartOS  Anatoly Besplemennov
//  07-oct-2013  17:48

#define  U32  unsigned int
#define  U16  unsigned short
#define  U8  unsigned char
////////////////////////////

#define  GPH1CON  (*(U32 *)0xE0200C20)
#define  GPH1DAT  (*(U32 *)0xE0200C24)  //GPH2DAT[7:0]  [7:0]
#define  GPH1PUD    (*(U32 *)0xE0200C28)

//  GPH1CON[2]  [11:8]  0000 = Input
//            0001 = Output
//            0010 ~ 1110 = Reserved
//            1111 = EXT_INT[10]



void    delayMicroseconds    (U32 uS );
void    Write_Ts    ( char cmd );

//#define t    110
#define sam  60

//#define delayMicroseconds  uDelay


int  i=0;
int  t;
int  mX;
int  mY;
int  non;
int  cmd;

char buffer[sam+4];

Main    (void)
{
  i = 0;
  t = 110;  //  sample it every 110 uSec
  
  GPH1PUD &=~(3<<4);  // 10 = Pull-up enabled
  GPH1PUD |=(2<<4);
  
st:

//  if  (  cmd == 0x63 )  cmd = 0x9E;
//  else        cmd = 0x63;

  GPH1CON &= ~(0xF<<8);  //   [11:8]=0000
  GPH1CON |= (1<<8);    //   [11:8]=0001 > Output
      
  cmd = 0x40;  // get XY
//  cmd = 0x60;  // get Info

  GPH1DAT &= ~(1<<2);    //   GPH1_2=Low
  delayMicroseconds(2*t);
  Write_Ts   ( cmd );

  cmd = 0x8A;  // get XY
//  cmd = 0x6A;  // get Info
  Write_Ts   ( cmd );

//  GPH1DAT |= (1<<2);    //  GPH1_2=High

//////////    

   GPH1CON &= ~(0xF<<8);  //   [11:8]=0000 > Input  

  for ( i = 0; i <= sam; i++)
  {
    delayMicroseconds(t);
    buffer[i] =  (GPH1DAT&(1<<2));  //   digitalRead(IR);
  }
 
////////////////////////////////////////////////////////////////////////////////
/////////////////////
  mX = 0;
  if (buffer[5])  mX |= (1<<9);  //0b1000000000;// X9
  if (buffer[6])  mX |= (1<<8);  //0b0100000000;// X8
  if (buffer[7])  mX |= (1<<7);  //0b0010000000;// X7
  if (buffer[8])  mX |= (1<<6);  //0b0001000000;// X6
     
  if (buffer[17])  mX |= (1<<5);  //0b0000100000; // x5
  if (buffer[18])  mX |= (1<<4);  //0b0000010000;// x4
  if (buffer[19])  mX |= (1<<3);  //0b0000001000;// x3
  if (buffer[20])  mX |= (1<<2);  //0b0000000100;// x2
  if (buffer[21])  mX |= (1<<1);  //0b0000000010;// x1
  if (buffer[22])  mX |= (1<<0);  //0b0000000001;// x0

//  if (buffer[24])  mX |= mX |  0b000000000010;
//  if (buffer[25])  mX |= mX |  0b000000000001;
//  Serial.print( " X=" );   Serial.print( mX, DEC );

  printf ( " X = %d ", mX );

  mY = 0;
  if (buffer[1])  mY |= (1<<9);  //0b1000000000;// Y9
  if (buffer[2])  mY |= (1<<8);  //0b0100000000;// Y8
  if (buffer[3])  mY |= (1<<7);  //0b0010000000;// Y7
  if (buffer[4])  mY |= (1<<6);  //0b0001000000;// Y6
      
  if (buffer[9])  mY |= (1<<5);  //0b0000100000;// y5
  if (buffer[10])  mY |= (1<<4);  //0b0000010000;// y4
  if (buffer[11])  mY |= (1<<3);  //0b0000001000;// y3
  if (buffer[12])  mY |= (1<<2);  //0b0000000100;// y2
  if (buffer[13])  mY |= (1<<1);  //0b0000000010;// y1
  if (buffer[14])  mY |= (1<<0);  //0b0000000001;// y0

//  if (buffer[16])  mY |= mY |  0b000000000010;
//  if (buffer[17])  mY |= mY |  0b000000000001;
//  Serial.print( " Y=" );   Serial.print( mY, DEC );
  printf ( " Y = %d ", mY );

////////////////////////////////////////////////////////////////////////////////
/////////////////////
  for ( i = 0; i <= sam; i++)
  {  if ( buffer [ i ] )    { buffer [ i ] = '|';  }
    else                    {buffer[i]='.';}
    uart_putchar ( buffer [ i ] );
    
  }

 
  delayMicroseconds (200000);
//  t++;  printf ( " t = %d\n ", t );
  
  goto    st;

}
//////////////////////////////////////////////
//////////////////////////////////////////
void    Write_Ts    ( char cmd )
{  int  i;
  for  ( i = 0; i < 8; i++ )
  {  if ( cmd&(0x80>>i) )  {  GPH1DAT |=(1<<2); }
    else          {  GPH1DAT &= ~(1<<2);  }
    delayMicroseconds(t);       
  }
}
////////////////////////////////////////////////////////////////////
void    delayMicroseconds    (U32 uS )
{  int  i,j;
  for ( i=0; i<uS; i++)  {  for ( j=0; j<132; j++) {}  }  // 32 = 240/min
}
/////////

balasaidulu
Dear Anatoly, 

thank you for reply, 
i had resolved the issue. replaced the L2,L3,L4,L5 with R24,R25,R26 R27 all
are 0 Ohms. now it was working fine. 


i need your suggestion and help me with any example code for the below.

implementing CNC machine (with X,Y,Z, W axis ) with mini 2440 . 

i had seen a video of cnc machine using mini2440 . is there any way to
implement this as a motion controller? if so , do you have any example code
to implement it using stepper moders & encoders.

hope a genius like you , can do the best.

balasaidulu
Hi Anatoly,

is there any limitation for SD card memory access to mini 2440 ? 
presently i am using 2GB SD memory card, i want to go for 4GB and More than
that . 

Let me know the details if i want to increase the size of ext memory. 

my program will be in SD card.

Anatoly
Hi Balasaidulu,
Regarding SD card - S3C2440A SoC in mini2440 has limitations of SD card
volume - it may be standard capacity, 2Gb only, read data sheet. (there are
algorithms for more, but they use 1-bit data transfer mode, I think, it
will be too slow).
That's one of the reasons why I suggested StartOS for mini220s - its
processor S5PV210 allows using both SDSC and SDHC (high capacity) cards. I
tested it with cards up to 8Gb (I don't have bigger).
You can ask Vernon Lermond - he connected USB flash drive to mini2440. Or
take USB storage stack and implement it.

About CNC - look at Great GRBL project. X, Y and Z may be built with Atmel
AVR ATmega328 $1 MCU. More axis - use Arduino2560 or its MCU standalone.
GRBL is open source, it uses timers, mini2440 has more timers with more
resolution, code is written in C language, so all the job may be done for
mini2440.
Regards,

Andres D'Andrea
Hi Anatoliy, first of all let me say that I found your work on StartOS
pretty impressive and interesting.

I was wondering if I can run it on the latest SBC NanoPi-M3 ?

Another thing, please point me in the right direction about my project:

- I want to make a stand alone application based on the NanoPi-M3 to
control stuff in my home, like lightning, water pump, room temperature,
garden srinkler, and that kind of stuff.  

- What would be the best approach according to you for making that using
the NanoPi-M3 and the StartOs?  

- What programming language should I use to develop my application in order
to work with Start OS?  

- Please realize that my background is specially in electronics, but I'm
starting to learn about programming and linux system administration, It
just seemed very interesting the idea of doing my stuff with other thing
than Linux.

Best regards.

Anatoly
Hi Andres,
Thanks for interesting.
This is sad story. Porting to NanoPi-M3 needs a startup code for this
board. Even in case of Mini210s this was very difficult because of
differences in SoC hardware. And I don't know how to turn on other cores of
processor. Having no support I only could make what I've made.
Even mini2440 changed, appeared mini2451 and I don't have this boards thus
cannot port on them.
So, I suggest you to look at Arduino for prototyping (next, you will be
able to build the same things on MCUs) and Android phone/tab/board with
Bluetooth as a Head and communication (Wi-Fi) unit.
Or, use SBC with Android installed and .so libraries for general
input-output.
To write programs, you can use any IDEs and languages, which may produce
binary code: ADS1.2, Keil, IAR, Atollic Studio, GCC. Sometimes I launched
Micrium's uCOS, Chinese RTOS (don't remember its name) and other binaries
under StartOS. I prefer ADS1.2 and C language (it's very suitable for
learning ARM Assembler too). Moreover, in both cases: for mini2440 (ARM9)
and Mini210s (ARM Cortex-A8).
Linux is good too, BTW. But it is not real-time (you will access devices as
files and drivers, not hardware registers/bits) and, as I know, you must
choose its components and recompile the Kernel. Then you will get custom
small and fast OS for your needs. For real-time access you, of course, can
build your own binaries, but they may destroy the system while working.
Regards.

jhon
You’re so awesome! I don’t think I’ve read something like this
before. So nice to discover someone with unique thoughts on this subject
matter.
Seriously.. thank you for starting this up. This web site is
something that is needed on the internet, someone with some originality!
http://hashmipc.net/idm-6-26-build-10-crack-keygen-serial-key/

Movavi Video Converter 17
After looking at a handful of the articles on your blog, I really
appreciate your way of blogging.I saved as a favorite it to my bookmark
website list and will be checking back soon. Please check out my website
too and tell me what you think
http://hashmipc.net/movavi-video-converter-17-crack/

cnts
Will have a look at actually using it over the next few weeks.

http://coads.myfablog.ir/
http://myfablog.ir/
http://ruzblog.com/link
http://www.ruzblog.com/
http://coads.ruzblog.com/
http://www.ironiblog.ir/
http://ironiblog.ir/
http://news.ironiblog.ir/
http://coads.ironiblog.ir/
http://ruzfa.ir/
http://coads.blog90.ir/
http://blog90.ir/
http://chatghoghnoos.ruzblog.com/
http://salardanlod.ruzfa.ir/
http://pardiswebc.ruzfa.ir/
http://link.blog90.ir/
http://link.ruzblog.com/
http://backlink.ruzblog.com/
http://goodmorningtextmessages.ruzblog.com/
http://facenama.ruzblog.com/
http://salardanlod.ruzfa.ir/post/14
http://salardanlod.ruzfa.ir/post/10
http://facebookcom.ir/
http://persian-nod.ir/
http://omidfars.ir/
http://asemane-shahr.ir/
http://chatfarsi.ir/
http://7musics.ir/
http://blogrss.ir/
http://bit.ly/2pjYSMW
http://bit.ly/2oVFgvA
http://bit.ly/2o9iYsU
http://bit.ly/2pWVzav
http://bit.ly/2pIcoa3
http://bit.ly/2o97C8b
http://bit.ly/2oPxODB
http://bit.ly/2pIH4e5