How to over write the Targets

HI
Here i want change the Default Targets PeripheralPins.c in my stm 32 F767ZI board,

in my Program iam using Uart4 PC_10 and PC_11 ,but here Default PeripheralPins.c file command these PC_10 TX pins for uart4,
its used for Uart3

here i was uncommented after save but its taking only Default one only .

and one more i want use theses PB_9 and PB_8 for uart 5.

how i will change pls help me.

Hello,

In general PinMaps are declared as WEAK so can be overridden in the main

MBED_WEAK const PinMap PinMap_UART_TX…

But…

I do not know which version of MbedOS you are using but PC_10/11 on UART4 seems to be the default configuration and only combination of PC_10/11 on UART3 are disabled because UART3 is used on pins PD_8/9 for STDIO console (printf call)

This is also default configuration.

So?

BR, Jan

iam using mbedOS 5.

can you pls help me ,how to do the over Writing,

I probably do not udnerstand your requirments. I understand it like you want use PC_10/11 for UART4 but this is default configuration.

Also in MbedOS 5.15 is the default pin settings same like the latest one. So the PC_10/11 UART4

BR, Jan

i was delete my old mbed os file and mbedos.lib after copy your link GitHub - ARMmbed/mbed-os: Arm Mbed OS is a platform operating system designed for the internet of things .
again open Keil arm go to file add mbed library to active project past your link.

click next select after select master Default and finish.

after save and build the project its showing the below error , here what i will do please explain step by step.

Why did you do that? Keil Studio has tool for change the MbedOS version and you said MbedOS 5 (probably because of some old libraries in project) so you can not use the master branch that is MbedOS 6.17

I do not use KeilStudio so often but i will try.

  • check the panel Mbed Libraries and remove Mbed library from here
  • delete all mbed.lib and folders from project
  • refresh the page
  • right click on the project and choose “Add Mbed Library…” (same like + button on panel Mbed Libraries ) and place link - https://github.com/ARMmbed/mbed-os
  • in combobox chose MbedOS 5.15.9

BR, Jan

Any progress?
Here you can find example how to overwrite the pinmap in the main.cpp if you still need it.

BR, Jan

yes johnny still iam struggle.

Hello,

with which part? PinMap or project issue?

Example

#include "mbed.h"

const PinMap PinMap_UART_TX[] = {
    {PB_9,       UART_5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART5)},
    {PC_10,      UART_4,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
    {NC, NC, 0}
};

const PinMap PinMap_UART_RX[] = {
    {PB_8,       UART_5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART5)},
    {PC_11,      UART_4,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
    {NC, NC, 0}
};

// rest of your code....

BR, Jan

this is my code

#include"mbed.h"
#include"string.h"
#include"SPI.h"
#define MAX_INPUT_LENGTH 365


//Serial uart_7(PB_9, PB_8);                            // TX,RX Bluetooth Serial interface for machine-Mobile
Serial pc(USBTX, USBRX); 
Serial uart_6(PG_14, PG_9);
//Serial bt(PG_14, PG_9);
Serial bt(PE_8, PE_7); 
Serial uart_4(PC_10, PC_11);
Serial uart_5(PB_9, PB_8);                   // tx, rx (serial Communication Tera Term)
SPI Master_To_Slave(PB_5,PA_6,PA_5); // mosi, miso, sclk
DigitalOut Slave1_Selection(PA_4);               //master NUCLEO-F746ZG slave selection pin
DigitalOut Master_Led(PG_3);
char Send_String[20] = "KALAIVANAN#";
char Received_String[20]="\0";

const PinMap PinMap_UART_TX[] = {
    {PB_9,       UART_5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART5)},
    {PC_10,      UART_4,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
    {NC, NC, 0}
};

const PinMap PinMap_UART_RX[] = {
    {PB_8,       UART_5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART5)},
    {PC_11,      UART_4,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
    {NC, NC, 0}
};


int main() {
  pc.baud(115200);
    //uart_7.baud(9600);
//  uart_6.baud(115200);
  bt.baud(9600);
 uart_4.baud(115200);
 uart_5.baud(115200);
  
  int i = 0;
  int j = 0;
  int ch;
  char send_data[50] = {'\0'};
  char k = 0;
  Slave1_Selection = 1;               // De_Select the 1st Slave
  Master_To_Slave.format(8, 3);       // Setup: 8bit mode 3
  Master_To_Slave.frequency(1000000); // Starting Frequency 1 MHZ

  while (1) {
    pc.printf("\n Select The case :\n");
    pc.scanf("%d", &ch);
    switch (ch) {
   /* case 1: {
      pc.printf("nucleo to nucleo SPI Communication\n");
      while (Send_String[i] != '#') // Send the String Upto Null
      {
        Slave1_Selection = 0; // Select the 1st Slave (Activate)
        pc.printf(" \n Send_String = %c ", Send_String[i]);
        Master_To_Slave.write(Send_String[i]);
        Master_Led = !Master_Led; // LEd Blinking While Data Transfer
        Slave1_Selection = 1;     // De_Select the 1st Slave
        wait_ms(200); // Wait for readability only(Ready to wait for Next Data)
        i++;
      }
    } break;

    case 2: {
      pc.printf("nucleo to nucleo SPI Communication\n");
      while (Send_String[i] != '#') // Send the String Upto Null
      {
        Slave1_Selection = 0; // Select the 1st Slave (Activate)
        pc.printf(" \n Send_String = %c ", Send_String[i]);
        Master_To_Slave.write(Send_String[i]);
        Master_Led = !Master_Led; // LEd Blinking While Data Transfer
        Slave1_Selection = 1;     // De_Select the 1st Slave
        wait_ms(200); // Wait for readability only(Ready to wait for Next Data)
        i++;
      }
      if (Send_String[i] == '#') {
        if (Master_To_Slave.receive())
          ; // start Reading from Master
        {
          Slave1_Selection = 0;
          Received_String[j] = Master_To_Slave.read();
          pc.printf("\n Slave1 Received String %c",
                    Received_String[j]); // print the Receiving Char
          Master_Led = !Master_Led;      // LEd Blinking While Data Transfer
          Slave1_Selection = 1;
          wait_ms(200); // waiting
          j++;
        }
      }
    } break;
    */

    case 3: {
      char buff[MAX_INPUT_LENGTH];
      int code[MAX_INPUT_LENGTH];
      int n = 0;
      char keyIn;
      memset(buff, 0, sizeof(buff));
      while (true) {
        pc.printf("\n waiting for bluetooth data");
        bt.printf("Waiting for String #");
        while (n <= MAX_INPUT_LENGTH - 1) {
          if (bt.readable()) {
            keyIn = bt.getc();
            if (keyIn == '\n' || keyIn == '\r') {
              break;
            }
            buff[n] = keyIn;
            code[n] = keyIn - '0';
            n++;
          } else {
            wait_us(100);
          }
        }
        pc.printf("\nReceived: %s\n", buff);
        pc.printf("\n Processed data: ");
        for (int y = 0; y < n; y++) {
          pc.printf("%d", code[y]);
          bt.printf("%d", code[y]);
        }
        wait_ms(100);
        bt.printf("#");
      }
    } break;

   case 4: {
      while (true) {
        memset(send_data, 0, sizeof(send_data));
        printf("\n\rEnter a message to send to Slave: ");
        scanf("%s", send_data);
        uart_4.putc('R');
        while (uart_4.getc() != 'A');
        printf("\n\rSlave ready. Sending message...\n");

        for (int i = 0; send_data[i] != '\0'; i++) {
          uart_4.putc(send_data[i]);
          while (uart_4.getc() != 'A');
        }
      }
    } break;

    case 5: {
      while (true) {
        memset(send_data, 0, sizeof(send_data));
        printf("\n\rEnter a message to send to Slave: ");
        scanf("%s", send_data);
        uart_5.putc('R');
        while (uart_5.getc() != 'A');
        printf("\n\rSlave ready. Sending message...\n");

        for (int i = 0; send_data[i] != '\0'; i++) {
          uart_5.putc(send_data[i]);
          while (uart_5.getc() != 'A');
        }
      }
      break;

    case 6: {
       
      while (true) {
        printf("\n\rUART 6 DEMONSTRATION....");
         char received_data[50] = {0};
        memset(send_data, 0, sizeof(send_data));
        printf("\n\rEnter a message to send to Slave: ");
        scanf("%s", send_data);
        int i = 0;
        for(i = 0; send_data[i] != '\0'; i++)
        {
     //   uart_6.putc(send_data[i]);
       // received_data[i] = uart_6.getc();
        
        }
        printf("\n\rReceived message from Master %s",received_data);
      }
    }
      break;

      case 7: {
      while (true) {
          printf("\n\rUART 7 DEMONSTRATION....");
         char received_data[50] = {0};
        memset(send_data, 0, sizeof(send_data));
        printf("\n\rEnter a message to send to Slave: ");
        scanf("%s", send_data);
        int i = 0;
        for(i = 0; send_data[i] != '\0'; i++)
        {
        //uart_7.putc(send_data[i]);
        //received_data[i] = uart_7.getc();
        
        }
        printf("\n\rReceived message from Master %s",received_data);
      }
    }break;
    }
  }
}

}  


