SPI Remaping and I2C
SPI Remaping and I2C
HI
I recently make a remote control that includes a ILI9341 and a ds1307, I try to liberate 3 ADCs by remapping the ILIILI9341 to the SPI1 alternate pins, the ADCs pins are now available and working and the ILI9341 works BUT when I try to use the ds1307 the ILI9341 stop working... my guess is that remapping the SPI1 kills the wire library used by the ds1307. So there is any chance to solve that?
this is the code I use for remapping on setup:
//afio_remap(AFIO_REMAP_SPI1);
//afio_cfg_debug_ports (AFIO_DEBUG_SW_ONLY);
//gpio_set_mode (GPIOB, 3, GPIO_AF_OUTPUT_PP);
//gpio_set_mode (GPIOB, 4, GPIO_INPUT_FLOATING);
//gpio_set_mode (GPIOB, 5, GPIO_AF_OUTPUT_PP);
it is exactly when I start the RTC that the system crash...
if (! rtc.begin()) {
//Printer(0,0,"No RTC!",0);
//abort();
}
I recently make a remote control that includes a ILI9341 and a ds1307, I try to liberate 3 ADCs by remapping the ILIILI9341 to the SPI1 alternate pins, the ADCs pins are now available and working and the ILI9341 works BUT when I try to use the ds1307 the ILI9341 stop working... my guess is that remapping the SPI1 kills the wire library used by the ds1307. So there is any chance to solve that?
this is the code I use for remapping on setup:
//afio_remap(AFIO_REMAP_SPI1);
//afio_cfg_debug_ports (AFIO_DEBUG_SW_ONLY);
//gpio_set_mode (GPIOB, 3, GPIO_AF_OUTPUT_PP);
//gpio_set_mode (GPIOB, 4, GPIO_INPUT_FLOATING);
//gpio_set_mode (GPIOB, 5, GPIO_AF_OUTPUT_PP);
it is exactly when I start the RTC that the system crash...
if (! rtc.begin()) {
//Printer(0,0,"No RTC!",0);
//abort();
}
Re: SPI Remaping and I2C
I guess you met this issue described in the errata sheet:
So, if you really need both then when you used SPI you have to disable the I2C peripheral clock.
So, if you really need both then when you used SPI you have to disable the I2C peripheral clock.
Re: SPI Remaping and I2C
thanks
disabling the I2C peripheral clock will NOT affect I2C functionality itself?
disabling the I2C peripheral clock will NOT affect I2C functionality itself?
Re: SPI Remaping and I2C
Of course! So you have to re-enable it each time you want to use the I2C. This is a workaround.sigi wrote: Mon Sep 28, 2020 7:36 pm thanks
disabling the I2C peripheral clock will NOT affect I2C functionality itself?
Re: SPI Remaping and I2C
but how I can enable the I2C?
when I enable the I2C the SPI need to be disabled at the same time ?
that is not so difficult because the system only need to ask the current time/date once...
when I enable the I2C the SPI need to be disabled at the same time ?
that is not so difficult because the system only need to ask the current time/date once...
Re: SPI Remaping and I2C
No SPI do not need to be disabled. Only the I2C clock need to be disabled when youbused the SPI.
Why not use the RTC of the MCU instead of using an external one?
About disabling the I2C clock I don't know on Libmaple core.
Why not use the RTC of the MCU instead of using an external one?
About disabling the I2C clock I don't know on Libmaple core.
Re: SPI Remaping and I2C
I use the internal RTC BUT I do not know how to use the VBat pin properly, it just do not work, I try with diodes etc and nothing work.
It is sad the Robotdyn black pills units are monsters compared with normal Arduinos, but u can not use all of its potential , I mean see this SPI problem I just want to use all the ADCs, a SPI screen, a NFR... It is for a RC unit to control my telescope and anything in the future more properly...

Thanks for the info.
It is sad the Robotdyn black pills units are monsters compared with normal Arduinos, but u can not use all of its potential , I mean see this SPI problem I just want to use all the ADCs, a SPI screen, a NFR... It is for a RC unit to control my telescope and anything in the future more properly...


Thanks for the info.
-
- Posts: 633
- Joined: Thu Dec 19, 2019 1:23 am
Re: SPI Remaping and I2C
sigi wrote: Tue Sep 29, 2020 5:47 am I use the internal RTC BUT I do not know how to use the VBat pin properly, it just do not work, I try with diodes etc and nothing work.
...
I know of no SPI "problem" or any serious issues. Are you referring to the "board" or to the uC?sigi wrote: Tue Sep 29, 2020 5:47 am ... but u can not use all of its potential , I mean see this SPI problem I just want to use all the ADCs, a SPI screen, a NFR... It is for a RC unit to control my telescope and anything in the future more properly...
Re: SPI Remaping and I2C
well as far as I know u can not use SPI, all the ADCs and I2C at the same time, so the board is limited using Arduino IDE, I supose that using CubeMX it can be solved.
RTC just loose the time when I cut normal 5V input even when is there is a 2032 battery connected to the VBat pin.
RTC just loose the time when I cut normal 5V input even when is there is a 2032 battery connected to the VBat pin.
Re: SPI Remaping and I2C
CubeMx will not solved the use of SPI remap and I2C as it is a hardware bug. See the errata data sheet of the MCU....