Hi All i want to write a program in c# for working with 40 Pin GPIO in s3c6410, please help me thanks
GPIO in s3c6410 and c#
in this code hPort = CreateFile("GIO1:", GENERIC_READ | GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero); what can i pass to the function instead first parameter "GIO1:"?
You can pass whatever driver is available in your device, like "LED1:" to modify the port: DeviceIoControl(hPort, i, null, 0, null, 0, 0, IntPtr.Zero); // i is a variable Get some more info on this of submit your code so we can better understand what you asking. Here is some part of the LED code to began. // Variable of Device static IntPtr hPort; // Declare Function [DllImport("coredll.dll")] public static extern IntPtr CreateFile(String lpFileName, UInt32 dwDesiredAccess, UInt32 dwShareMode, IntPtr lpSecurityAttributes, UInt32 dwCreationDisposition, UInt32 dwFlagsAndAttributes, IntPtr hTemplateFile); [DllImport("coredll.dll")] public static extern bool DeviceIoControl(IntPtr hDevice, UInt32 dwIoControlCode, Byte[] lpInBuffer, UInt32 nInBufferSize, Byte[] lpOutBuffer, UInt32 nOutBufferSize, UInt32 lpBytesReturned, IntPtr lpOverlapped); [DllImport("coredll.dll")] public static extern bool CloseHandle(IntPtr hDevice); // Constant of Function const UInt32 OPEN_EXISTING = 3; const UInt32 GENERIC_READ = 0x80000000; const UInt32 GENERIC_WRITE = 0x40000000; const Int32 INVALID_HANDLE_VALUE = -1; // Constant from LED Driver const UInt32 LED_1_ON = 0x01; const UInt32 LED_2_ON = 0x02; const UInt32 LED_3_ON = 0x03; const UInt32 LED_4_ON = 0x04; const UInt32 LED_All_ON = 0x05; const UInt32 LED_1_OFF = 0x06; const UInt32 LED_2_OFF = 0x07; const UInt32 LED_3_OFF = 0x08; const UInt32 LED_4_OFF = 0x09; const UInt32 LED_All_OFF = 0x0A; public void OpenPort() { // Open LED Device hPort = CreateFile("LED1:", GENERIC_READ | GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero); if (hPort == (IntPtr)INVALID_HANDLE_VALUE) { MessageBox.Show("Open LED1 Driver Fail"); } } public Int32 ThreadSpeed = 100; public void Go() { uint i=0; while (true) { DeviceIoControl(hPort, i, null, 0, null, 0, 0, IntPtr.Zero); if (i < 0x0A) { i++; } else { i = 0; } Thread.Sleep(ThreadSpeed); } } }
thanks dezso , your code works on mini2440 , but does not work on s3c6410es and this message appears : "Open LED1 Driver Fail" I think the port name in s3c6410 is different i will be happy if u tell me another solution :) thank a lot
can u tell me your email address dezso to talk about this problem ? i am in critical state and i loose my work :(
Im using this on 6410 board, should work fine Do you have the LEDdriver installed, check [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\LEDdriver] Should have LEDdriver.dll in your windows folder enjoy3d@hotmail.com
Deszo, Is it possible to control more than 8 pins for mini6410 with userkey.dll or any other dll?. If so, how is this?. Could you please give me an example?. I need 12 inputs but don't know how to do it. Thanks in advance
12 input, don't know if any of the gpio port have 12 input available in one register, you should just use external device like pic/avr/i2c buss expander on i2c or even fdti232 on usb to read 12 pin. Also don't forget that this pins are 3.3v, you definitely don't want to demage any of the 6410's io pin, myself I alway like to play safe and connect external port expander if I want to drive or read something outside of the board. I have modified the the LEDdrive to port K so I can controll MAX 3485's flow control pin but everything else goes thru PIC16F chip to drive relays and read switches.
Dezso, thanks a lot for your answer. As per my understanding of your answer to hiwa, led driver can be handled to be used as inputs or did I understand wrong?
Led driver are for output's, if you got the BSP than look up the LEDDriver.cpp LEDSet set or clear the pin, at the init stage the pins set as output so it wont be able to read. static BOOL LEDSet(int number, int value) { if (number >= 0 && number < 4) { if (!value) { g_pGPIOReg->GPKDAT &= ~( 1<< (0+number)); } else { g_pGPIOReg->GPKDAT |= ( 1<< (0+number)); } return TRUE; } else { return FALSE; } }
GPKCON0 Bit Description Initial State 0010 GPK0 [3:0] 0000 = Input 0001 = Output 0010 = Host I/F DATA[0] 0011 = HSI RX READY 0100 = Reserved 0101 = DATA_CF[0] 0110 = Reserved 0111 = Reserved static BOOL LEDGpioInit() { RETAILMSG(1,(TEXT("LED_Gpio_Setting----\r\n"))); g_pGPIOReg->GPKCON0 = (g_pGPIOReg->GPKCON0 & 0xFFFF0000U) | 0x1111U; /* 0x0000U wold set it as input but no routine implemented to read pin*/ g_pGPIOReg->GPKDAT &= 0xF0U; return TRUE; }
dear dezso thank you for your reply I have not LEDDRIVER.dll in "wince drive\windows" folder i have 2 question the first is how i can find leddriver and gpiodriver and ... for my device and the second one is how i can check the registry "[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\LEDdriver]"
Download and install the 6410BSP for your board, start up MS2005, open your 6410 platform builder project, add or include the driver than SYSGEN for the registry open regedit in your device or use MS remote registry editor than navigate to the tree
do u create this bsp? i have not correct driver and i can not create this project if u have this file please send me , thanks my board is s3c6410es
I have to guess that your board isn't Mini6410, it just a DevBoard using S3C6410, right ? First find the tutorial how to get VS2005 and WINCE6R3 with all updates installed. Second download and install the BSP and SDK http://arm9download.cncncn.com/mini6410/wince6/20101121/Mini6410-WinCE6-... Third find out what are the differences between your DEV and MINI6410, modify BSP, build new OS.
Also you could just extract the bsp archive and find the Leddriver driver, I'm not around my pc but I believe it's located in sec/drivers/builtin/Leddriver If you have your dev board bsp than you can just add it as sub project and edit the platform.reg/platform.bib There is a lost if info out there, just need to connect the dots :)
thanks a lot dear Dezso fot your attention I have some problem: 1- my board is not mini6410 , it is s3c6410es,check this address for it's schematic http://vip.eca.ir/sharing/uploads/s3c6410-ARM11-Board.jpg 2- can you upload the file that you put it's address in another server? i can't download it in this address 3- GPIO in mini6410 is 30 pin and in this board is 40,how can i access it's extra pins? 4- how can i find the GPIO driver for this board , it is special 5- i am in critical state as i said and haven'r enough time , can you send me the bin file that support my board with 4.3 inch LCD? if you can create it for me and send it i can come back to my work thanks a lot
i want to turn on some device(7 devices) and need to use GPIO , and i cant drive GPIO ports of my board :( if you have this board please give me your NK.bin file to upload it on my board
thank you very much , you are a real man , i hope we can be good friends my internet connection is very slow in home and i can download it morning , please don not remove this link until 12 hours later
dear Dezso, i had loaded image from sd card later , but i never load image using USB in related to this board , can you explain me this steps?
1. Switch to NOR to burn u-boot into your nand flash by 'v' command 2. switch to nand boot mode 3. boot from u-boot nand 4. burn nboot by 'n' command 5. burn wince by 'w' command 6. power cycle the board So you use windows on your pc? Use dnw tool to download the images. The switch setup as follow. 1 2 3 4 0 0 1 1 normal NAND boot. 0 1 0 1 NOR boot I did not sent the nboot.nb0 but you should have that in you dev cd or where ever you have your support files.
Serial cable ? Baud rate? Are you getting anything in the terminal? any junk maybe or nothing at all.
I wish if this forum would be more like every other "normal" forum, chat, file/picture upload, online status, PM......
Never mind, after logging in I can upload file, regardless better layout with html tag would be nice.
i connect the serial port and set the baud rate 115200 , and set the switches states , when i turn the board on , nothing is appear on the terminal :(
Grr, deleted the NK.bin already from my release dir, if you can wait Ill build another one later today.
http://www44.zippyshare.com/v/2364265/file.html You should be able to use it from SD
dear deszo , thanks a lot for your attenton and sorry for delay in answering , i am in accident ... my problem is that my board did not send menu to serial port the cable that i use it is not cross , is this the problem? please don't remove the file from the uploaded location you help me and i thank you
the orginal cable did not work , i want to make a cable , is the type of cable cross ? cross Com2Com?
dear deszo why nothing is appear in terminal i check the rx/tx and baud rate and my problem did not solve :(:(
i rename the com to "COM1" but nothing is appear on terminal,dnw is connected to COM1 and it's baud rate is 115200 , when i turn on the board in normal mode the start up menu is appear
finally i change the u-boot file and i see this error ** Warning - bad CRC or moviNAND, using default environment ##### EmbedSky BIOS for SKY6410/TQ6410 ##### Press Space key to Download Mode ! Start Linux ... NAND read: device 0 offset 0x200000, size 0x300000 3145728 bytes read: ERROR ## Booting image at c0008000 ... Boot with Image Starting kernel ... can anyone help me?
Please am newly introduced to tiny6410. am using it for my project. i want to know how i can use the i2c bus. I have a panel wich has 8 switches.. i want to uniquely identify each switch upon pressed.
Can somebody explain to me how to use LEDdriver.dll via C# and .Net Compact Framework 2.0? As I understand LEDdriver is a part of coredll, so I tried to call a LED_Init function like this: [DllImport("coredll.dll", SetLastError = true)] public static extern UInt32 LED_Init(UInt32 dwContext); ... LED_Init(0); ... And i've got an error: Can't find an Entry Point 'LED_Init' in a PInvoke DLL 'coredll.dll'. What should I do to make it work?
I have written a GPIO driver, It reads and writes GPE, GPM ve GPQ pins successfully. If any of you are interested in you can connect me via email wingsoflead01@hotmail.co.uk
I need the Image that include LED Driver but the two links provided by "dezso" are broken. Do you have a live link for downloading this Image file (NK.bin)? I really need that. Thanks.