Hello ! I am currently writing a kernel module, for continuous frequency generation over GPIO pin. I wrote the code for kernel module. the device is created in /dev directory. frequency can be changed by writing device file.Like this, echo '$3#100!' > /dev/gpiofreq where, $ is for staring of command 3 is for set frequency command # is for separator 100 is frequency in KHz ! is end of data. freq can be variable between 1kHz to 100kHz. My problem is after writing to device, the GPIO toggles continuously, so i can not get terminal. even i add kernel thread, so when writing to device, it start the kernel thread function which generates continuously. after that i got terminal prompt, but i can not execute any command. it terminal prompt just hangs. Thanks for reading this. Sorry for my English.
Multithreading in kernel module
I forgot to mention that i used udelay for frequency generation. is there any difference between udelay and usleep or nanosleep? also i dont know, where is usleep or nanosleep in friendlyarm kernel source. compilation gives me error "implicit declaration of 'usleep' function."
Seems your driver occupies the CPU to 100 %. Using busy loops to generate a continuous waveform is a bad idea.
Hi, Juergen Beisert i used separate function for generating freq. when device_write is called. If you have any other idea please tell me. Thanks.
Use one of the PWM outputs to generate your signal. Generating 100 kHz in plain software is 100 % CPU load.
Yes, This is good idea. using pwm pin for freq generation. but what i am trying to do is, generating raster mode operation for laser scanner motors. how can i send lets say 10000 pulses and then stop. how can i count the pwm pulses.
You can't. At least not with the hardware the S3C2440 CPU supports and not in software when you run a full blown operating system like Linux is. Use a simple external microcontroller or CPLD or something similar for this special function.