-
Notifications
You must be signed in to change notification settings - Fork 13
LORA_E5: correct pin table #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8fca1ea to
610333e
Compare
610333e to
a882d84
Compare
|
I added changes for RAK3172. This is a smaller MCU, with less pins. |
|
Quick view looks better now, thanks. |
|
Looks good to me |
|
BTW could you please add a mbed-os-6.14.0 tag? |
|
Guys, I didn't pay attention to pins modified (just looked on ones added) and I just spent time looking from a dirty bug. My BufferedSerial worked fine and does not anymore after this commit. It's connected to PA_2 PA_3 (Named serial 2 on LoRa E5) and since it's now // PinMap_UART_TX
{PA_2, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{PA_2_ALT0, LPUART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)},
// PinMap_UART_RX
{PA_3, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{PA_3_ALT0, LPUART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)},And works with old scheme //PinMap_UART_TX
{PA_2, LPUART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)},
//PinMap_UART_RX
{PA_3, LPUART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)},
Not sure of the cause but that change broke the code, any chance to revert back ? I always fixed a nasty bug related to modbus (same pins) few days ago and I'm pretty sure it's related to same things. |
|
Ok, fixed changing my // Instance Serial
//static BufferedSerial modbus_serial(PA_2, PA_3);
static BufferedSerial modbus_serial(PA_2_ALT0, PA_3_ALT0);And here we go |
|
OK, |
|
Yeah even if it works otherwise using ALT_0 may be letting default would avoid end user some headache You mean something like that? @jpmeijers makes sense to you? |
|
I actually prefer the way it currently is. PA2/PA3 are the only two pins on which UART2 can be used, so it makes sense keeping them as the default. LPUART is the only one that can be used on PC0/PC1 and should therefore be the default there. Which leaves us with LPUART as the "Alternate" function on PA2/PA3 - like it is currently. Edit: |
|
Sounds good to me keeping things like that.
Because I'm using 2 Serial devices on 2 different projects, each is connected to PA_2/PA_3 of LoRa E5. Really nothing fancy on serial port communication, just used So now, since these changes, I changed static BufferedSerial modbus_serial(PA_2, PA_3);to static BufferedSerial modbus_serial(PA_2_ALT0, PA_3_ALT0);and things worked back again, don't ask me why just using UART2 it does not work, I have no idea, code after serial init in project 2 is simple as that (looking from frame sent on regular basis by serial device) while (_sensor_serial.readable())
{
uint8_t c;
_sensor_serial.read(&c, 1);
// blah blah
} |
Maybe because UART2 is missing in :-( |
|
Even with that missing my serial loopback works fine. I have a short between PA2 and PA3 and another short between PC1 and PC0. mbed0s 6.15.0 mbed_app.json {
"config": {
"main_stack_size": { "value": 4096 }
},
"target_overrides": {
"*": {
"platform.stdio-convert-newlines": true,
"platform.stdio-baud-rate": 115200,
"platform.default-serial-baud-rate": 115200,
"mbed-trace.enable": false,
"mbed-trace.max-level": "TRACE_LEVEL_DEBUG"
}
}
}main.cpp #include "mbed.h"
UnbufferedSerial pc(PB_6, PB_7); // UART_1
UnbufferedSerial loop(PA_2, PA_3); // UART_2
// UnbufferedSerial loop(PA_2_ALT0, PA_3_ALT0); // LPUART_1
// UnbufferedSerial loop(PC_1, PC_0); // LPUART_1
int main()
{
printf("Startup\n");
char byteRead = 0;
while (true) {
while(pc.readable()) {
pc.read(&byteRead, 1);
loop.write(&byteRead, 1);
}
while(loop.readable()) {
loop.read(&byteRead, 1);
pc.write(&byteRead, 1);
}
}
}And also testing both UART2 and LPUART at the same time works #include "mbed.h"
UnbufferedSerial pc(PB_6, PB_7); // UART_1
UnbufferedSerial loop(PA_2, PA_3); // UART_2
// UnbufferedSerial loop(PA_2_ALT0, PA_3_ALT0); // LPUART_1
UnbufferedSerial loopLp(PC_1, PC_0); // LPUART_1
int main()
{
printf("Startup\n");
char byteRead = 0;
while (true) {
while(pc.readable()) {
pc.read(&byteRead, 1);
loop.write(&byteRead, 1);
loopLp.write(&byteRead, 1);
}
while(loop.readable()) {
loop.read(&byteRead, 1);
pc.write(&byteRead, 1);
}
while(loopLp.readable()) {
loopLp.read(&byteRead, 1);
pc.write(&byteRead, 1);
}
}
}Maybe something else in @hallard's code is interfering with UART2? @hallard can you maybe run this simple loopback program and see if that works for you? |
Corrected in ARMmbed/mbed-os#15134 |
Fix #19
For information, used command to generate file templates: