[SOLVED] i2c slave receiver: nucleo 64 F401

STM32F103 Nucleo boards e.g. STM Nucleo F103RB
flussoincrociato
Posts: 11
Joined: Thu Feb 08, 2018 7:13 pm

[SOLVED] i2c slave receiver: nucleo 64 F401

Post by flussoincrociato » Thu Feb 08, 2018 9:05 pm

Hi,
i'm trying to do board to board communication with two nucleo 64 F401 and the two examples installed in Ide with board manager, i2c slave receiver example doesn't work, serial monitor shows unreadable characters.
if you comment char stuffs and send only an integer, receiver reads always zero.
where is the problem?
Thanks
Last edited by flussoincrociato on Tue Feb 13, 2018 3:46 pm, edited 1 time in total.

fpiSTM
Posts: 315
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: i2c slave receiver: nucleo 64 F401

Post by fpiSTM » Fri Feb 09, 2018 6:02 am

I guess you use the Arduino_Core_STM32?
Issue is known and a fix exists:
https://github.com/stm32duino/Arduino_C ... issues/212

flussoincrociato
Posts: 11
Joined: Thu Feb 08, 2018 7:13 pm

Re: i2c slave receiver: nucleo 64 F401

Post by flussoincrociato » Fri Feb 09, 2018 12:20 pm

Hi fpiSTM, thank you for the reply,
i'm not sure it's the same problem, that thread talks about freeze, my code does not freeze, it just returns bad data,
anyway i did not understand how to fix it:
-I added sugested lines in wire.cpp, and changed allocateRxBuffer to static
-changed handle.XferCount to handle.XferSize in twi.c
before modifying code receiver showed bad data, after these code changes serial com shows anything.
were am i wrong?
Please can you tell me were can i download a fixed code version of arduino core stm32? Did someone upload it?
If i now reinstall the package through board manager it should work?
many thanks.

fpiSTM
Posts: 315
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: i2c slave receiver: nucleo 64 F401

Post by fpiSTM » Fri Feb 09, 2018 2:18 pm

Even if the issue mentioned under github is a freeze, the main issue is the use of a buffer not allocated. So, this could be a random issue (freeze or not)...
Even if I think it should freeze as the buffer should be initialized with null.

Anyway, If you applied properly the fix this should work, it seems you met another issue.
We have raised an issue on github following this fix as we found that IT mode (Rx/Tx callback) is not well managed. Maybe you met this case.

Just one question about your hardware setup. I2C lines (SDA/SCL) must have a pull up resistor on each line else this will not work.

flussoincrociato
Posts: 11
Joined: Thu Feb 08, 2018 7:13 pm

Re: i2c slave receiver: nucleo 64 F401

Post by flussoincrociato » Fri Feb 09, 2018 4:00 pm

Yes for sure, there are external 1k pull-up resistors tied to 3.3V and it works good if i use Arduino UNO as a receiver.

To make sure doing all right I removed Arduino IDE and all the related folders, including Arduino15.
Then reinstalled Arduino IDE 1.8.4 and the last arduino core version 2018.1.18 in board manager.
Now compiling sketches for nucleo 64 returns exit code 1:

Code: Select all

Arduino:1.8.4 (Windows 7), Scheda:"Nucleo-64, Nucleo F401RE, STLink, Generic Serial, None, Smallest (-Os default)"
...
...
Using board 'Nucleo_64' from platform in folder: C:\Users\stefano corona\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2018.1.18
Using core 'arduino' from platform in folder: C:\Users\stefano corona\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2018.1.18
cmd /c "if not exist C:\Users\stefano corona\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2018.1.18\libraries\Wire\examples\master_writer/build_opt.h mkdir C:\Windows\TEMP\arduino_build_12413\sketch & type NUL > C:\Windows\TEMP\arduino_build_12413/sketch/build_opt.h"
Impossibile trovare il percorso specificato.

Impossibile trovare il percorso specificato.

exit status 1
Errore durante la compilazione per la scheda Nucleo-64.
Sorry for the italian, it says it can't find a path, i'm not sure which one but it seems it is looking for build_opt.h in example folder.
I put manually build_opt.h in that folder but it can't find it.
I tried even running IDE with admin rights, nothing change.
Then i tried exploring TEMP folder, arduino_build_12413 were correctly created, but not sketch folder.
Manually creating sketch folder finally it compiles, but it returns this error: arm-none-eabi-g++: warning: NUL: linker input file unused because linking not done

I think the problem is the slash in cmd, maybe changing it to backslash could solve the problem?

User avatar
mrburnette
Posts: 2201
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: i2c slave receiver: nucleo 64 F401

Post by mrburnette » Fri Feb 09, 2018 4:08 pm

Windows OS will accept a "/" or "\" in the Arduino code (sketch.)
Linux will only accept the "/"

On this forum, everyone is encouraged to use the "/" forward slash because some Linux users get annoyed when they have to use search and replace... don't ask me how I know this :lol:


Ray

flussoincrociato
Posts: 11
Joined: Thu Feb 08, 2018 7:13 pm

Re: i2c slave receiver: nucleo 64 F401

Post by flussoincrociato » Fri Feb 09, 2018 4:28 pm

Hi mrbrunette,
thanks for the explanation, then maybe my assumption is wrong.
Do you have any suggestion to solve the problem?
It does not compile without manually adding those files and folder, and when it compiles returns errors.

fpiSTM
Posts: 315
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: i2c slave receiver: nucleo 64 F401

Post by fpiSTM » Fri Feb 09, 2018 5:12 pm

This error is due to space in the path. I solved this issue and the fix will be in the next release.
https://github.com/stm32duino/Arduino_C ... 2/pull/204

flussoincrociato
Posts: 11
Joined: Thu Feb 08, 2018 7:13 pm

Re: i2c slave receiver: nucleo 64 F401

Post by flussoincrociato » Fri Feb 09, 2018 7:42 pm

thank you i used your instructions in related thread, and it seems to work, but i'm not sure if i did it well, in the environment variable i typed %PATH% in name field and system32 path in value field, is that right?

fpiSTM
Posts: 315
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: i2c slave receiver: nucleo 64 F401

Post by fpiSTM » Fri Feb 09, 2018 7:53 pm

Yes, you could add the system32 path in %PATH% env variable if cmd is not known when called by Arduino IDE.
But the main correction is also to double quote path in the platform.txt

Post Reply