I can only see it on the scope. For an unknown reason my Putty shows rubbish, even at the right settings and speed. I think there is not enough space between the bytes:
I created those new files in my project:
/HMC20/PeripheralPinMaps.h:
/HMC20/PinNames.h
/HMC20/PeripheralPins.c
custom_targets.json → where I did at most as possible removes to isolate the problem
this error occurs when you use pins from different peripherals.
For example when you use SDA pin from I2C1 and CLK pin from I2C2, this will trigger this exception.
How can I see that? If you use for instance serial port there is no option to select the number of the port. The pins can be assigned to different ports.
Yes, but that is your responsibility because there is no option how to do it automatically. So you have to look to MCU pinout or to your PeripheralPinMaps.h (if is filled correctly), there is the information (first and second column) from where also Mbed takes the data for comparation at runtime.
So it means that in that file you have to put every line in comment that you not need in your application? So that every assignment in pinmaps is unique?
I don’t think so. One pin can be assigned for more different peripherals and again it is up to you how you will manage it.
It is simple. When you chose to use BufferedSerial API then you are responsible also to chose correct pins. When is this peripheral initialized then the API look to this table and search what peripheral it is (because some MCUs have up to se 7 UARTs) and which a function this pin has.
Thanks to this the API knows what HALs should be called. That is necasary because HALs are ussually set just for specific peripheral. For example like HAL_RCC_USART1_CLK_ENABLE() and HAL_RCC_USART2_CLK_ENABLE() and so on.
Another benefit is there can be this exception what will prevent your from using wrong pins.
I double checked all the pin definitions. I enabled only the pinmap definitions I use in my project. I disabled almost all peripherals and cutted in my code to make it compilable again and I still get the same message on the scope. It’s like there is a ‘hidden’ peripheral that is not able to find his pinmap.
In my custom_targets.json I disabled the maximum amount of peripherals:
The exception is triggered directly in constructor or initialization of any API (where are some pins). So which APIs/libraries do you use in your project?
To splitup complexities I first setup a test project to test all peripherals. I think the issue was that in my orginal project there was some piece of code:
//Create a BufferedSerial object to be used by the system I/O retarget code.
FileHandle* mbed::mbed_override_console(int fd) {
static BufferedSerial serial_port(USBTX, USBRX, DEBUG_SERIAL_SPEED);
return &serial_port;
}
Which is conflicting with the new pinmap config.
But I will confirm after I have a reference project with working uart and external clock. Then I can use that config and enable all functionality in my original project one by one.