I’m not sure which Ph.D degree but before trying to do anything with LoRaWAN security, the very minimum is that you first grasp the LoRaWAN basics and e.g. get a simple LoRaWAN node working, first with ABP, then with OTAA.
Basics, so no additional stuff for sensors etc. whatever.
From a Phd.D student I would expect that you try to understand the underlying technology (to a fair amount) first, and from there come up with targeted questions and provide all relevant information.
From this thread I do get a strong impression though that your primary goal is mainly to get your current assignment working so you can move on to your next step.
To be honest, I mainly see questions like ‘please help me get this code working’ instead of asking questions like “what do I need to…”, “why…”, “where can I find information about…”, “do I understand correctly…”, “is my assumption correct…” etc. and so whith all respect I get the impression that you want to let others do your own homework.
LoRaWAN is not simple and many aspects are involved. Several experienced people have tried to help you in this thread, but you seem not to pick up all advice given. @kersing told you to have a look at LMIC-node, but apparently you have not.
As a Ph.D student an important aspect is doing research. How hard is it to research information that is provided ‘handed onto a silver platter’?
Have a good look at LMIC-node. It is well structured and well documented and supports your Adafruit Feather M0 LoRa board right out of the box. With LMIC-node you can get a working node up and running literally in minutes (once you have read the documentation and are already familiar with the TTN console).
Once you have it up and running you can start extending or modifying it to your needs and liking, e.g. add code for reading a temperature sensor. You don’t have to use LMIC-node for your own code but it will at least show how things can be done to get them working (and contains the experience of several lessons learned).
If you need additional help, first research and experiment and then come up with targeted questions supplied with sufficient information so others can use their time more efficient to provide any answers.