Skip to content
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

SX1262 version of TBEAM V1.1? #75

Closed
MrSniffer opened this issue Oct 3, 2022 · 21 comments
Closed

SX1262 version of TBEAM V1.1? #75

MrSniffer opened this issue Oct 3, 2022 · 21 comments

Comments

@MrSniffer
Copy link

MrSniffer commented Oct 3, 2022

Does the schematic here reflect the SX1262 version of the board? The markings just say "V1.1".

And please tell me which arduino.h file corresponds to this board. All the ones I seem to have refer to the SX1276 model in the comments.

@lewisxhe
Copy link
Contributor

lewisxhe commented Oct 3, 2022

The label sticker on the Radio module is 1262 if sx1262 is written, the board can choose TTGO-T-Beam, if only 868MHz is written then it is SX1276

@MrSniffer
Copy link
Author

My sketch needs to use different APIs for a SX1276 board vs. a SX1262 board. What #defines in arduino.h should I use to find out (at compile time) which board I am building for? The Arduino Board Manager doesn't have a "TBeam (SX1276)" and a "TBeam (SX1262)" option, with different #defines in them.

@lewisxhe
Copy link
Contributor

lewisxhe commented Oct 8, 2022

In fact, you need to define the model used in the radio in the sketch
You can view this:

SX1278 radio = new Module(RADIO_CS_PIN, RADIO_DI0_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN);

@MrSniffer
Copy link
Author

That is exactly what I don't want to do. There needs to be two different arduino.h files, one for the SX1276 version and one for the SX1262 version, which are automatically set when you select a Board type in the Arduino IDE Board Manager. The source code then uses #ifdef's to compile the right statements.

I'm sorry that you don't comprehend the nature of the problem, Lewis.

Sigh. Someone at LilyGo needs to put some effort into making useful and accurate support information. Another example, the pinout JPG of the SX1262 version is incomplete, and doesn't show BUSY and DIO1.

@lewisxhe
Copy link
Contributor

lewisxhe commented Oct 8, 2022

You should use ArduinoIDE? I see what you mean. You mean to select the option of adding a Radio on the T-Beam board, right?
I need to confirm the pin diagram with my colleagues, because the pin diagram is not made by me

@MrSniffer
Copy link
Author

Yes, I use Arduino IDE. Having only one Board definition for the two different version of the TBeam V1.1 doesn't permit one to distinguish between the two in the code itself, using some #ifdef etc. preprocessor statements. I think one should select between the two versions using the Board Manager of the IDE, not editing the source code depending on the board.

@lewisxhe
Copy link
Contributor

lewisxhe commented Oct 8, 2022

This is a good suggestion. At the beginning of T-Beam, there was no clear definition of which radio model to use, so there was only one definition of the board. I agree with your suggestion, but this needs to be addressed to esp32_ Submit board changes in arduinoCore. It will take some time. I will submit PR in these days. Please wait for a while

@lewisxhe
Copy link
Contributor

lewisxhe commented Oct 8, 2022

image
What do you think?
@MrSniffer

@MrSniffer
Copy link
Author

Very nice looking UI. The other part of the job is to make sure there is a corresponding #define in each arduino.h. I'm happy to test a beta version of this when you are ready.

@lewisxhe
Copy link
Contributor

lewisxhe commented Oct 8, 2022

You can try to replace Arduino first_ Boards in the Core Try the txt file. Remember to back up the original boards.txt first
boards.txt

image

@MrSniffer
Copy link
Author

I don't know what macro to use in my code that will utilize the board and/or variant settings from board.txt. I think the preprocessor defines some ARDUINO_xxxx_yyyy macros for this purpose but I can't find their definitions. Can anyone help out here?

@lewisxhe
Copy link
Contributor

lewisxhe commented Oct 8, 2022


#if defined(TBEAM_USE_RADIO_SX1262)

#elif defined(TBEAM_USE_RADIO_SX1276)

#elif defined(TBEAM_USE_RADIO_SX1278)

#elif defined(TBEAM_USE_RADIO_SX1280)

#elif defined(TBEAM_USE_RADIO_SX1268)

#endif

@MrSniffer
Copy link
Author

Aha. OK, now I can hack the build.txt and get the job done! Many thanks for the hand holding.

@MrSniffer
Copy link
Author

I've made edits to my local build.txt and variants folder, but my "revisions" don't appear as part of the Tools menu. Am I not setting something? Or is the release version from espressif overriding these changes?

t-beam.build.tarch=xtensa
t-beam.build.bootloader_addr=0x1000
t-beam.build.target=esp32
t-beam.build.mcu=esp32
t-beam.build.core=esp32
t-beam.build.board=TTGO

t-beam.menu.Revision.tbeam_V1=TTGO V1.1 LoRa32
t-beam.menu.Revision.tbeam_V1.build.board=TTGO_SX1276
t-beam.menu.Revision.tbeam_V1.build.variant=tbeam-v1
t-beam.menu.Revision.tbeam_V2=TTGO V1.1 SX1262
t-beam.menu.Revision.tbeam_V2.build.board=TTGO_SX1262
t-beam.menu.Revision.tbeam_V2.build.variant=tbeam-v2

@lewisxhe
Copy link
Contributor

lewisxhe commented Oct 9, 2022

You cannot subdivide variant under tbeam. Please refer to Arduino documentation

https://arduino.github.io/arduino-cli/0.27/platform-specification/

@MrSniffer
Copy link
Author

I've read through that documentation and I don't see anything about Revisions at all! I'll hack a different board, but it is a mystery still why it doesn't work for tbeam. Can you kindly explain the difference between tbeam and ttgo-lora32-oled?

@MrSniffer
Copy link
Author

Can you post or email me your changes to boards.txt that made the five separate board revisions show up? I just can't have any of my changes apply, even by using boards.local.txt.

@lewisxhe
Copy link
Contributor

I'm not sure which board you mean by ttgo-lara32 oled. The lora of ttgo basically has oled, and there are many versions, including many historical versions. The only difference between them is that the pin distribution is inconsistent. The tbeam is the only version of ttgo esp32 that has GPS and PSRAM, and the other versions have little difference.
Do you want to create different variant files for each board? Why don't you use macro definitions to distinguish between programs?

@MrSniffer
Copy link
Author

Several days ago you posted an image and boards.txt file which showed five different revisions of the basic tbeam board. I am trying to recreate that, and will make my own local edits as needed. But when I install your modified boards.txt in my AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5 directory, the changes to the Tools menu do NOT take place. Is the Arduino IDE reloading the espressif version anyhow? I am puzzled!

@MrSniffer
Copy link
Author

I finally found the problem and workaround. As indicated in this Issue:
arduino/arduino-ide#1030
the Arduino IDE caches boards.txt in the Windows version. So after editing boards.txt, one has to delete the AppData\Roaming\arduino-ide directory and reload the IDE.

@lewisxhe
Copy link
Contributor

lewisxhe commented Dec 8, 2022

There is no activity for a long time. Please reopen it if there are other problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants