After further thinking, I don't believe this to be the case. Using a running RMS calculation the PWM update frequency can be left as is.
The problem is the current and not the PWM update speed.
After further thinking, I don't believe this to be the case. Using a running RMS calculation the PWM update frequency can be left as is.
Code: Select all
int16_t max_input_a = [&]() -> int16_t {
// If force_ac_input_amps is set, it overrides everything except
// INPUT_CURRENT_MAX_A.
if(force_ac_input_amps != 0)
return force_ac_input_amps;
// Otherwise use EVSE CP PWM limit
return evse_allowed_amps;
}();
Code: Select all
int16_t max_input_a;
if(force_ac_input_amps != 0)
{
max_input_a = force_ac_input_amps;
}
else
{
max_input_a = evse_allowed_amps;
}
Do you have a bootloader on in the 328p? Did you buy the logic board as a complete kit from EVBMW then there should be a bootloader present.glink wrote: ↑Mon Mar 15, 2021 7:26 pm Hi, lots of advanced discussions, great! But do we have some descriptions for actually getting the code into the 328p? Nothing here: https://openinverter.org/wiki/Toyota_Pr ... p_Firmware, and I'm having trouble and probably not setting stuff up correctly
I think you have the programming cable in the opposite direction, the gnd (black) should be facing the center of the board and not the edge. The silk screen (white text on the board) should read "blk" where the gnd goes.glink wrote: ↑Mon Mar 15, 2021 7:26 pm Hi, lots of advanced discussions, great! But do we have some descriptions for actually getting the code into the 328p? Nothing here: https://openinverter.org/wiki/Toyota_Pr ... p_Firmware, and I'm having trouble and probably not setting stuff up correctly
I really struggle understanding the lamda part and what it does exactly. This is very much above my level of coding.
Code: Select all
// If force_ac_input_amps is set, it overrides everything except INPUT_CURRENT_MAX_A.
// Otherwise use EVSE CP PWM limit
int16_t max_input_a = (force_ac_input_amps != 0 ? force_ac_input_amps : evse_allowed_amps);
Ok, great! Thank you for the explanation!celeron55 wrote: ↑Tue Mar 16, 2021 8:51 am Actually that particular code ended up simple enough to be written clearer using the ternary operator, so the lamda is there just for some extension I was expecting to make but didn't. I'd replace it with this which does the same thing but usually makes a mess when extended more.
Your if-else translation looks correct also.Code: Select all
// If force_ac_input_amps is set, it overrides everything except INPUT_CURRENT_MAX_A. // Otherwise use EVSE CP PWM limit int16_t max_input_a = (force_ac_input_amps != 0 ? force_ac_input_amps : evse_allowed_amps);
Sure, was programmed by Damien, but just to be 100% sure I reprogrammed the bootloader using the Atmel ICEbexander wrote: ↑Tue Mar 16, 2021 5:50 amDo you have a bootloader on in the 328p? Did you buy the logic board as a complete kit from EVBMW then there should be a bootloader present.glink wrote: ↑Mon Mar 15, 2021 7:26 pm Hi, lots of advanced discussions, great! But do we have some descriptions for actually getting the code into the 328p? Nothing here: https://openinverter.org/wiki/Toyota_Pr ... p_Firmware, and I'm having trouble and probably not setting stuff up correctly
Then, in Arduino IDE, you need to select board: "Arduino Nano". There are some notes in the beginning of the .ino file that describes this.
Crap, was laser focused on the "5V" on the silk screen, but that just tells "FTDI 5V"...stupid me not measuring first. But same thing, not working still, but now I maybe have fried some parts of the 328p...well Damien, maybe another order coming soon...bexander wrote: ↑Tue Mar 16, 2021 5:56 amI think you have the programming cable in the opposite direction, the gnd (black) should be facing the center of the board and not the edge. The silk screen (white text on the board) should read "blk" where the gnd goes.glink wrote: ↑Mon Mar 15, 2021 7:26 pm Hi, lots of advanced discussions, great! But do we have some descriptions for actually getting the code into the 328p? Nothing here: https://openinverter.org/wiki/Toyota_Pr ... p_Firmware, and I'm having trouble and probably not setting stuff up correctly
If none of this works, try swapping rx and tx on the programming cable.
There are 1k series resistors between connector rx and tx pins and 328 so you should... be ok. When I program I used a FTDI cable with the pinout as per stock so I expect that you should have the same pinout from your FTDI-board and hence not crossing TX/RX should be the way to go.glink wrote: ↑Tue Mar 16, 2021 2:42 pmCrap, was laser focused on the "5V" on the silk screen, but that just tells "FTDI 5V"...stupid me not measuring first. But same thing, not working still, but now I maybe have fried some parts of the 328p...well Damien, maybe another order coming soon...bexander wrote: ↑Tue Mar 16, 2021 5:56 amI think you have the programming cable in the opposite direction, the gnd (black) should be facing the center of the board and not the edge. The silk screen (white text on the board) should read "blk" where the gnd goes.glink wrote: ↑Mon Mar 15, 2021 7:26 pm Hi, lots of advanced discussions, great! But do we have some descriptions for actually getting the code into the 328p? Nothing here: https://openinverter.org/wiki/Toyota_Pr ... p_Firmware, and I'm having trouble and probably not setting stuff up correctly
If none of this works, try swapping rx and tx on the programming cable.
Thanks, Bexander, that definitely was one issue. Have also tried not crossing the TX/RX just to try it, but expect them to be crossed. Have some other FTDI boards coming also in case there is an issue with that part of the equation.
Sweet, maybe the FTDI board never worked. Tried with different baud rates, same...also traced the rx and tx pins to the 328pbexander wrote: ↑Tue Mar 16, 2021 3:28 pmThere are 1k series resistors between connector rx and tx pins and 328 so you should... be ok. When I program I used a FTDI cable with the pinout as per stock so I expect that you should have the same pinout from your FTDI-board and hence not crossing TX/RX should be the way to go.glink wrote: ↑Tue Mar 16, 2021 2:42 pmCrap, was laser focused on the "5V" on the silk screen, but that just tells "FTDI 5V"...stupid me not measuring first. But same thing, not working still, but now I maybe have fried some parts of the 328p...well Damien, maybe another order coming soon...bexander wrote: ↑Tue Mar 16, 2021 5:56 am
I think you have the programming cable in the opposite direction, the gnd (black) should be facing the center of the board and not the edge. The silk screen (white text on the board) should read "blk" where the gnd goes.
If none of this works, try swapping rx and tx on the programming cable.
Thanks, Bexander, that definitely was one issue. Have also tried not crossing the TX/RX just to try it, but expect them to be crossed. Have some other FTDI boards coming also in case there is an issue with that part of the equation.
What is happening when you try to upload, with board set to "Arduino Nano"?
Thanks for having a look, have tried the old bootloader option also, afaik it only lowers the baud rate. I have tried all baud rates down to 9600 from the command line. The RX led is blinking at each retry, so some kind of communication is going on. Resetting happens after the upload, right?
For now, the culprit imho is the FTDI board. Uploaded a sketch with the Atmel ICE, but still no serial I/O. Until I get a new FTDI board I will program using the Atmel ICE, but it's a bit more cumbersome.