Whilst trying to get SPI working on a Heltec Wifi kit..
I notice PRESCALE_VAR_X in CAL\ESP\ESP_CAL_SPI.c is defined as a MX_UINT8. (Line 106)
This is likely to not work well (it is calculated from Prescale (PR_SCALE) which is 1..800 so the result won't fit into 8 bits.
Pin assignments for hardware channels still don't seem to work correctly.
Martin
ESP32 CAL SPI error
-
- Valued Contributor
- Posts: 1549
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 138 times
- Been thanked: 737 times
-
- Valued Contributor
- Posts: 1549
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 138 times
- Been thanked: 737 times
Re: ESP32 SPI Type error
Another problem with cal_spi.
I actually noticed this when I converted an Arduino project to ESP32 (modded the project SPI to transaction mode) - found my esp32 board seemed to have died and then converted back to Arduino (changing the project type here is VERY slooowwww)
This is easily replicated by starting with an esp32 project:
Create a project for ESP32 (I used Heltec Wifi Kit 32) and add a cal_spi component. Optionally - add a call to Master_Init()
Then convert project type to Arduino (I used Nano)
Then the cal_spi component now has a prescale of up to 80MHz (and project won't compile if any calls (ie Master_Init) to SPI added)
Martin
I actually noticed this when I converted an Arduino project to ESP32 (modded the project SPI to transaction mode) - found my esp32 board seemed to have died and then converted back to Arduino (changing the project type here is VERY slooowwww)
This is easily replicated by starting with an esp32 project:
Create a project for ESP32 (I used Heltec Wifi Kit 32) and add a cal_spi component. Optionally - add a call to Master_Init()
Then convert project type to Arduino (I used Nano)
Then the cal_spi component now has a prescale of up to 80MHz (and project won't compile if any calls (ie Master_Init) to SPI added)
Martin
-
- Valued Contributor
- Posts: 458
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 82 times
- Been thanked: 246 times
Re: ESP32 CAL SPI error
Hi Martin
Thanks
Thanks for the spot, but we don't actually use the PRESCALE_VAR_X variable, we use MX_SPI_PR_SCALE_X directly instead on ESP.I notice PRESCALE_VAR_X in CAL\ESP\ESP_CAL_SPI.c is defined as a MX_UINT8. (Line 106)
This is likely to not work well (it is calculated from Prescale (PR_SCALE) which is 1..800 so the result won't fit into 8 bits.
Do any pin assignments work for you, or is it any pins in particular?Pin assignments for hardware channels still don't seem to work correctly.
Thanks
-
- Valued Contributor
- Posts: 1549
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 138 times
- Been thanked: 737 times
Re: ESP32 CAL SPI error
Thanks Leigh,
- The pins are not 'auto-selected' on choosing channel 1 or 2 and just stay 'locked' on whatever they are set to. Have to change the remap pins here...
The Prescale - threw up a compiler warning so was an easy spot whilst traying to work out why my code wouldn't compile after changing from Arduino....
Any thoughts on the 'downgrading' to Arduino problem - I manged to patch the XML on a small project (using the Compare add-on in Notepad++) but it's a delicate task on a bigger one, and FC crashes on little mistakes.
Martin
- The pins are not 'auto-selected' on choosing channel 1 or 2 and just stay 'locked' on whatever they are set to. Have to change the remap pins here...
The Prescale - threw up a compiler warning so was an easy spot whilst traying to work out why my code wouldn't compile after changing from Arduino....
Any thoughts on the 'downgrading' to Arduino problem - I manged to patch the XML on a small project (using the Compare add-on in Notepad++) but it's a delicate task on a bigger one, and FC crashes on little mistakes.
Martin
-
- Valued Contributor
- Posts: 458
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 82 times
- Been thanked: 246 times
Re: ESP32 CAL SPI error
I think that’s intentional as the preferred action in most cases, i.e. the remap pins stay as the user selection when the channel is changed.- The pins are not 'auto-selected' on choosing channel 1 or 2 and just stay 'locked' on whatever they are set to. Have to change the remap pins here…
Good point, I will edit the code to remove the warnings.The Prescale - threw up a compiler warning so was an easy spot whilst traying to work out why my code wouldn't compile after changing from Arduino.…
Oh, I see what you mean now, that’s an interesting bug. Will investigate further.Any thoughts on the 'downgrading' to Arduino problem - I manged to patch the XML on a small project (using the Compare add-on in Notepad++) but it's a delicate task on a bigger one, and FC crashes on little mistakes.