Page 3 of 35

Re: I2C implementation for STM32

Posted: Mon Feb 07, 2011 8:23 am
by barthess
Those bits cannot be cleared, may be you could mask the interrupt source instead?

I am already use interrupt source masking, but it could not completely solve the problem.

A dedicated thread does not look like a good idea considering that the whole point of having an asynchronous driver is to not have to use a dedicated thread for I/O.

Hmm... I have took this idea here http://chibios.org/dokuwiki/doku.php?id ... tos:wakeup
Whats better to do in callback function generally?

Re: I2C implementation for STM32

Posted: Mon Feb 07, 2011 9:28 am
by Giovanni
I was assuming you suggested to put a thread inside the driver as integral part of it, waking up an application thread from a callback is fine but this must be application code.

From callbacks you usually call other I-class functions which may wakeup a thread or invoke another HAL function.

I can't give you more specific suggestions until I'll have the time to study your implementation. Right now I am still working on the USB.

Giovanni

Re: I2C implementation for STM32

Posted: Mon Feb 07, 2011 10:52 am
by barthess
Yes, this is application code. Inside that tread I have realized protocol to exchange data with accelerometer.
I can't give you more specific suggestions until I'll have the time to study your implementation

There is no need for now. Driver still in draft stage.

In ADC driver I have founded following code:

Code: Select all

#if ADC_USE_WAIT || defined(__DOXYGEN__)
  /**
   * @brief Waiting thread.
   */
  Thread                    *ad_thread;

Is there a pointer to application tread? When this tread must be waking up?

Re: I2C implementation for STM32

Posted: Mon Feb 07, 2011 1:49 pm
by Giovanni
The ADC driver has both an asynchronous and an optional synchronous API, that field is used in synchronous mode, it is the thread that started the conversion and is waiting for completion.

Giovanni

Re: I2C implementation for STM32

Posted: Wed Feb 23, 2011 9:55 pm
by redfox74
Dear Friends,
some news about i2c support ?
I try to use the code of Angelo , with the code write by Marko on his quadricopter but it's incompatible ...
What is the right reference for future development ?
Now I try to understand hwo to update the Marko quad code on your version of code 2.1.7 revision.
Giovanni what kind of version do you port on new revision of OS ? I have an a doubt about the i2c support is supported on MD and HD version of ST32 or only on MD now ? What is the file to update for support the HD ,too ?
Best
Roberto

Re: I2C implementation for STM32

Posted: Thu Feb 24, 2011 2:26 am
by redfox74
@Angelo,
Hi Angelo, i try your code , but there 're some things that is not clear ... i see that you use i2c2 on pb6 and pb7 ... but is not i2c2 but i2c1 ?
So I'm using STM32F103VE but i think that is the same on the other type of micro or not ? I compile your example code , but don't work .
Another strange things is that your revision of os 2.1.7 i don't see the data on UART4. I configure it and compile fine the code .. I'm using the same board with right configuration . MULTIPILOT32 board so the configuration is right .. I don't undertand what is the problem :(
Regards
Roberto

Re: I2C implementation for STM32

Posted: Thu Feb 24, 2011 8:43 am
by barthess
Hi, Roberto.
You can try to use I2C driver from my branch
https://chibios.svn.sourceforge.net/svn ... es/i2c_dev
and send suggestions and bugs directly to me in this forum.
Low level part mostly done, but hi level part needs discussion.

I temporally stop driver development because I must to finalize all
I2C PCBs of my project. On this weekend I plan to resume development.

Re: I2C implementation for STM32

Posted: Thu Feb 24, 2011 6:01 pm
by albi
Roberto you can also try my i2c driver,
you can download it from http://forum.chibios.org/phpbb/viewtopic.php?f=3&t=25&start=10#p222 post
It came with some example of usage in the projects subdir
It's only master and work only by interrupt, but work very well by two month, end also is well tested
and i can help you

good luck

Alberto

Re: I2C implementation for STM32

Posted: Fri Feb 25, 2011 12:29 pm
by redfox74
Hi Barthess,
thank you very much for your support. What's the starting point revision of code for this branch ? Now I'm implementing the code on MP32 on revision 2.2.0 .
There're some example inside the branch ? In what kind of application are you using the i2c ?
Regards
Roberto
barthess wrote:Hi, Roberto.
You can try to use I2C driver from my branch
https://chibios.svn.sourceforge.net/svn ... es/i2c_dev
and send suggestions and bugs directly to me in this forum.
Low level part mostly done, but hi level part needs discussion.

I temporally stop driver development because I must to finalize all
I2C PCBs of my project. On this weekend I plan to resume development.

Re: I2C implementation for STM32

Posted: Fri Feb 25, 2011 2:35 pm
by redfox74
redfox74 wrote:Hi Barthess,
thank you very much for your support. What's the starting point revision of code for this branch ? Now I'm implementing the code on MP32 on revision 2.2.0 .
There're some example inside the branch ? In what kind of application are you using the i2c ?
Regards
Roberto
barthess wrote:Hi, Roberto.
You can try to use I2C driver from my branch
https://chibios.svn.sourceforge.net/svn ... es/i2c_dev
and send suggestions and bugs directly to me in this forum.
Low level part mostly done, but hi level part needs discussion.

I temporally stop driver development because I must to finalize all
I2C PCBs of my project. On this weekend I plan to resume development.

Hi Barthess,
i try to compile the code but i have this problem when i try to compile :
../../os/hal/src/i2c.o: In function `i2cInit':
C:\Documents and Settings\Roberto\Desktop\lavoro\Multipilot32 Workspace\VROS-ChibiOS\ChibiOS_2.3.0-I2CDEV\Project\MP32-TESTPROGRAM/../../os/hal/src/i2c.c:57: undefined reference to `i2c_lld_init'
collect2: ld returned 1 exit status
make: *** [ch.elf] Error 1

I think that the branch code is broken .... or i'm using wrong example ... What's the correct example ? I don't found any doc inside the branch that explain how i can start to test i2c ... a simple demo ... :)
Regards
Roberto