sarnau / LoxLink

Loxone extension and tree device sample implementation for a STM32
http://www.sarnau.info
48 stars 24 forks source link

GPIO´s anders zuordnen #23

Open fl4240 opened 3 years ago

fl4240 commented 3 years ago

Hallo, ist es möglich die GPIO´s anders zuzuordnen? Ich habe eine fertige SPS Platine ( FX3U-56MR) mit dem STM32F103VCT6 diesen habe ich bereits soweit das ich den Code aufspielen kann. Leider stimmen die GPIO´s der Relais und der Eingänge nicht mit denen des Codes überein. Somit wäre es interessant ob bzw. wo und wie ich die GPIO´s anders zuordnen kann. Der CAN müsste zum Beispiel auf PD0 und PD1 das Run LED auf PD10. Ich habe schon einiges versucht leide blinkt weder das LED noch kann ich die Platine an den Miniserver verbinden. Danke im Voraus Franz.

KjellVerb commented 3 years ago
gDIPins[DI_EXTENSION_INPUTS] = {
  {GPIO_PIN_0, GPIOE},
  {GPIO_PIN_1, GPIOE},
...

I hope this all works for you :-)

fl4240 commented 3 years ago

Hello KjellVerb, thank you for your answer, do i have to replace the : __HAL_AFIO_REMAP_CAN1_2(); with __HAL_AFIO_REMAP_CAN1_3(); ? And in which file do i have to insert the code for remaping the CAN ? Thanks best regards Franz

KjellVerb commented 3 years ago

Hi, you indeed have to change CAN1_2 with CAN1_3 (or at least I think so, I use a different chip so can't test this for you).

All of the CAN hardware related code is in LoxLink/Project/application_code/Loxone/CAN Driver/LoxCANDriver_STM32.cpp

fl4240 commented 3 years ago

Hi, i´ll test this today and let you know tomorrow. Thank you.

KjellVerb commented 3 years ago

Hi, any progress on this?

fl4240 commented 3 years ago

Hello, yes there is. I tested yesterday. But i have to measure the gpios again from the board. Some are wrong. And when I assign the DI extension in Loxconfig, the code no longer runs. I think that some gpios will be used 2x. I still have to go through the code. Thanks Franz

fl4240 commented 3 years ago

Hello, last week i was ill so i testet the code yesterday. The code doesn´t stop when i assign the DI Extension in the Loxconfig, only the Run Led stops. I can switch only 9 relais. Here is the code from the LoxLegacyRelayExtension.cpp

`#include "LoxLegacyRelayExtension.hpp"

include "stm32f1xx_hal_gpio.h"

include "stm32f1xx_hal_rcc.h"

include "system.hpp"

include

static const struct { uint16_t pin; GPIO_TypeDef *gpio; } gRelayPins[RELAY_EXTENSION_OUTPUTS] = { {GPIO_PIN_3, GPIOE}, {GPIO_PIN_1, GPIOE}, {GPIO_PIN_0, GPIOE}, {GPIO_PIN_2, GPIOA}, {GPIO_PIN_6, GPIOA}, {GPIO_PIN_7, GPIOA}, {GPIO_PIN_15, GPIOB}, {GPIO_PIN_12, GPIOD}, {GPIO_PIN_8, GPIOC}, {GPIO_PIN_9, GPIOC}, {GPIO_PIN_8, GPIOA}, {GPIO_PIN_3, GPIOB}, {GPIO_PIN_8, GPIOB}, {GPIO_PIN_9, GPIOB}, };

/***

/***

/***

The DI extension i haven´t testet yet.

Thanks Franz

KjellVerb commented 3 years ago

Hi,

PB3 has a dedicated function JTDO so you'll need to do some googling in order to find out how to release it for GPIO use. Here's a starting point: STM32F103 - PB3 just doesn't work as GPIO

For PA* I don't have an idea, these should work according to the datasheet. Go through the code and make sure that none of these pins are defined anywhere else. It's probably best to not instantiate other extensions yet to avoid double use of GPIOs.

fl4240 commented 3 years ago

Hi,

i´ve tested now a few boards. The PA GPIOs are not working at all. I searched the code but found no duplicate usage. Do you have any ideas what could cause problems here? I also tested a board where the CAN is mapped with the original code and only one GPIO PD2 was changed to PA2. But that didn't work either.