Linux serial_posix vs. Windows serial_w32

Post here first, or if you can't find a relevant section!
ozcar
Posts: 143
Joined: Wed Apr 29, 2020 9:07 pm
Answers: 5

Re: Linux serial_posix vs. Windows serial_w32

Post by ozcar »

fpiSTM wrote: Mon May 30, 2022 11:43 am You can try to cast them as uint.
Both getEpochTime() and inReference are uint32_t, so what is that statement trying to achieve?

Maybe forget using abs???

Code: Select all

return (getEpochTime() > inReference ) ?  getEpochTime() - inReference : inReference - getEpochTime();
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Linux serial_posix vs. Windows serial_w32

Post by fpiSTM »

STL C++ abs() is as described in this link:
https://en.cppreference.com/w/cpp/numeric/math/abs

so as stated by the log: abs(uint32_t) does not exist.
Simply cast like that:
return (abs(((long long)getEpochTime() - (long long)inReference)));

Moreover subtract 2 unsigned number is not advised...

This code is not part of the STM32RTC library, so it is not link to the core. It is purely an issue in the code you used.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Linux serial_posix vs. Windows serial_w32

Post by fpiSTM »

simpleboy wrote: Mon May 30, 2022 7:49 am This variant I make is also the one I use in the deprecated stm32 core version 1.5.0.

I want to update it now to the official stm32 core, but I think I need to edit a lot of things, maybe I have more dependencies on that earlier version. I appreciate your help with this.
I've made a PR with the variant, please test it as I do not have this SIP.
simpleboy
Posts: 19
Joined: Wed Apr 27, 2022 9:01 am
Answers: 1

Re: Linux serial_posix vs. Windows serial_w32

Post by simpleboy »

fpiSTM wrote: Tue May 31, 2022 7:39 am
simpleboy wrote: Mon May 30, 2022 7:49 am This variant I make is also the one I use in the deprecated stm32 core version 1.5.0.

I want to update it now to the official stm32 core, but I think I need to edit a lot of things, maybe I have more dependencies on that earlier version. I appreciate your help with this.
I've made a PR with the variant, please test it as I do not have this SIP.
The variant works fine. Thank you.
simpleboy
Posts: 19
Joined: Wed Apr 27, 2022 9:01 am
Answers: 1

Re: Linux serial_posix vs. Windows serial_w32

Post by simpleboy »

fpiSTM wrote: Tue May 31, 2022 7:33 am STL C++ abs() is as described in this link:
https://en.cppreference.com/w/cpp/numeric/math/abs

so as stated by the log: abs(uint32_t) does not exist.
Simply cast like that:
return (abs(((long long)getEpochTime() - (long long)inReference)))

Moreover subtract 2 unsigned number is not advised...

This code is not part of the STM32RTC library, so it is not link to the core. It is purely an issue in the code you used.
Casted it like what you suggest:

Code: Select all

return (abs(((long long)getEpochTime() - (long long)inReference)));
The program compiles now.
simpleboy
Posts: 19
Joined: Wed Apr 27, 2022 9:01 am
Answers: 1

Re: Linux serial_posix vs. Windows serial_w32

Post by simpleboy »

The program compiles now. I uploaded it using Upload Method: STM32CubeProgrammer(Serial)

It got some issues on running the program:

Maybe because of the default port setting. I wonder where can I modify it. I need a parity bit of "none". Thanks for your help.

Code: Select all

 -------------------------------------------------------------------
                        STM32CubeProgrammer v2.10.0                  
      -------------------------------------------------------------------

Serial Port ttyUSB0 is successfully opened.
Port configuration: parity = even, baudrate = 115200, data-bit = 8,
                     stop-bit = 1.0, flow-control = off
simpleboy
Posts: 19
Joined: Wed Apr 27, 2022 9:01 am
Answers: 1

Re: Linux serial_posix vs. Windows serial_w32

Post by simpleboy »

I have modified it on stm32CubeProg.sh

I added p=none:

Code: Select all

${STM32CP_CLI}  -c port=${PORT} p=none ${MODE} ${ERASE:+"-e all"} -q -d "${FILEPATH}" ${ADDRESS} "${OPTS}" 
I received this error message:

Code: Select all

-------------------------------------------------------------------
                        STM32CubeProgrammer v2.10.0                  
      -------------------------------------------------------------------

Serial Port ttyUSB0 is successfully opened.
Port configuration: parity = none, baudrate = 115200, data-bit = 8,
                     stop-bit = 1.0, flow-control = off

Timeout error occured while waiting for acknowledgement.
Activating device: OK
Board       : --

Response received from device: NACK
Error: GETID command not acknowledged!

Reemission of GetID command
simpleboy
Posts: 19
Joined: Wed Apr 27, 2022 9:01 am
Answers: 1

Re: Linux serial_posix vs. Windows serial_w32

Post by simpleboy »

Hello all,

Just to update on this issue. I have solved it already. It seems I missed out to provide modifications on my LMIC library. Problem does not occur beause my my operating system. The cause of the stall is when the program is trying to connect with the LoRaWAN network server. I just add the necessary files for my ACSIP variant. Thank you all for your help. :D :D :D
Post Reply

Return to “General discussion”