these are shoeing error…

Build started
Using toolchain ARM_STD profile {'ENV': {'ARMLMD_LICENSE_FILE': '8224@10.100.182.21:8224@10.100.106.178'}, 'PATHS': {'ARMC6_PATH': '/opt/ARMCompiler6.15.13/bin/', 'ARM_PATH': '/opt/armcc5_06_u6/'}, 'common': ['-c', '--gnu', '-O3', '-Otime', '--split_sections', '--apcs=interwork'], 'cxx': ['--cpp', '--no_rtti'], 'COMPILE_C_AS_CPP': False, 'NEW_SCAN_RESOURCES': True}
scan /tmp/chroots/ch-739e1ce9-9f68-44eb-88a4-c53dd11fbf04/src
scan /tmp/chroots/ch-739e1ce9-9f68-44eb-88a4-c53dd11fbf04/extras/mbed-os.lib
Configuration error: 'static_memory_defines' is not defined.
#20: identifier "PinMap" is undefined
#20: identifier "PinMap" is undefined
#111-D: statement is unreachable
#111-D: statement is unreachable
#111-D: statement is unreachable
#111-D: statement is unreachable
#111-D: statement is unreachable
#177-D: variable "i"  was declared but never referenced
#177-D: variable "j"  was declared but never referenced
#177-D: variable "k"  was declared but never referenced
"/src/main.cpp", line 20: Error:  #20: identifier "PinMap" is undefined
  const PinMap PinMap_UART_TX[] = {
        ^
"/src/main.cpp", line 26: Error:  #20: identifier "PinMap" is undefined
  const PinMap PinMap_UART_RX[] = {
        ^
"/src/main.cpp", line 128: Warning:  #111-D: statement is unreachable
      } break;
        ^
"/src/main.cpp", line 144: Warning:  #111-D: statement is unreachable
      } break;
        ^
"/src/main.cpp", line 160: Warning:  #111-D: statement is unreachable
        break;
        ^
"/src/main.cpp", line 180: Warning:  #111-D: statement is unreachable
        break;
        ^
"/src/main.cpp", line 198: Warning:  #111-D: statement is unreachable
      }break;
       ^
"/src/main.cpp", line 41: Warning:  #177-D: variable "i"  was declared but never referenced
    int i = 0;
        ^
"/src/main.cpp", line 42: Warning:  #177-D: variable "j"  was declared but never referenced
    int j = 0;
        ^
"/src/main.cpp", line 45: Warning:  #177-D: variable "k"  was declared but never referenced
    char k = 0;
         ^
/src/main.cpp: 8 warnings, 2 errors
Internal error.
Build failed
Build failed
compile main.cpp

I do not know, your code was on my side compiled successfully - Keil Studio Cloud, MbedOS 5.15.7.

image

I just recommend to place the pinmaps before Serial objects declaration and you also have to fill the rest UARTs because you have two more in your code.

BR, Jan